2002-09-19 00:39:38 +00:00
|
|
|
/* Objective-C language support routines for GDB, the GNU debugger.
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2008-01-01 22:53:26 +00:00
|
|
|
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
|
|
|
|
Free Software Foundation, Inc.
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 04:12:10 +00:00
|
|
|
Contributed by Apple Computer, Inc.
|
|
|
|
Written by Michael Snyder.
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 04:12:10 +00:00
|
|
|
This file is part of GDB.
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 04:12:10 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 18:08:50 +00:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-09-19 04:12:10 +00:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 18:08:50 +00:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "symtab.h"
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
#include "expression.h"
|
|
|
|
#include "parser-defs.h"
|
|
|
|
#include "language.h"
|
2002-09-19 00:39:38 +00:00
|
|
|
#include "c-lang.h"
|
2002-09-18 23:29:20 +00:00
|
|
|
#include "objc-lang.h"
|
2005-01-12 Andrew Cagney <cagney@gnu.org>
* exceptions.h (enum return_reason, RETURN_MASK)
(RETURN_MASK_QUIT, RETURN_MASK_ERROR, RETURN_MASK_ALL)
(return_mask, throw_exception, catch_exceptions_ftype)
(catch_exceptions_with_msg, catch_errors_ftype, catch_errors)
(catch_command_errors_ftype, catch_command_errors): Move to
exceptions.h.
* exceptions.c, exceptions.h: New files.
* top.c: Do not include <setjmp.h>.
(SIGJMP_BUF, SIGSETJMP, SIGLONGJMP, catch_return)
(throw_exception, catcher, catch_exceptions)
(catch_exceptions_with_msg, struct catch_errors_args)
(do_catch_errors, catch_errors, struct captured_command_args)
(do_captured_command, catch_command_errors): Move to exceptions.c.
* wrapper.c, wince.c, win32-nat.c, utils.c: Include "exceptions.h".
* tui/tui-interp.c, top.c, thread.c, symmisc.c: Ditto.
* symfile-mem.c, stack.c, solib.c, rs6000-nat.c: Ditto.
* remote-sds.c, remote-mips.c, remote-fileio.c: Ditto.
* remote-e7000.c, objc-lang.c, ocd.c: Ditto.
* remote.c, nto-procfs.c, monitor.c, mi/mi-main.c: Ditto.
* main.c, m32r-rom.c, infrun.c, inf-loop.c: Ditto.
* hppa-hpux-tdep.c, frame.c, event-top.c, event-loop.c: Ditto.
* corelow.c, corefile.c, cli/cli-interp.c, breakpoint.c: Ditto.
* ada-valprint.c, ada-lang.c: Ditto.
* Makefile.in (HFILES_NO_SRCDIR, COMMON_OBS): Add exceptions.h and
exceptions.o. Update all dependencies.
2005-01-12 18:31:35 +00:00
|
|
|
#include "exceptions.h"
|
2002-09-18 23:29:20 +00:00
|
|
|
#include "complaints.h"
|
|
|
|
#include "value.h"
|
|
|
|
#include "symfile.h"
|
|
|
|
#include "objfiles.h"
|
2002-10-04 01:18:48 +00:00
|
|
|
#include "gdb_string.h" /* for strchr */
|
2002-09-18 23:29:20 +00:00
|
|
|
#include "target.h" /* for target_has_execution */
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
#include "frame.h"
|
|
|
|
#include "gdb_regex.h"
|
|
|
|
#include "regcache.h"
|
2003-02-19 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add block.c.
(block_h): New.
(COMMON_OBS): Add block.o.
(block.o): New.
(x86-64-tdep.o): Add $(block_h).
(values.o, valops.o, tracepoint.o, symtab.o, symmisc.o, symfile.o)
(stack.o, printcmd.o, p-exp.tab.o, parse.o, objfiles.o)
(objc-exp.tab.o, objc-lang.o, nlmread.o, mips-tdep.o, mdebugread.o)
(m2-exp.tab.o, linespec.o, jv-lang.o, jv-exp.tab.o, infcmd.o)
(f-valprint.o, findvar.o, f-exp.tab.o, expprint.o, coffread.o)
(c-exp.tab.o, buildsym.o, breakpoint.o, blockframe.o, ax-gdb.o)
(alpha-tdep.o, ada-lang.o, ada-exp.tab.o, mi-cmd-stack.o): Ditto.
* value.h: Add opaque declaration for struct block.
* parser-defs.h, objc-lang.h, buildsym.h, breakpoint.h: Ditto.
* ada-lang.h: Ditto.
* x86-64-tdep.c: #include "block.h"
* values.c, valops.c, tracepoint.c, symtab.c, symmisc.c: Ditto.
* symfile.c, stack.c, printcmd.c, p-exp.y, parse.c: Ditto.
* objfiles.c, objc-exp.y, objc-lang.c, nlmread.c: Ditto.
* mips-tdep.c, mdebugread.c, m2-exp.y, linespec.c: Ditto.
* jv-lang.c, jv-exp.y, infcmd.c, f-valprint.c: Ditto.
* findvar.c, f-exp.y, expprint.c, coffread.c, c-exp.y: Ditto.
* buildsym.c, breakpoint.c, blockframe.c, ax-gdb.c: Ditto.
* alpha-tdep.c, ada-lang.c, ada-exp.y: Ditto.
* blockframe.c (blockvector_for_pc_sect): Move to "block.c".
(blockvector_for_pc, block_for_pc_sect, block_for_pc): Ditto.
* symtab.c (block_function): Ditto.
(contained_in): Ditto.
* frame.h: Move block_for_pc and block_for_pc_sect declarations to
block.h. Add opaque declaration for struct block.
* symtab.h: Move block_function and contained_in declarations to
block.h. Add opaque declarations for struct block, struct
blockvector.
(struct block): Move to block.h.
(struct blockvector): Ditto.
(BLOCK_START, BLOCK_END, BLOCK_FUNCTION, BLOCK_SUPERBLOCK)
(BLOCK_GCC_COMPILED, BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM)
(BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE)
(ALL_BLOCK_SYMBOLS, BLOCK_SHOULD_SORT, BLOCKVECTOR_NBLOCKS)
(BLOCKVECTOR_BLOCK, GLOBAL_BLOCK, STATIC_BLOCK, FIRST_LOCAL_BLOCK):
Ditto.
* block.c: New file.
* block.h: New file.
2003-02-19 David Carlton <carlton@math.stanford.edu>
* mi-cmd-stack.c: #include "block.h"
2003-02-20 00:01:07 +00:00
|
|
|
#include "block.h"
|
2003-04-21 Andrew Cagney <cagney@redhat.com>
* infcall.c: New file.
* infcall.h: New file.
* valarith.c: Include "infcall.h".
* scm-lang.c, objc-lang.cm, hppa-tdep.c, gcore.c: Ditto.
* eval.c, ada-valprint.c, ada-lang.c: Ditto.
* Makefile.in (valarith.o, scm-lang.o): Update dependencies.
(objc-lang.o, hppa-tdep.o, gcore.o): Update dependencies.
(eval.o, ada-valprint.o, ada-lang.o): Update dependencies.
(SFILES): Add "infcall.c"
(COMMON_OBS): Add "infcall.o".
(infcall.o): Specify dependencies.
* value.h (call_function_by_hand): Delete declaration.
* inferior.h (run_stack_dummy): Delete declaration.
* infcmd.c (breakpoint_auto_delete_contents): Move to "infcall.c".
(run_stack_dummy): Move to "infcall.c", merged into
call_function_by_hand.
* valops.c (call_function_by_hand): Moved to "infcall.c".
(find_function_addr, value_arg_coerce): Ditto.
(unwindonsignal_p, coerce_float_to_double): Ditto.
(_initialize_valops): Move "set/show coerce-float-to-double", and
"set/show unwindonsignal" commands to "infcall.c".
* v850-tdep.c, target.h: Update comments.
* sparc-tdep.c (sparc_fix_call_dummy): Update comments.
* sh-tdep.c (sh_init_extra_frame_info): Update comments.
(sh64_init_extra_frame_info): Update comments.
* mn10300-tdep.c: Update comments.
* mcore-tdep.c (mcore_init_extra_frame_info): Update comments.
* config/sparc/tm-sparc.h: Update comments.
* breakpoint.h: Update comments.
* avr-tdep.c (avr_init_extra_frame_info): Update comments.
* arm-tdep.c: Update comment.
2003-04-21 16:48:41 +00:00
|
|
|
#include "infcall.h"
|
2003-04-25 03:30:17 +00:00
|
|
|
#include "valprint.h"
|
2003-05-23 16:02:30 +00:00
|
|
|
#include "gdb_assert.h"
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
struct objc_object {
|
|
|
|
CORE_ADDR isa;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct objc_class {
|
|
|
|
CORE_ADDR isa;
|
|
|
|
CORE_ADDR super_class;
|
|
|
|
CORE_ADDR name;
|
|
|
|
long version;
|
|
|
|
long info;
|
|
|
|
long instance_size;
|
|
|
|
CORE_ADDR ivars;
|
|
|
|
CORE_ADDR methods;
|
|
|
|
CORE_ADDR cache;
|
|
|
|
CORE_ADDR protocols;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct objc_super {
|
|
|
|
CORE_ADDR receiver;
|
|
|
|
CORE_ADDR class;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct objc_method {
|
|
|
|
CORE_ADDR name;
|
|
|
|
CORE_ADDR types;
|
|
|
|
CORE_ADDR imp;
|
|
|
|
};
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Lookup a structure type named "struct NAME", visible in lexical
|
|
|
|
block BLOCK. If NOERR is nonzero, return zero if NAME is not
|
|
|
|
suitably defined. */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
struct symbol *
|
|
|
|
lookup_struct_typedef (char *name, struct block *block, int noerr)
|
|
|
|
{
|
2003-09-09 08:05:43 +00:00
|
|
|
struct symbol *sym;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2003-05-14 Elena Zannoni <ezannoni@redhat.com>
* symtab.h (enum domain_enum): Rename from namespace_enum.
(UNDEF_DOMAIN, VAR_DOMAIN, STRUCT_DOMAIN, LABEL_DOMAIN,
VARIABLES_DOMAIN, FUNCTIONS_DOMAIN, TYPES_DOMAIN, METHODS_DOMAIN):
Rename from UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE,
LABEL_NAMESPACE, VARIABLES_NAMESPACE, FUNCTIONS_NAMESPACE,
TYPES_NAMESPACE, METHODS_NAMESPACE.
(SYMBOL_NAMESPACE): Rename to SYMBOL_DOMAIN.
(struct symbol, struct partial_symbol): Rename field
'namespace_enum namespace' to 'domain_enum domain'.
(PSYMBOL_NAMESPACE): Rename to PSYMBOL_DOMAIN.
Delete old define kludge for namespace.
* ada-exp.y, ada-lang.c, ada-lang.h, alpha-tdep.c, arm-tdep.c,
blockframe.c, c-exp.y, c-valprint.c, coffread.c, dbxread.c,
dwarf2read.c, dwarfread.c, f-exp.y, gdbtypes.c, gdbtypes.h,
gnu-v3-abi.c, hppa-tdep.c, hpread.c, jv-exp.y, jv-lang.c,
language.c, linespec.c, m2-exp.y, m3-nat.c, mdebugread.c,
mips-tdep.c, nlmread.c, objc-exp.y, objc-lang.c, objfiles.c,
p-exp.y, p-valprint.c, parse.c, printcmd.c, scm-lang.c, source.c,
stabsread.c, stack.c, symfile.c, symfile.h, symmisc.c, symtab.c,
valops.c, values.c, xcoffread.c, xstormy16-tdep.c: Replace all
occurrences of the above.
2003-05-12 Elena Zannoni <ezannoni@redhat.com>
* mi-mi-cmd-stack.c (list_args_or_locals): Rename VAR_NAMESPACE to
VAR_DOMAIN.
2003-05-14 17:43:20 +00:00
|
|
|
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0,
|
2002-09-19 00:39:38 +00:00
|
|
|
(struct symtab **) NULL);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
if (sym == NULL)
|
|
|
|
{
|
|
|
|
if (noerr)
|
|
|
|
return 0;
|
|
|
|
else
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("No struct type named %s."), name);
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT)
|
|
|
|
{
|
|
|
|
if (noerr)
|
|
|
|
return 0;
|
|
|
|
else
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("This context has class, union or enum %s, not a struct."),
|
2002-09-19 00:39:38 +00:00
|
|
|
name);
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
return sym;
|
|
|
|
}
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
lookup_objc_class (char *classname)
|
|
|
|
{
|
|
|
|
struct value * function, *classval;
|
|
|
|
|
|
|
|
if (! target_has_execution)
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Can't call into inferior to lookup class. */
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lookup_minimal_symbol("objc_lookUpClass", 0, 0))
|
|
|
|
function = find_function_in_inferior("objc_lookUpClass");
|
|
|
|
else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0))
|
|
|
|
function = find_function_in_inferior("objc_lookup_class");
|
|
|
|
else
|
|
|
|
{
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 18:13:55 +00:00
|
|
|
complaint (&symfile_complaints, _("no way to lookup Objective-C classes"));
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
classval = value_string (classname, strlen (classname) + 1);
|
|
|
|
classval = value_coerce_array (classval);
|
|
|
|
return (CORE_ADDR) value_as_long (call_function_by_hand (function,
|
|
|
|
1, &classval));
|
|
|
|
}
|
|
|
|
|
2004-02-18 04:22:35 +00:00
|
|
|
CORE_ADDR
|
2002-09-18 23:29:20 +00:00
|
|
|
lookup_child_selector (char *selname)
|
|
|
|
{
|
|
|
|
struct value * function, *selstring;
|
|
|
|
|
|
|
|
if (! target_has_execution)
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Can't call into inferior to lookup selector. */
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lookup_minimal_symbol("sel_getUid", 0, 0))
|
|
|
|
function = find_function_in_inferior("sel_getUid");
|
|
|
|
else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0))
|
|
|
|
function = find_function_in_inferior("sel_get_any_uid");
|
|
|
|
else
|
|
|
|
{
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-11 18:13:55 +00:00
|
|
|
complaint (&symfile_complaints, _("no way to lookup Objective-C selectors"));
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
selstring = value_coerce_array (value_string (selname,
|
|
|
|
strlen (selname) + 1));
|
2002-09-18 23:29:20 +00:00
|
|
|
return value_as_long (call_function_by_hand (function, 1, &selstring));
|
|
|
|
}
|
|
|
|
|
|
|
|
struct value *
|
|
|
|
value_nsstring (char *ptr, int len)
|
|
|
|
{
|
|
|
|
struct value *stringValue[3];
|
|
|
|
struct value *function, *nsstringValue;
|
|
|
|
struct symbol *sym;
|
|
|
|
struct type *type;
|
|
|
|
|
|
|
|
if (!target_has_execution)
|
2002-09-19 00:39:38 +00:00
|
|
|
return 0; /* Can't call into inferior to create NSString. */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2003-04-06 19:25:04 +00:00
|
|
|
sym = lookup_struct_typedef("NSString", 0, 1);
|
|
|
|
if (sym == NULL)
|
|
|
|
sym = lookup_struct_typedef("NXString", 0, 1);
|
|
|
|
if (sym == NULL)
|
2002-09-18 23:29:20 +00:00
|
|
|
type = lookup_pointer_type(builtin_type_void);
|
|
|
|
else
|
|
|
|
type = lookup_pointer_type(SYMBOL_TYPE (sym));
|
|
|
|
|
|
|
|
stringValue[2] = value_string(ptr, len);
|
|
|
|
stringValue[2] = value_coerce_array(stringValue[2]);
|
2002-09-19 00:39:38 +00:00
|
|
|
/* _NSNewStringFromCString replaces "istr" after Lantern2A. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0))
|
|
|
|
{
|
|
|
|
function = find_function_in_inferior("_NSNewStringFromCString");
|
|
|
|
nsstringValue = call_function_by_hand(function, 1, &stringValue[2]);
|
|
|
|
}
|
|
|
|
else if (lookup_minimal_symbol("istr", 0, 0))
|
|
|
|
{
|
|
|
|
function = find_function_in_inferior("istr");
|
|
|
|
nsstringValue = call_function_by_hand(function, 1, &stringValue[2]);
|
|
|
|
}
|
|
|
|
else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0))
|
|
|
|
{
|
|
|
|
function = find_function_in_inferior("+[NSString stringWithCString:]");
|
|
|
|
stringValue[0] = value_from_longest
|
|
|
|
(builtin_type_long, lookup_objc_class ("NSString"));
|
|
|
|
stringValue[1] = value_from_longest
|
|
|
|
(builtin_type_long, lookup_child_selector ("stringWithCString:"));
|
|
|
|
nsstringValue = call_function_by_hand(function, 3, &stringValue[0]);
|
|
|
|
}
|
|
|
|
else
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("NSString: internal error -- no way to create new NSString"));
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2005-02-07 Andrew Cagney <cagney@gnu.org>
* value.h (deprecated_set_value_type): Declare.
* value.c (deprecated_set_value_type): Define.
* hpacc-abi.c, gnu-v2-abi.c, cp-valprint.c: Update.
* c-valprint.c, jv-lang.c, objc-lang.c, ada-lang.c: Update.
* infcall.c, printcmd.c, valops.c, eval.c, p-exp.y: Update.
* ax-gdb.c, tracepoint.c: Update.
2005-02-07 23:51:03 +00:00
|
|
|
deprecated_set_value_type (nsstringValue, type);
|
2002-09-18 23:29:20 +00:00
|
|
|
return nsstringValue;
|
|
|
|
}
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Objective-C name demangling. */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
char *
|
2003-04-02 03:02:46 +00:00
|
|
|
objc_demangle (const char *mangled, int options)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
char *demangled, *cp;
|
|
|
|
|
|
|
|
if (mangled[0] == '_' &&
|
|
|
|
(mangled[1] == 'i' || mangled[1] == 'c') &&
|
|
|
|
mangled[2] == '_')
|
|
|
|
{
|
|
|
|
cp = demangled = xmalloc(strlen(mangled) + 2);
|
|
|
|
|
|
|
|
if (mangled[1] == 'i')
|
|
|
|
*cp++ = '-'; /* for instance method */
|
|
|
|
else
|
|
|
|
*cp++ = '+'; /* for class method */
|
|
|
|
|
|
|
|
*cp++ = '['; /* opening left brace */
|
|
|
|
strcpy(cp, mangled+3); /* tack on the rest of the mangled name */
|
|
|
|
|
|
|
|
while (*cp && *cp == '_')
|
|
|
|
cp++; /* skip any initial underbars in class name */
|
|
|
|
|
2002-10-04 01:18:48 +00:00
|
|
|
cp = strchr(cp, '_');
|
|
|
|
if (!cp) /* find first non-initial underbar */
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
2002-10-04 01:18:48 +00:00
|
|
|
xfree(demangled); /* not mangled name */
|
2002-09-18 23:29:20 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (cp[1] == '_') { /* easy case: no category name */
|
|
|
|
*cp++ = ' '; /* replace two '_' with one ' ' */
|
|
|
|
strcpy(cp, mangled + (cp - demangled) + 2);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*cp++ = '('; /* less easy case: category name */
|
2002-10-04 01:18:48 +00:00
|
|
|
cp = strchr(cp, '_');
|
|
|
|
if (!cp)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
2002-10-04 01:18:48 +00:00
|
|
|
xfree(demangled); /* not mangled name */
|
2002-09-18 23:29:20 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
*cp++ = ')';
|
2002-09-19 00:39:38 +00:00
|
|
|
*cp++ = ' '; /* overwriting 1st char of method name... */
|
2002-09-18 23:29:20 +00:00
|
|
|
strcpy(cp, mangled + (cp - demangled)); /* get it back */
|
|
|
|
}
|
|
|
|
|
|
|
|
while (*cp && *cp == '_')
|
|
|
|
cp++; /* skip any initial underbars in method name */
|
|
|
|
|
|
|
|
for (; *cp; cp++)
|
|
|
|
if (*cp == '_')
|
|
|
|
*cp = ':'; /* replace remaining '_' with ':' */
|
|
|
|
|
|
|
|
*cp++ = ']'; /* closing right brace */
|
|
|
|
*cp++ = 0; /* string terminator */
|
|
|
|
return demangled;
|
|
|
|
}
|
|
|
|
else
|
2002-09-19 00:39:38 +00:00
|
|
|
return NULL; /* Not an objc mangled name. */
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Print the character C on STREAM as part of the contents of a
|
|
|
|
literal string whose delimiter is QUOTER. Note that that format
|
|
|
|
for printing characters and strings is language specific. */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
static void
|
2003-09-09 08:05:43 +00:00
|
|
|
objc_emit_char (int c, struct ui_file *stream, int quoter)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
c &= 0xFF; /* Avoid sign bit follies. */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
if (PRINT_LITERAL_FORM (c))
|
|
|
|
{
|
|
|
|
if (c == '\\' || c == quoter)
|
|
|
|
{
|
|
|
|
fputs_filtered ("\\", stream);
|
|
|
|
}
|
|
|
|
fprintf_filtered (stream, "%c", c);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case '\n':
|
|
|
|
fputs_filtered ("\\n", stream);
|
|
|
|
break;
|
|
|
|
case '\b':
|
|
|
|
fputs_filtered ("\\b", stream);
|
|
|
|
break;
|
|
|
|
case '\t':
|
|
|
|
fputs_filtered ("\\t", stream);
|
|
|
|
break;
|
|
|
|
case '\f':
|
|
|
|
fputs_filtered ("\\f", stream);
|
|
|
|
break;
|
|
|
|
case '\r':
|
|
|
|
fputs_filtered ("\\r", stream);
|
|
|
|
break;
|
|
|
|
case '\033':
|
|
|
|
fputs_filtered ("\\e", stream);
|
|
|
|
break;
|
|
|
|
case '\007':
|
|
|
|
fputs_filtered ("\\a", stream);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
objc_printchar (int c, struct ui_file *stream)
|
|
|
|
{
|
|
|
|
fputs_filtered ("'", stream);
|
|
|
|
objc_emit_char (c, stream, '\'');
|
|
|
|
fputs_filtered ("'", stream);
|
|
|
|
}
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Print the character string STRING, printing at most LENGTH
|
|
|
|
characters. Printing stops early if the number hits print_max;
|
|
|
|
repeat counts are printed as appropriate. Print ellipses at the
|
|
|
|
end if we had to stop before printing LENGTH characters, or if
|
|
|
|
FORCE_ELLIPSES. */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
static void
|
2005-05-09 Andrew Cagney <cagney@gnu.org>
Use gdb_byte in preference to bfd_byte.
* gdbarch.sh: Update.
* gdbarch.h, gdbarch.c: Re-generate.
* ada-lang.c, ada-lang.h, ada-valprint.c, arch-utils.c: Update.
* c-lang.c, c-lang.h, c-valprint.c, cp-valprint.c: Update.
* f-lang.c, f-lang.h, f-valprint.c, gdbcore.h, jv-lang.h: Update.
* jv-valprint.c, language.c, language.h, m2-lang.c: Update.
* m2-lang.h, m2-valprint.c, objc-lang.c, p-lang.c: Update.
* p-lang.h, p-valprint.c, regcache.c, scm-lang.c: Update.
* scm-lang.h, scm-valprint.c, target.c, target.h: Update.
* tramp-frame.c, valarith.c, valops.c, valprint.c: Update.
* valprint.h, value.c, value.h: Update.
2005-05-09 21:20:35 +00:00
|
|
|
objc_printstr (struct ui_file *stream, const gdb_byte *string,
|
2002-12-03 03:52:37 +00:00
|
|
|
unsigned int length, int width, int force_ellipses)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
2003-09-09 08:05:43 +00:00
|
|
|
unsigned int i;
|
2002-09-18 23:29:20 +00:00
|
|
|
unsigned int things_printed = 0;
|
|
|
|
int in_quotes = 0;
|
|
|
|
int need_comma = 0;
|
|
|
|
|
|
|
|
/* If the string was not truncated due to `set print elements', and
|
2002-09-19 00:39:38 +00:00
|
|
|
the last byte of it is a null, we don't print that, in
|
|
|
|
traditional C style. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if ((!force_ellipses) && length > 0 && string[length-1] == '\0')
|
|
|
|
length--;
|
|
|
|
|
|
|
|
if (length == 0)
|
|
|
|
{
|
|
|
|
fputs_filtered ("\"\"", stream);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < length && things_printed < print_max; ++i)
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Position of the character we are examining to see whether it
|
|
|
|
is repeated. */
|
2002-09-18 23:29:20 +00:00
|
|
|
unsigned int rep1;
|
|
|
|
/* Number of repetitions we have detected so far. */
|
|
|
|
unsigned int reps;
|
|
|
|
|
|
|
|
QUIT;
|
|
|
|
|
|
|
|
if (need_comma)
|
|
|
|
{
|
|
|
|
fputs_filtered (", ", stream);
|
|
|
|
need_comma = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
rep1 = i + 1;
|
|
|
|
reps = 1;
|
|
|
|
while (rep1 < length && string[rep1] == string[i])
|
|
|
|
{
|
|
|
|
++rep1;
|
|
|
|
++reps;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reps > repeat_count_threshold)
|
|
|
|
{
|
|
|
|
if (in_quotes)
|
|
|
|
{
|
|
|
|
if (inspect_it)
|
|
|
|
fputs_filtered ("\\\", ", stream);
|
|
|
|
else
|
|
|
|
fputs_filtered ("\", ", stream);
|
|
|
|
in_quotes = 0;
|
|
|
|
}
|
|
|
|
objc_printchar (string[i], stream);
|
|
|
|
fprintf_filtered (stream, " <repeats %u times>", reps);
|
|
|
|
i = rep1 - 1;
|
|
|
|
things_printed += repeat_count_threshold;
|
|
|
|
need_comma = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!in_quotes)
|
|
|
|
{
|
|
|
|
if (inspect_it)
|
|
|
|
fputs_filtered ("\\\"", stream);
|
|
|
|
else
|
|
|
|
fputs_filtered ("\"", stream);
|
|
|
|
in_quotes = 1;
|
|
|
|
}
|
|
|
|
objc_emit_char (string[i], stream, '"');
|
|
|
|
++things_printed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Terminate the quotes if necessary. */
|
|
|
|
if (in_quotes)
|
|
|
|
{
|
|
|
|
if (inspect_it)
|
|
|
|
fputs_filtered ("\\\"", stream);
|
|
|
|
else
|
|
|
|
fputs_filtered ("\"", stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (force_ellipses || i < length)
|
|
|
|
fputs_filtered ("...", stream);
|
|
|
|
}
|
|
|
|
|
2003-03-26 03:39:44 +00:00
|
|
|
/* Determine if we are currently in the Objective-C dispatch function.
|
|
|
|
If so, get the address of the method function that the dispatcher
|
|
|
|
would call and use that as the function to step into instead. Also
|
|
|
|
skip over the trampoline for the function (if any). This is better
|
|
|
|
for the user since they are only interested in stepping into the
|
|
|
|
method function anyway. */
|
|
|
|
static CORE_ADDR
|
2007-06-15 22:39:52 +00:00
|
|
|
objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc)
|
2003-03-26 03:39:44 +00:00
|
|
|
{
|
|
|
|
CORE_ADDR real_stop_pc;
|
|
|
|
CORE_ADDR method_stop_pc;
|
|
|
|
|
2007-06-15 22:39:52 +00:00
|
|
|
real_stop_pc = gdbarch_skip_trampoline_code
|
|
|
|
(current_gdbarch, frame, stop_pc);
|
2003-03-26 03:39:44 +00:00
|
|
|
|
|
|
|
if (real_stop_pc != 0)
|
|
|
|
find_objc_msgcall (real_stop_pc, &method_stop_pc);
|
|
|
|
else
|
|
|
|
find_objc_msgcall (stop_pc, &method_stop_pc);
|
|
|
|
|
|
|
|
if (method_stop_pc)
|
|
|
|
{
|
2007-06-09 14:20:24 +00:00
|
|
|
real_stop_pc = gdbarch_skip_trampoline_code
|
2007-06-15 22:39:52 +00:00
|
|
|
(current_gdbarch, frame, method_stop_pc);
|
2003-03-26 03:39:44 +00:00
|
|
|
if (real_stop_pc == 0)
|
|
|
|
real_stop_pc = method_stop_pc;
|
|
|
|
}
|
|
|
|
|
|
|
|
return real_stop_pc;
|
|
|
|
}
|
|
|
|
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
/* Table mapping opcodes into strings for printing operators
|
|
|
|
and precedences of the operators. */
|
|
|
|
|
|
|
|
static const struct op_print objc_op_print_tab[] =
|
|
|
|
{
|
|
|
|
{",", BINOP_COMMA, PREC_COMMA, 0},
|
|
|
|
{"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
|
|
|
{"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
|
|
|
{"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
|
|
|
{"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
|
|
|
|
{"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
|
|
|
|
{"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
|
|
|
|
{"==", BINOP_EQUAL, PREC_EQUAL, 0},
|
|
|
|
{"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
|
|
|
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
|
|
|
{">=", BINOP_GEQ, PREC_ORDER, 0},
|
|
|
|
{">", BINOP_GTR, PREC_ORDER, 0},
|
|
|
|
{"<", BINOP_LESS, PREC_ORDER, 0},
|
|
|
|
{">>", BINOP_RSH, PREC_SHIFT, 0},
|
|
|
|
{"<<", BINOP_LSH, PREC_SHIFT, 0},
|
|
|
|
{"+", BINOP_ADD, PREC_ADD, 0},
|
|
|
|
{"-", BINOP_SUB, PREC_ADD, 0},
|
|
|
|
{"*", BINOP_MUL, PREC_MUL, 0},
|
|
|
|
{"/", BINOP_DIV, PREC_MUL, 0},
|
|
|
|
{"%", BINOP_REM, PREC_MUL, 0},
|
|
|
|
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
|
|
|
|
{"-", UNOP_NEG, PREC_PREFIX, 0},
|
|
|
|
{"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
|
|
|
{"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
|
|
|
|
{"*", UNOP_IND, PREC_PREFIX, 0},
|
|
|
|
{"&", UNOP_ADDR, PREC_PREFIX, 0},
|
|
|
|
{"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
|
|
|
|
{"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
|
|
|
|
{"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
|
2003-05-23 16:02:30 +00:00
|
|
|
{NULL, OP_NULL, PREC_NULL, 0}
|
2002-09-18 23:29:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const struct language_defn objc_language_defn = {
|
2002-09-19 00:39:38 +00:00
|
|
|
"objective-c", /* Language name */
|
2002-09-18 23:29:20 +00:00
|
|
|
language_objc,
|
|
|
|
range_check_off,
|
|
|
|
type_check_off,
|
|
|
|
case_sensitive_on,
|
2004-08-29 10:12:24 +00:00
|
|
|
array_row_major,
|
* parser-defs.h (struct exp_descriptor): New definition, containing
language-specific info for printing, prefixifying, dumping, and
evaluating expressions.
(exp_descriptor_standard): Declare new variable.
(print_subexp): Make global and declare here (from expprint.c).
(dump_subexp): Ditto.
(dump_subexp_body_standard): Declare.
(operator_length_standard): Declare.
(op_name_standard): Declare.
(print_subexp): Declare.
(print_subexp_standard): Declare.
* language.h (struct language_defn): Add la_exp_desc field to hold
pointer to table for language-specific operators.
Remove evaluate_exp field, which is now in struct exp_descriptor.
* parse.c (operator_length): Move most code to new
operator_length_standard function. Use language-specific information.
(operator_length_standard): New function taking most code from
operator_length.
(exp_descriptor_standard): New constant.
* expression.h (enum exp_opcode): Add definitions of OP_EXTENDED0
and OP_EXTENDED_LAST.
* expprint.c (print_subexp): Use language-specific print_subexp.
Make global; remove static declaration.
Move most code to print_subexp_standard.
(print_subexp_standard): New function, containing code formerly in
print_subexp.
(op_name): Add expression to argument signature.
Use langauge-specific op_name.
Move most code to op_name_standard.
(op_name_standard): New function, containing code formerly in op_name.
(dump_subexp): Use new version of op_name function.
Use language-specific dump_subexp_body, and move most existing code to
dump_subexp_body_standard.
(dump_raw_expression): Use new op_name interface.
(dump_subexp_body): Move most code to dump_subexp_body_standard.
(dump_subexp_body_standard): New function, containing code formerly
in dump_subexp_body.
* language.c (unknown_language): Add default la_exp_desc field and
remove evaluate_exp field.
(auto_language): Ditto.
(local_language): Ditto.
* f-lang.c (f_language_defn): Ditto.
* c-lang.c (c_language_defn): Ditto.
(cplus_language_defn): Ditto.
(asm_language_defn): Ditto.
(minimal_language_defn): Ditto.
* p-lang.c (pascal_language_defn): Ditto.
* m2-lang.c (m2_language_defn): Ditto.
* objc-lang.c (objc_language_defn): Ditto.
* jv-lang.c (exp_descriptor_java): New variable, containing
Java-specific expression evaluator.
(java_language_defn): Add la_exp_desc field and remove evaluate_exp
field.
* scm-lang.c (exp_descriptor_scm): New variable, containing
Scheme-specific expression evaluator.
(scm_language_defn): Add la_exp_desc field and remove evaluate_exp
field.
* objc-lang.c (print_object_command): Take evaluate_exp from the
la_exp_desc field.
* Makefile.in (eval.o): Add dependency on parser-defs.h.
* eval.c: Include parser-defs.h for the full declaration of
la_exp_desc's type.
(evaluate_subexp): Get evaluate_exp out of la_exp_desc field.
2003-09-25 08:40:45 +00:00
|
|
|
&exp_descriptor_standard,
|
2002-09-18 23:29:20 +00:00
|
|
|
objc_parse,
|
|
|
|
objc_error,
|
2004-04-10 22:10:01 +00:00
|
|
|
null_post_parser,
|
2002-09-18 23:29:20 +00:00
|
|
|
objc_printchar, /* Print a character constant */
|
|
|
|
objc_printstr, /* Function to print string constant */
|
|
|
|
objc_emit_char,
|
|
|
|
c_print_type, /* Print a type using appropriate syntax */
|
|
|
|
c_val_print, /* Print a value using appropriate syntax */
|
|
|
|
c_value_print, /* Print a top-level value */
|
2003-03-26 03:39:44 +00:00
|
|
|
objc_skip_trampoline, /* Language specific skip_trampoline */
|
2003-05-20 01:55:18 +00:00
|
|
|
value_of_this, /* value_of_this */
|
|
|
|
basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */
|
2004-01-23 23:03:31 +00:00
|
|
|
basic_lookup_transparent_type,/* lookup_transparent_type */
|
2003-04-02 03:02:46 +00:00
|
|
|
objc_demangle, /* Language specific symbol demangler */
|
2004-07-06 19:29:31 +00:00
|
|
|
NULL, /* Language specific class_name_from_physname */
|
2002-09-19 00:39:38 +00:00
|
|
|
objc_op_print_tab, /* Expression operators for printing */
|
|
|
|
1, /* C-style arrays */
|
2002-09-18 23:29:20 +00:00
|
|
|
0, /* String lower bound */
|
2003-10-06 22:38:03 +00:00
|
|
|
default_word_break_characters,
|
2007-06-16 17:23:12 +00:00
|
|
|
c_language_arch_info,
|
2005-10-03 21:21:20 +00:00
|
|
|
default_print_array_index,
|
2007-09-23 16:25:06 +00:00
|
|
|
default_pass_by_reference,
|
2002-09-18 23:29:20 +00:00
|
|
|
LANG_MAGIC
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ObjC:
|
2002-09-19 00:39:38 +00:00
|
|
|
* Following functions help construct Objective-C message calls
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
struct selname /* For parsing Objective-C. */
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
struct selname *next;
|
|
|
|
char *msglist_sel;
|
|
|
|
int msglist_len;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int msglist_len;
|
|
|
|
static struct selname *selname_chain;
|
|
|
|
static char *msglist_sel;
|
|
|
|
|
|
|
|
void
|
|
|
|
start_msglist(void)
|
|
|
|
{
|
2003-09-09 08:05:43 +00:00
|
|
|
struct selname *new =
|
2002-09-18 23:29:20 +00:00
|
|
|
(struct selname *) xmalloc (sizeof (struct selname));
|
|
|
|
|
|
|
|
new->next = selname_chain;
|
|
|
|
new->msglist_len = msglist_len;
|
|
|
|
new->msglist_sel = msglist_sel;
|
|
|
|
msglist_len = 0;
|
|
|
|
msglist_sel = (char *)xmalloc(1);
|
|
|
|
*msglist_sel = 0;
|
|
|
|
selname_chain = new;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
add_msglist(struct stoken *str, int addcolon)
|
|
|
|
{
|
|
|
|
char *s, *p;
|
|
|
|
int len, plen;
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
if (str == 0) { /* Unnamed arg, or... */
|
|
|
|
if (addcolon == 0) { /* variable number of args. */
|
2002-09-18 23:29:20 +00:00
|
|
|
msglist_len++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
p = "";
|
|
|
|
plen = 0;
|
|
|
|
} else {
|
|
|
|
p = str->ptr;
|
|
|
|
plen = str->length;
|
|
|
|
}
|
|
|
|
len = plen + strlen(msglist_sel) + 2;
|
|
|
|
s = (char *)xmalloc(len);
|
|
|
|
strcpy(s, msglist_sel);
|
|
|
|
strncat(s, p, plen);
|
2002-10-04 01:18:48 +00:00
|
|
|
xfree(msglist_sel);
|
2002-09-18 23:29:20 +00:00
|
|
|
msglist_sel = s;
|
|
|
|
if (addcolon) {
|
|
|
|
s[len-2] = ':';
|
|
|
|
s[len-1] = 0;
|
|
|
|
msglist_len++;
|
|
|
|
} else
|
|
|
|
s[len-2] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
end_msglist(void)
|
|
|
|
{
|
2003-09-09 08:05:43 +00:00
|
|
|
int val = msglist_len;
|
|
|
|
struct selname *sel = selname_chain;
|
|
|
|
char *p = msglist_sel;
|
2004-02-18 04:22:35 +00:00
|
|
|
CORE_ADDR selid;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
selname_chain = sel->next;
|
|
|
|
msglist_len = sel->msglist_len;
|
|
|
|
msglist_sel = sel->msglist_sel;
|
|
|
|
selid = lookup_child_selector(p);
|
|
|
|
if (!selid)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("Can't find selector \"%s\""), p);
|
2002-09-18 23:29:20 +00:00
|
|
|
write_exp_elt_longcst (selid);
|
2002-10-04 01:18:48 +00:00
|
|
|
xfree(p);
|
2002-09-19 00:39:38 +00:00
|
|
|
write_exp_elt_longcst (val); /* Number of args */
|
2002-10-04 01:18:48 +00:00
|
|
|
xfree(sel);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: specialcmp (char *a, char *b)
|
|
|
|
*
|
|
|
|
* Special strcmp: treats ']' and ' ' as end-of-string.
|
2002-09-19 00:39:38 +00:00
|
|
|
* Used for qsorting lists of objc methods (either by class or selector).
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
static int
|
|
|
|
specialcmp (char *a, char *b)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
while (*a && *a != ' ' && *a != ']' && *b && *b != ' ' && *b != ']')
|
|
|
|
{
|
|
|
|
if (*a != *b)
|
|
|
|
return *a - *b;
|
|
|
|
a++, b++;
|
|
|
|
}
|
|
|
|
if (*a && *a != ' ' && *a != ']')
|
|
|
|
return 1; /* a is longer therefore greater */
|
|
|
|
if (*b && *b != ' ' && *b != ']')
|
|
|
|
return -1; /* a is shorter therefore lesser */
|
|
|
|
return 0; /* a and b are identical */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2002-12-03 03:52:37 +00:00
|
|
|
* Function: compare_selectors (const void *, const void *)
|
2002-09-18 23:29:20 +00:00
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* Comparison function for use with qsort. Arguments are symbols or
|
|
|
|
* msymbols Compares selector part of objc method name alphabetically.
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
2002-12-03 03:52:37 +00:00
|
|
|
compare_selectors (const void *a, const void *b)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
char *aname, *bname;
|
|
|
|
|
2003-02-20 David Carlton <carlton@math.stanford.edu>
* symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME;
expand comment.
* ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace
SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME.
* ada-typeprint.c (ada_typedef_print): Ditto.
* ax-gdb.c (gen_var_ref): Ditto.
* breakpoint.c (print_one_breakpoint): Ditto.
* buildsym.c (finish_block): Ditto.
* c-valprint.c (c_val_print): Ditto.
* expprint.c (print_subexp): Ditto.
* findvar.c (locate_var_value): Ditto.
* infcmd.c (jump_command): Ditto.
* linespec.c (decode_line_2, decode_compound): Ditto.
* maint.c (maintenance_translate_address): Ditto.
* objc-lang.c (compare_selectors, compare_classes): Ditto.
* printcmd.c (build_address_symbolic, sym_info, print_frame_args):
Ditto.
* p-valprint.c (pascal_val_print): Ditto.
* stabsread.c (define_symbol): Ditto.
* stack.c (print_frame, frame_info, print_block_frame_locals)
(print_frame_arg_vars, return_command): Ditto.
* symfile.c (compare_symbols, compare_psymbols): Ditto.
* symmisc.c (print_symbol): Ditto.
* symtab.c (lookup_partial_symbol, lookup_block_symbol)
(compare_search_syms, print_symbol_info, print_msymbol_info)
(rbreak_command): Ditto.
* tracepoint.c (tracepoints_info): Ditto.
* typeprint.c (typedef_print): Ditto.
* valops.c (value_of_variable, hand_function_call): Ditto.
* cli/cli-cmds.c (edit_command, list_command): Ditto.
* ada-typeprint.c: Update Copyright.
* infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto.
* tracepoint.c, cli/cli-cmds.c: Ditto.
2003-02-20 17:17:25 +00:00
|
|
|
aname = SYMBOL_PRINT_NAME (*(struct symbol **) a);
|
|
|
|
bname = SYMBOL_PRINT_NAME (*(struct symbol **) b);
|
2002-10-04 01:18:48 +00:00
|
|
|
if (aname == NULL || bname == NULL)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("internal: compare_selectors(1)"));
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-10-04 01:18:48 +00:00
|
|
|
aname = strchr(aname, ' ');
|
|
|
|
bname = strchr(bname, ' ');
|
|
|
|
if (aname == NULL || bname == NULL)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("internal: compare_selectors(2)"));
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
return specialcmp (aname+1, bname+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: selectors_info (regexp, from_tty)
|
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* Implements the "Info selectors" command. Takes an optional regexp
|
|
|
|
* arg. Lists all objective c selectors that match the regexp. Works
|
|
|
|
* by grepping thru all symbols for objective c methods. Output list
|
|
|
|
* is sorted and uniqued.
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
selectors_info (char *regexp, int from_tty)
|
|
|
|
{
|
|
|
|
struct objfile *objfile;
|
|
|
|
struct minimal_symbol *msymbol;
|
|
|
|
char *name;
|
|
|
|
char *val;
|
|
|
|
int matches = 0;
|
|
|
|
int maxlen = 0;
|
|
|
|
int ix;
|
|
|
|
char myregexp[2048];
|
|
|
|
char asel[256];
|
|
|
|
struct symbol **sym_arr;
|
|
|
|
int plusminus = 0;
|
|
|
|
|
|
|
|
if (regexp == NULL)
|
2002-09-19 00:39:38 +00:00
|
|
|
strcpy(myregexp, ".*]"); /* Null input, match all objc methods. */
|
2002-09-18 23:29:20 +00:00
|
|
|
else
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
if (*regexp == '+' || *regexp == '-')
|
|
|
|
{ /* User wants only class methods or only instance methods. */
|
2002-09-18 23:29:20 +00:00
|
|
|
plusminus = *regexp++;
|
|
|
|
while (*regexp == ' ' || *regexp == '\t')
|
|
|
|
regexp++;
|
|
|
|
}
|
|
|
|
if (*regexp == '\0')
|
|
|
|
strcpy(myregexp, ".*]");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy(myregexp, regexp);
|
|
|
|
if (myregexp[strlen(myregexp) - 1] == '$') /* end of selector */
|
|
|
|
myregexp[strlen(myregexp) - 1] = ']'; /* end of method name */
|
|
|
|
else
|
|
|
|
strcat(myregexp, ".*]");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (regexp != NULL)
|
2003-04-06 19:25:04 +00:00
|
|
|
{
|
|
|
|
val = re_comp (myregexp);
|
|
|
|
if (val != 0)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("Invalid regexp (%s): %s"), val, regexp);
|
2003-04-06 19:25:04 +00:00
|
|
|
}
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* First time thru is JUST to get max length and count. */
|
2002-09-18 23:29:20 +00:00
|
|
|
ALL_MSYMBOLS (objfile, msymbol)
|
|
|
|
{
|
|
|
|
QUIT;
|
2003-04-04 04:29:15 +00:00
|
|
|
name = SYMBOL_NATURAL_NAME (msymbol);
|
2002-09-18 23:29:20 +00:00
|
|
|
if (name &&
|
|
|
|
(name[0] == '-' || name[0] == '+') &&
|
2002-09-19 00:39:38 +00:00
|
|
|
name[1] == '[') /* Got a method name. */
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Filter for class/instance methods. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (plusminus && name[0] != plusminus)
|
2002-09-19 00:39:38 +00:00
|
|
|
continue;
|
|
|
|
/* Find selector part. */
|
|
|
|
name = (char *) strchr(name+2, ' ');
|
2002-09-18 23:29:20 +00:00
|
|
|
if (regexp == NULL || re_exec(++name) != 0)
|
|
|
|
{
|
|
|
|
char *mystart = name;
|
|
|
|
char *myend = (char *) strchr(mystart, ']');
|
|
|
|
|
|
|
|
if (myend && (myend - mystart > maxlen))
|
2002-09-19 00:39:38 +00:00
|
|
|
maxlen = myend - mystart; /* Get longest selector. */
|
2002-09-18 23:29:20 +00:00
|
|
|
matches++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (matches)
|
|
|
|
{
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 00:39:24 +00:00
|
|
|
printf_filtered (_("Selectors matching \"%s\":\n\n"),
|
2002-09-18 23:29:20 +00:00
|
|
|
regexp ? regexp : "*");
|
|
|
|
|
|
|
|
sym_arr = alloca (matches * sizeof (struct symbol *));
|
|
|
|
matches = 0;
|
|
|
|
ALL_MSYMBOLS (objfile, msymbol)
|
|
|
|
{
|
|
|
|
QUIT;
|
2003-04-04 04:29:15 +00:00
|
|
|
name = SYMBOL_NATURAL_NAME (msymbol);
|
2002-09-18 23:29:20 +00:00
|
|
|
if (name &&
|
|
|
|
(name[0] == '-' || name[0] == '+') &&
|
2002-09-19 00:39:38 +00:00
|
|
|
name[1] == '[') /* Got a method name. */
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Filter for class/instance methods. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (plusminus && name[0] != plusminus)
|
2002-09-19 00:39:38 +00:00
|
|
|
continue;
|
|
|
|
/* Find selector part. */
|
|
|
|
name = (char *) strchr(name+2, ' ');
|
2002-09-18 23:29:20 +00:00
|
|
|
if (regexp == NULL || re_exec(++name) != 0)
|
|
|
|
sym_arr[matches++] = (struct symbol *) msymbol;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qsort (sym_arr, matches, sizeof (struct minimal_symbol *),
|
|
|
|
compare_selectors);
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Prevent compare on first iteration. */
|
|
|
|
asel[0] = 0;
|
|
|
|
for (ix = 0; ix < matches; ix++) /* Now do the output. */
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
char *p = asel;
|
|
|
|
|
|
|
|
QUIT;
|
2003-04-04 04:29:15 +00:00
|
|
|
name = SYMBOL_NATURAL_NAME (sym_arr[ix]);
|
2002-09-18 23:29:20 +00:00
|
|
|
name = strchr (name, ' ') + 1;
|
|
|
|
if (p[0] && specialcmp(name, p) == 0)
|
2002-09-19 00:39:38 +00:00
|
|
|
continue; /* Seen this one already (not unique). */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Copy selector part. */
|
|
|
|
while (*name && *name != ']')
|
2002-09-18 23:29:20 +00:00
|
|
|
*p++ = *name++;
|
|
|
|
*p++ = '\0';
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Print in columns. */
|
|
|
|
puts_filtered_tabular(asel, maxlen + 1, 0);
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
begin_line();
|
|
|
|
}
|
|
|
|
else
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 00:39:24 +00:00
|
|
|
printf_filtered (_("No selectors matching \"%s\"\n"), regexp ? regexp : "*");
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2002-12-03 03:52:37 +00:00
|
|
|
* Function: compare_classes (const void *, const void *)
|
2002-09-18 23:29:20 +00:00
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* Comparison function for use with qsort. Arguments are symbols or
|
|
|
|
* msymbols Compares class part of objc method name alphabetically.
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
2002-12-03 03:52:37 +00:00
|
|
|
compare_classes (const void *a, const void *b)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
char *aname, *bname;
|
|
|
|
|
2003-02-20 David Carlton <carlton@math.stanford.edu>
* symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME;
expand comment.
* ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace
SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME.
* ada-typeprint.c (ada_typedef_print): Ditto.
* ax-gdb.c (gen_var_ref): Ditto.
* breakpoint.c (print_one_breakpoint): Ditto.
* buildsym.c (finish_block): Ditto.
* c-valprint.c (c_val_print): Ditto.
* expprint.c (print_subexp): Ditto.
* findvar.c (locate_var_value): Ditto.
* infcmd.c (jump_command): Ditto.
* linespec.c (decode_line_2, decode_compound): Ditto.
* maint.c (maintenance_translate_address): Ditto.
* objc-lang.c (compare_selectors, compare_classes): Ditto.
* printcmd.c (build_address_symbolic, sym_info, print_frame_args):
Ditto.
* p-valprint.c (pascal_val_print): Ditto.
* stabsread.c (define_symbol): Ditto.
* stack.c (print_frame, frame_info, print_block_frame_locals)
(print_frame_arg_vars, return_command): Ditto.
* symfile.c (compare_symbols, compare_psymbols): Ditto.
* symmisc.c (print_symbol): Ditto.
* symtab.c (lookup_partial_symbol, lookup_block_symbol)
(compare_search_syms, print_symbol_info, print_msymbol_info)
(rbreak_command): Ditto.
* tracepoint.c (tracepoints_info): Ditto.
* typeprint.c (typedef_print): Ditto.
* valops.c (value_of_variable, hand_function_call): Ditto.
* cli/cli-cmds.c (edit_command, list_command): Ditto.
* ada-typeprint.c: Update Copyright.
* infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto.
* tracepoint.c, cli/cli-cmds.c: Ditto.
2003-02-20 17:17:25 +00:00
|
|
|
aname = SYMBOL_PRINT_NAME (*(struct symbol **) a);
|
|
|
|
bname = SYMBOL_PRINT_NAME (*(struct symbol **) b);
|
2002-10-04 01:18:48 +00:00
|
|
|
if (aname == NULL || bname == NULL)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("internal: compare_classes(1)"));
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
return specialcmp (aname+1, bname+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: classes_info(regexp, from_tty)
|
|
|
|
*
|
|
|
|
* Implements the "info classes" command for objective c classes.
|
|
|
|
* Lists all objective c classes that match the optional regexp.
|
2002-09-19 00:39:38 +00:00
|
|
|
* Works by grepping thru the list of objective c methods. List will
|
|
|
|
* be sorted and uniqued (since one class may have many methods).
|
|
|
|
* BUGS: will not list a class that has no methods.
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
classes_info (char *regexp, int from_tty)
|
|
|
|
{
|
|
|
|
struct objfile *objfile;
|
|
|
|
struct minimal_symbol *msymbol;
|
|
|
|
char *name;
|
|
|
|
char *val;
|
|
|
|
int matches = 0;
|
|
|
|
int maxlen = 0;
|
|
|
|
int ix;
|
|
|
|
char myregexp[2048];
|
|
|
|
char aclass[256];
|
|
|
|
struct symbol **sym_arr;
|
|
|
|
|
|
|
|
if (regexp == NULL)
|
2002-09-19 00:39:38 +00:00
|
|
|
strcpy(myregexp, ".* "); /* Null input: match all objc classes. */
|
2002-09-18 23:29:20 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy(myregexp, regexp);
|
|
|
|
if (myregexp[strlen(myregexp) - 1] == '$')
|
2002-09-19 00:39:38 +00:00
|
|
|
/* In the method name, the end of the class name is marked by ' '. */
|
2002-09-18 23:29:20 +00:00
|
|
|
myregexp[strlen(myregexp) - 1] = ' ';
|
|
|
|
else
|
|
|
|
strcat(myregexp, ".* ");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (regexp != NULL)
|
2003-04-06 19:25:04 +00:00
|
|
|
{
|
|
|
|
val = re_comp (myregexp);
|
|
|
|
if (val != 0)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("Invalid regexp (%s): %s"), val, regexp);
|
2003-04-06 19:25:04 +00:00
|
|
|
}
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* First time thru is JUST to get max length and count. */
|
2002-09-18 23:29:20 +00:00
|
|
|
ALL_MSYMBOLS (objfile, msymbol)
|
|
|
|
{
|
|
|
|
QUIT;
|
2003-04-04 04:29:15 +00:00
|
|
|
name = SYMBOL_NATURAL_NAME (msymbol);
|
2002-09-18 23:29:20 +00:00
|
|
|
if (name &&
|
|
|
|
(name[0] == '-' || name[0] == '+') &&
|
2002-09-19 00:39:38 +00:00
|
|
|
name[1] == '[') /* Got a method name. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (regexp == NULL || re_exec(name+2) != 0)
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Compute length of classname part. */
|
|
|
|
char *mystart = name + 2;
|
2002-09-18 23:29:20 +00:00
|
|
|
char *myend = (char *) strchr(mystart, ' ');
|
|
|
|
|
|
|
|
if (myend && (myend - mystart > maxlen))
|
|
|
|
maxlen = myend - mystart;
|
|
|
|
matches++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (matches)
|
|
|
|
{
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 00:39:24 +00:00
|
|
|
printf_filtered (_("Classes matching \"%s\":\n\n"),
|
2002-09-18 23:29:20 +00:00
|
|
|
regexp ? regexp : "*");
|
|
|
|
sym_arr = alloca (matches * sizeof (struct symbol *));
|
|
|
|
matches = 0;
|
|
|
|
ALL_MSYMBOLS (objfile, msymbol)
|
|
|
|
{
|
|
|
|
QUIT;
|
2003-04-04 04:29:15 +00:00
|
|
|
name = SYMBOL_NATURAL_NAME (msymbol);
|
2002-09-18 23:29:20 +00:00
|
|
|
if (name &&
|
|
|
|
(name[0] == '-' || name[0] == '+') &&
|
2002-09-19 00:39:38 +00:00
|
|
|
name[1] == '[') /* Got a method name. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (regexp == NULL || re_exec(name+2) != 0)
|
|
|
|
sym_arr[matches++] = (struct symbol *) msymbol;
|
|
|
|
}
|
|
|
|
|
|
|
|
qsort (sym_arr, matches, sizeof (struct minimal_symbol *),
|
|
|
|
compare_classes);
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Prevent compare on first iteration. */
|
|
|
|
aclass[0] = 0;
|
|
|
|
for (ix = 0; ix < matches; ix++) /* Now do the output. */
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
char *p = aclass;
|
|
|
|
|
|
|
|
QUIT;
|
2003-04-04 04:29:15 +00:00
|
|
|
name = SYMBOL_NATURAL_NAME (sym_arr[ix]);
|
2002-09-18 23:29:20 +00:00
|
|
|
name += 2;
|
|
|
|
if (p[0] && specialcmp(name, p) == 0)
|
2002-09-19 00:39:38 +00:00
|
|
|
continue; /* Seen this one already (not unique). */
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Copy class part of method name. */
|
|
|
|
while (*name && *name != ' ')
|
2002-09-18 23:29:20 +00:00
|
|
|
*p++ = *name++;
|
|
|
|
*p++ = '\0';
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Print in columns. */
|
|
|
|
puts_filtered_tabular(aclass, maxlen + 1, 0);
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
begin_line();
|
|
|
|
}
|
|
|
|
else
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 00:39:24 +00:00
|
|
|
printf_filtered (_("No classes matching \"%s\"\n"), regexp ? regexp : "*");
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: find_imps (char *selector, struct symbol **sym_arr)
|
|
|
|
*
|
|
|
|
* Input: a string representing a selector
|
|
|
|
* a pointer to an array of symbol pointers
|
|
|
|
* possibly a pointer to a symbol found by the caller.
|
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* Output: number of methods that implement that selector. Side
|
|
|
|
* effects: The array of symbol pointers is filled with matching syms.
|
2002-09-18 23:29:20 +00:00
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* By analogy with function "find_methods" (symtab.c), builds a list
|
|
|
|
* of symbols matching the ambiguous input, so that "decode_line_2"
|
|
|
|
* (symtab.c) can list them and ask the user to choose one or more.
|
|
|
|
* In this case the matches are objective c methods
|
|
|
|
* ("implementations") matching an objective c selector.
|
2002-09-18 23:29:20 +00:00
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* Note that it is possible for a normal (c-style) function to have
|
|
|
|
* the same name as an objective c selector. To prevent the selector
|
|
|
|
* from eclipsing the function, we allow the caller (decode_line_1) to
|
|
|
|
* search for such a function first, and if it finds one, pass it in
|
|
|
|
* to us. We will then integrate it into the list. We also search
|
|
|
|
* for one here, among the minsyms.
|
2002-09-18 23:29:20 +00:00
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* NOTE: if NUM_DEBUGGABLE is non-zero, the sym_arr will be divided
|
|
|
|
* into two parts: debuggable (struct symbol) syms, and
|
|
|
|
* non_debuggable (struct minimal_symbol) syms. The debuggable
|
|
|
|
* ones will come first, before NUM_DEBUGGABLE (which will thus
|
|
|
|
* be the index of the first non-debuggable one).
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: total_number_of_imps (char *selector);
|
|
|
|
*
|
|
|
|
* Input: a string representing a selector
|
|
|
|
* Output: number of methods that implement that selector.
|
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* By analogy with function "total_number_of_methods", this allows
|
2002-09-18 23:29:20 +00:00
|
|
|
* decode_line_1 (symtab.c) to detect if there are objective c methods
|
2002-09-19 00:39:38 +00:00
|
|
|
* matching the input, and to allocate an array of pointers to them
|
|
|
|
* which can be manipulated by "decode_line_2" (also in symtab.c).
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
char *
|
|
|
|
parse_selector (char *method, char **selector)
|
|
|
|
{
|
|
|
|
char *s1 = NULL;
|
|
|
|
char *s2 = NULL;
|
|
|
|
int found_quote = 0;
|
|
|
|
|
|
|
|
char *nselector = NULL;
|
|
|
|
|
2003-05-23 16:02:30 +00:00
|
|
|
gdb_assert (selector != NULL);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
s1 = method;
|
|
|
|
|
|
|
|
while (isspace (*s1))
|
|
|
|
s1++;
|
|
|
|
if (*s1 == '\'')
|
|
|
|
{
|
|
|
|
found_quote = 1;
|
|
|
|
s1++;
|
|
|
|
}
|
|
|
|
while (isspace (*s1))
|
|
|
|
s1++;
|
|
|
|
|
|
|
|
nselector = s1;
|
|
|
|
s2 = s1;
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
|
|
|
|
*s1++ = *s2;
|
|
|
|
else if (isspace (*s2))
|
|
|
|
;
|
|
|
|
else if ((*s2 == '\0') || (*s2 == '\''))
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
s2++;
|
|
|
|
}
|
|
|
|
*s1++ = '\0';
|
|
|
|
|
|
|
|
while (isspace (*s2))
|
|
|
|
s2++;
|
|
|
|
if (found_quote)
|
|
|
|
{
|
|
|
|
if (*s2 == '\'')
|
|
|
|
s2++;
|
|
|
|
while (isspace (*s2))
|
|
|
|
s2++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selector != NULL)
|
|
|
|
*selector = nselector;
|
|
|
|
|
|
|
|
return s2;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
2002-09-19 00:39:38 +00:00
|
|
|
parse_method (char *method, char *type, char **class,
|
|
|
|
char **category, char **selector)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
char *s1 = NULL;
|
|
|
|
char *s2 = NULL;
|
|
|
|
int found_quote = 0;
|
|
|
|
|
|
|
|
char ntype = '\0';
|
|
|
|
char *nclass = NULL;
|
|
|
|
char *ncategory = NULL;
|
|
|
|
char *nselector = NULL;
|
|
|
|
|
2003-05-23 16:02:30 +00:00
|
|
|
gdb_assert (type != NULL);
|
|
|
|
gdb_assert (class != NULL);
|
|
|
|
gdb_assert (category != NULL);
|
|
|
|
gdb_assert (selector != NULL);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
s1 = method;
|
|
|
|
|
|
|
|
while (isspace (*s1))
|
|
|
|
s1++;
|
|
|
|
if (*s1 == '\'')
|
|
|
|
{
|
|
|
|
found_quote = 1;
|
|
|
|
s1++;
|
|
|
|
}
|
|
|
|
while (isspace (*s1))
|
|
|
|
s1++;
|
|
|
|
|
|
|
|
if ((s1[0] == '+') || (s1[0] == '-'))
|
|
|
|
ntype = *s1++;
|
|
|
|
|
|
|
|
while (isspace (*s1))
|
|
|
|
s1++;
|
|
|
|
|
|
|
|
if (*s1 != '[')
|
|
|
|
return NULL;
|
|
|
|
s1++;
|
|
|
|
|
|
|
|
nclass = s1;
|
|
|
|
while (isalnum (*s1) || (*s1 == '_'))
|
|
|
|
s1++;
|
|
|
|
|
|
|
|
s2 = s1;
|
|
|
|
while (isspace (*s2))
|
|
|
|
s2++;
|
|
|
|
|
|
|
|
if (*s2 == '(')
|
|
|
|
{
|
|
|
|
s2++;
|
|
|
|
while (isspace (*s2))
|
|
|
|
s2++;
|
|
|
|
ncategory = s2;
|
|
|
|
while (isalnum (*s2) || (*s2 == '_'))
|
|
|
|
s2++;
|
|
|
|
*s2++ = '\0';
|
|
|
|
}
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Truncate the class name now that we're not using the open paren. */
|
2002-09-18 23:29:20 +00:00
|
|
|
*s1++ = '\0';
|
|
|
|
|
|
|
|
nselector = s2;
|
|
|
|
s1 = s2;
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
|
|
|
|
*s1++ = *s2;
|
|
|
|
else if (isspace (*s2))
|
|
|
|
;
|
|
|
|
else if (*s2 == ']')
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
s2++;
|
|
|
|
}
|
|
|
|
*s1++ = '\0';
|
|
|
|
s2++;
|
|
|
|
|
|
|
|
while (isspace (*s2))
|
|
|
|
s2++;
|
|
|
|
if (found_quote)
|
|
|
|
{
|
|
|
|
if (*s2 != '\'')
|
|
|
|
return NULL;
|
|
|
|
s2++;
|
|
|
|
while (isspace (*s2))
|
|
|
|
s2++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type != NULL)
|
|
|
|
*type = ntype;
|
|
|
|
if (class != NULL)
|
|
|
|
*class = nclass;
|
|
|
|
if (category != NULL)
|
|
|
|
*category = ncategory;
|
|
|
|
if (selector != NULL)
|
|
|
|
*selector = nselector;
|
|
|
|
|
|
|
|
return s2;
|
|
|
|
}
|
|
|
|
|
2003-02-21 02:43:01 +00:00
|
|
|
static void
|
2002-09-19 00:39:38 +00:00
|
|
|
find_methods (struct symtab *symtab, char type,
|
|
|
|
const char *class, const char *category,
|
|
|
|
const char *selector, struct symbol **syms,
|
|
|
|
unsigned int *nsym, unsigned int *ndebug)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
struct objfile *objfile = NULL;
|
|
|
|
struct minimal_symbol *msymbol = NULL;
|
|
|
|
struct block *block = NULL;
|
|
|
|
struct symbol *sym = NULL;
|
|
|
|
|
|
|
|
char *symname = NULL;
|
|
|
|
|
|
|
|
char ntype = '\0';
|
|
|
|
char *nclass = NULL;
|
|
|
|
char *ncategory = NULL;
|
|
|
|
char *nselector = NULL;
|
|
|
|
|
|
|
|
unsigned int csym = 0;
|
|
|
|
unsigned int cdebug = 0;
|
|
|
|
|
|
|
|
static char *tmp = NULL;
|
|
|
|
static unsigned int tmplen = 0;
|
|
|
|
|
2003-05-23 16:02:30 +00:00
|
|
|
gdb_assert (nsym != NULL);
|
|
|
|
gdb_assert (ndebug != NULL);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
if (symtab)
|
|
|
|
block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
|
|
|
|
|
|
|
|
ALL_MSYMBOLS (objfile, msymbol)
|
|
|
|
{
|
|
|
|
QUIT;
|
|
|
|
|
|
|
|
if ((msymbol->type != mst_text) && (msymbol->type != mst_file_text))
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Not a function or method. */
|
2002-09-18 23:29:20 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if (symtab)
|
2002-10-23 23:37:33 +00:00
|
|
|
if ((SYMBOL_VALUE_ADDRESS (msymbol) < BLOCK_START (block)) ||
|
|
|
|
(SYMBOL_VALUE_ADDRESS (msymbol) >= BLOCK_END (block)))
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Not in the specified symtab. */
|
2002-09-18 23:29:20 +00:00
|
|
|
continue;
|
|
|
|
|
2003-04-04 04:29:15 +00:00
|
|
|
symname = SYMBOL_NATURAL_NAME (msymbol);
|
2002-09-18 23:29:20 +00:00
|
|
|
if (symname == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((symname[0] != '-' && symname[0] != '+') || (symname[1] != '['))
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Not a method name. */
|
2002-09-18 23:29:20 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
while ((strlen (symname) + 1) >= tmplen)
|
|
|
|
{
|
|
|
|
tmplen = (tmplen == 0) ? 1024 : tmplen * 2;
|
|
|
|
tmp = xrealloc (tmp, tmplen);
|
|
|
|
}
|
|
|
|
strcpy (tmp, symname);
|
|
|
|
|
|
|
|
if (parse_method (tmp, &ntype, &nclass, &ncategory, &nselector) == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((type != '\0') && (ntype != type))
|
|
|
|
continue;
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
if ((class != NULL)
|
|
|
|
&& ((nclass == NULL) || (strcmp (class, nclass) != 0)))
|
2002-09-18 23:29:20 +00:00
|
|
|
continue;
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
if ((category != NULL) &&
|
|
|
|
((ncategory == NULL) || (strcmp (category, ncategory) != 0)))
|
2002-09-18 23:29:20 +00:00
|
|
|
continue;
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
if ((selector != NULL) &&
|
|
|
|
((nselector == NULL) || (strcmp (selector, nselector) != 0)))
|
2002-09-18 23:29:20 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
sym = find_pc_function (SYMBOL_VALUE_ADDRESS (msymbol));
|
|
|
|
if (sym != NULL)
|
|
|
|
{
|
2003-04-04 04:29:15 +00:00
|
|
|
const char *newsymname = SYMBOL_NATURAL_NAME (sym);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
if (strcmp (symname, newsymname) == 0)
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Found a high-level method sym: swap it into the
|
|
|
|
lower part of sym_arr (below num_debuggable). */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (syms != NULL)
|
|
|
|
{
|
|
|
|
syms[csym] = syms[cdebug];
|
|
|
|
syms[cdebug] = sym;
|
|
|
|
}
|
|
|
|
csym++;
|
|
|
|
cdebug++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
warning (
|
|
|
|
"debugging symbol \"%s\" does not match minimal symbol (\"%s\"); ignoring",
|
2002-09-18 23:29:20 +00:00
|
|
|
newsymname, symname);
|
|
|
|
if (syms != NULL)
|
|
|
|
syms[csym] = (struct symbol *) msymbol;
|
|
|
|
csym++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Found a non-debuggable method symbol. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (syms != NULL)
|
|
|
|
syms[csym] = (struct symbol *) msymbol;
|
|
|
|
csym++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nsym != NULL)
|
|
|
|
*nsym = csym;
|
|
|
|
if (ndebug != NULL)
|
|
|
|
*ndebug = cdebug;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *find_imps (struct symtab *symtab, struct block *block,
|
2002-09-19 00:39:38 +00:00
|
|
|
char *method, struct symbol **syms,
|
|
|
|
unsigned int *nsym, unsigned int *ndebug)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
char type = '\0';
|
|
|
|
char *class = NULL;
|
|
|
|
char *category = NULL;
|
|
|
|
char *selector = NULL;
|
|
|
|
|
|
|
|
unsigned int csym = 0;
|
|
|
|
unsigned int cdebug = 0;
|
|
|
|
|
|
|
|
unsigned int ncsym = 0;
|
|
|
|
unsigned int ncdebug = 0;
|
|
|
|
|
|
|
|
char *buf = NULL;
|
|
|
|
char *tmp = NULL;
|
|
|
|
|
2003-05-23 16:02:30 +00:00
|
|
|
gdb_assert (nsym != NULL);
|
|
|
|
gdb_assert (ndebug != NULL);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
if (nsym != NULL)
|
|
|
|
*nsym = 0;
|
|
|
|
if (ndebug != NULL)
|
|
|
|
*ndebug = 0;
|
|
|
|
|
|
|
|
buf = (char *) alloca (strlen (method) + 1);
|
|
|
|
strcpy (buf, method);
|
|
|
|
tmp = parse_method (buf, &type, &class, &category, &selector);
|
|
|
|
|
|
|
|
if (tmp == NULL) {
|
|
|
|
|
|
|
|
struct symbol *sym = NULL;
|
|
|
|
struct minimal_symbol *msym = NULL;
|
|
|
|
|
|
|
|
strcpy (buf, method);
|
|
|
|
tmp = parse_selector (buf, &selector);
|
|
|
|
|
|
|
|
if (tmp == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2003-06-02 18:08:16 +00:00
|
|
|
sym = lookup_symbol (selector, block, VAR_DOMAIN, 0, NULL);
|
2002-09-18 23:29:20 +00:00
|
|
|
if (sym != NULL)
|
|
|
|
{
|
|
|
|
if (syms)
|
|
|
|
syms[csym] = sym;
|
|
|
|
csym++;
|
|
|
|
cdebug++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sym == NULL)
|
|
|
|
msym = lookup_minimal_symbol (selector, 0, 0);
|
|
|
|
|
|
|
|
if (msym != NULL)
|
|
|
|
{
|
|
|
|
if (syms)
|
2002-12-03 03:52:37 +00:00
|
|
|
syms[csym] = (struct symbol *)msym;
|
2002-09-18 23:29:20 +00:00
|
|
|
csym++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (syms != NULL)
|
2002-09-19 00:39:38 +00:00
|
|
|
find_methods (symtab, type, class, category, selector,
|
|
|
|
syms + csym, &ncsym, &ncdebug);
|
2002-09-18 23:29:20 +00:00
|
|
|
else
|
2002-09-19 00:39:38 +00:00
|
|
|
find_methods (symtab, type, class, category, selector,
|
|
|
|
NULL, &ncsym, &ncdebug);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* If we didn't find any methods, just return. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (ncsym == 0 && ncdebug == 0)
|
|
|
|
return method;
|
|
|
|
|
|
|
|
/* Take debug symbols from the second batch of symbols and swap them
|
|
|
|
* with debug symbols from the first batch. Repeat until either the
|
|
|
|
* second section is out of debug symbols or the first section is
|
|
|
|
* full of debug symbols. Either way we have all debug symbols
|
2002-09-19 00:39:38 +00:00
|
|
|
* packed to the beginning of the buffer.
|
|
|
|
*/
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
if (syms != NULL)
|
|
|
|
{
|
|
|
|
while ((cdebug < csym) && (ncdebug > 0))
|
|
|
|
{
|
|
|
|
struct symbol *s = NULL;
|
2002-09-19 00:39:38 +00:00
|
|
|
/* First non-debugging symbol. */
|
|
|
|
unsigned int i = cdebug;
|
|
|
|
/* Last of second batch of debug symbols. */
|
|
|
|
unsigned int j = csym + ncdebug - 1;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
s = syms[j];
|
|
|
|
syms[j] = syms[i];
|
|
|
|
syms[i] = s;
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* We've moved a symbol from the second debug section to the
|
|
|
|
first one. */
|
2002-09-18 23:29:20 +00:00
|
|
|
cdebug++;
|
|
|
|
ncdebug--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
csym += ncsym;
|
|
|
|
cdebug += ncdebug;
|
|
|
|
|
|
|
|
if (nsym != NULL)
|
|
|
|
*nsym = csym;
|
|
|
|
if (ndebug != NULL)
|
|
|
|
*ndebug = cdebug;
|
|
|
|
|
|
|
|
if (syms == NULL)
|
|
|
|
return method + (tmp - buf);
|
|
|
|
|
|
|
|
if (csym > 1)
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Sort debuggable symbols. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if (cdebug > 1)
|
2002-09-19 00:39:38 +00:00
|
|
|
qsort (syms, cdebug, sizeof (struct minimal_symbol *),
|
|
|
|
compare_classes);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Sort minimal_symbols. */
|
2002-09-18 23:29:20 +00:00
|
|
|
if ((csym - cdebug) > 1)
|
2002-09-19 00:39:38 +00:00
|
|
|
qsort (&syms[cdebug], csym - cdebug,
|
|
|
|
sizeof (struct minimal_symbol *), compare_classes);
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Terminate the sym_arr list. */
|
|
|
|
syms[csym] = 0;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
return method + (tmp - buf);
|
|
|
|
}
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
static void
|
2002-09-18 23:29:20 +00:00
|
|
|
print_object_command (char *args, int from_tty)
|
|
|
|
{
|
|
|
|
struct value *object, *function, *description;
|
2002-12-03 03:52:37 +00:00
|
|
|
CORE_ADDR string_addr, object_addr;
|
2002-09-18 23:29:20 +00:00
|
|
|
int i = 0;
|
2005-07-12 12:11:44 +00:00
|
|
|
gdb_byte c = 0;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
if (!args || !*args)
|
2002-09-19 00:39:38 +00:00
|
|
|
error (
|
|
|
|
"The 'print-object' command requires an argument (an Objective-C object)");
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
struct expression *expr = parse_expression (args);
|
2003-09-09 08:05:43 +00:00
|
|
|
struct cleanup *old_chain =
|
2002-09-19 00:39:38 +00:00
|
|
|
make_cleanup (free_current_contents, &expr);
|
2002-09-18 23:29:20 +00:00
|
|
|
int pc = 0;
|
|
|
|
|
* parser-defs.h (struct exp_descriptor): New definition, containing
language-specific info for printing, prefixifying, dumping, and
evaluating expressions.
(exp_descriptor_standard): Declare new variable.
(print_subexp): Make global and declare here (from expprint.c).
(dump_subexp): Ditto.
(dump_subexp_body_standard): Declare.
(operator_length_standard): Declare.
(op_name_standard): Declare.
(print_subexp): Declare.
(print_subexp_standard): Declare.
* language.h (struct language_defn): Add la_exp_desc field to hold
pointer to table for language-specific operators.
Remove evaluate_exp field, which is now in struct exp_descriptor.
* parse.c (operator_length): Move most code to new
operator_length_standard function. Use language-specific information.
(operator_length_standard): New function taking most code from
operator_length.
(exp_descriptor_standard): New constant.
* expression.h (enum exp_opcode): Add definitions of OP_EXTENDED0
and OP_EXTENDED_LAST.
* expprint.c (print_subexp): Use language-specific print_subexp.
Make global; remove static declaration.
Move most code to print_subexp_standard.
(print_subexp_standard): New function, containing code formerly in
print_subexp.
(op_name): Add expression to argument signature.
Use langauge-specific op_name.
Move most code to op_name_standard.
(op_name_standard): New function, containing code formerly in op_name.
(dump_subexp): Use new version of op_name function.
Use language-specific dump_subexp_body, and move most existing code to
dump_subexp_body_standard.
(dump_raw_expression): Use new op_name interface.
(dump_subexp_body): Move most code to dump_subexp_body_standard.
(dump_subexp_body_standard): New function, containing code formerly
in dump_subexp_body.
* language.c (unknown_language): Add default la_exp_desc field and
remove evaluate_exp field.
(auto_language): Ditto.
(local_language): Ditto.
* f-lang.c (f_language_defn): Ditto.
* c-lang.c (c_language_defn): Ditto.
(cplus_language_defn): Ditto.
(asm_language_defn): Ditto.
(minimal_language_defn): Ditto.
* p-lang.c (pascal_language_defn): Ditto.
* m2-lang.c (m2_language_defn): Ditto.
* objc-lang.c (objc_language_defn): Ditto.
* jv-lang.c (exp_descriptor_java): New variable, containing
Java-specific expression evaluator.
(java_language_defn): Add la_exp_desc field and remove evaluate_exp
field.
* scm-lang.c (exp_descriptor_scm): New variable, containing
Scheme-specific expression evaluator.
(scm_language_defn): Add la_exp_desc field and remove evaluate_exp
field.
* objc-lang.c (print_object_command): Take evaluate_exp from the
la_exp_desc field.
* Makefile.in (eval.o): Add dependency on parser-defs.h.
* eval.c: Include parser-defs.h for the full declaration of
la_exp_desc's type.
(evaluate_subexp): Get evaluate_exp out of la_exp_desc field.
2003-09-25 08:40:45 +00:00
|
|
|
object = expr->language_defn->la_exp_desc->evaluate_exp
|
|
|
|
(builtin_type_void_data_ptr, expr, &pc, EVAL_NORMAL);
|
2002-09-18 23:29:20 +00:00
|
|
|
do_cleanups (old_chain);
|
|
|
|
}
|
|
|
|
|
2002-12-03 03:52:37 +00:00
|
|
|
/* Validate the address for sanity. */
|
|
|
|
object_addr = value_as_long (object);
|
|
|
|
read_memory (object_addr, &c, 1);
|
|
|
|
|
2002-10-04 01:18:48 +00:00
|
|
|
function = find_function_in_inferior ("_NSPrintForDebugger");
|
2002-12-03 03:52:37 +00:00
|
|
|
if (function == NULL)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("Unable to locate _NSPrintForDebugger in child process"));
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
description = call_function_by_hand (function, 1, &object);
|
|
|
|
|
2002-10-04 01:18:48 +00:00
|
|
|
string_addr = value_as_long (description);
|
|
|
|
if (string_addr == 0)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
|
|
|
error (_("object returns null description"));
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
read_memory (string_addr + i++, &c, 1);
|
2005-07-12 12:11:44 +00:00
|
|
|
if (c != 0)
|
2002-09-18 23:29:20 +00:00
|
|
|
do
|
2002-09-19 00:39:38 +00:00
|
|
|
{ /* Read and print characters up to EOS. */
|
2002-09-18 23:29:20 +00:00
|
|
|
QUIT;
|
|
|
|
printf_filtered ("%c", c);
|
|
|
|
read_memory (string_addr + i++, &c, 1);
|
|
|
|
} while (c != 0);
|
|
|
|
else
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up some of printf_filtered and printf_unfiltered.
* ada-lang.c, annotate.c, arch-utils.c, breakpoint.c: Update.
* corelow.c, cp-namespace.c, cp-support.c, dcache.c: Update.
* demangle.c, dsrec.c, dwarf2read.c, dwarfread.c: Update.
* event-loop.c, event-top.c, exec.c, f-valprint.c: Update.
* gdbtypes.c, inf-loop.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcmd.c, inflow.c, infrun.c, inftarg.c, language.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, maint.c: Update.
* mdebugread.c, memattr.c, monitor.c, objc-lang.c: Update.
* ocd.c, osabi.c, printcmd.c, procfs.c, regcache.c: Update.
* remote.c, solib-som.c, solib.c, somsolib.c, source.c: Update.
* stack.c, symfile.c, symmisc.c, target.c, thread.c: Update.
* top.c, utils.c, valprint.c, value.c, cli/cli-cmds.c: Update.
* cli/cli-dump.c, cli/cli-logging.c, tui/tui-hooks.c: Update.
* tui/tui-regs.c, tui/tui-win.c: Update.
2005-02-12 00:39:24 +00:00
|
|
|
printf_filtered(_("<object returns empty description>"));
|
2002-09-18 23:29:20 +00:00
|
|
|
printf_filtered ("\n");
|
|
|
|
}
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* The data structure 'methcalls' is used to detect method calls (thru
|
|
|
|
* ObjC runtime lib functions objc_msgSend, objc_msgSendSuper, etc.),
|
|
|
|
* and ultimately find the method being called.
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct objc_methcall {
|
|
|
|
char *name;
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Return instance method to be called. */
|
2002-12-03 03:52:37 +00:00
|
|
|
int (*stop_at) (CORE_ADDR, CORE_ADDR *);
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Start of pc range corresponding to method invocation. */
|
|
|
|
CORE_ADDR begin;
|
|
|
|
/* End of pc range corresponding to method invocation. */
|
|
|
|
CORE_ADDR end;
|
2002-09-18 23:29:20 +00:00
|
|
|
};
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
static int resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc);
|
|
|
|
static int resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc);
|
|
|
|
static int resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc);
|
|
|
|
static int resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
static struct objc_methcall methcalls[] = {
|
|
|
|
{ "_objc_msgSend", resolve_msgsend, 0, 0},
|
|
|
|
{ "_objc_msgSend_stret", resolve_msgsend_stret, 0, 0},
|
|
|
|
{ "_objc_msgSendSuper", resolve_msgsend_super, 0, 0},
|
|
|
|
{ "_objc_msgSendSuper_stret", resolve_msgsend_super_stret, 0, 0},
|
|
|
|
{ "_objc_getClass", NULL, 0, 0},
|
|
|
|
{ "_objc_getMetaClass", NULL, 0, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define nmethcalls (sizeof (methcalls) / sizeof (methcalls[0]))
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* The following function, "find_objc_msgsend", fills in the data
|
|
|
|
* structure "objc_msgs" by finding the addresses of each of the
|
|
|
|
* (currently four) functions that it holds (of which objc_msgSend is
|
|
|
|
* the first). This must be called each time symbols are loaded, in
|
|
|
|
* case the functions have moved for some reason.
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
static void
|
2002-09-18 23:29:20 +00:00
|
|
|
find_objc_msgsend (void)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < nmethcalls; i++) {
|
|
|
|
|
|
|
|
struct minimal_symbol *func;
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
/* Try both with and without underscore. */
|
2002-09-18 23:29:20 +00:00
|
|
|
func = lookup_minimal_symbol (methcalls[i].name, NULL, NULL);
|
|
|
|
if ((func == NULL) && (methcalls[i].name[0] == '_')) {
|
|
|
|
func = lookup_minimal_symbol (methcalls[i].name + 1, NULL, NULL);
|
|
|
|
}
|
|
|
|
if (func == NULL) {
|
|
|
|
methcalls[i].begin = 0;
|
|
|
|
methcalls[i].end = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
methcalls[i].begin = SYMBOL_VALUE_ADDRESS (func);
|
|
|
|
do {
|
|
|
|
methcalls[i].end = SYMBOL_VALUE_ADDRESS (++func);
|
|
|
|
} while (methcalls[i].begin == methcalls[i].end);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find_objc_msgcall (replaces pc_off_limits)
|
|
|
|
*
|
2002-09-19 00:39:38 +00:00
|
|
|
* ALL that this function now does is to determine whether the input
|
|
|
|
* address ("pc") is the address of one of the Objective-C message
|
2002-09-18 23:29:20 +00:00
|
|
|
* dispatch functions (mainly objc_msgSend or objc_msgSendSuper), and
|
|
|
|
* if so, it returns the address of the method that will be called.
|
|
|
|
*
|
|
|
|
* The old function "pc_off_limits" used to do a lot of other things
|
2002-09-19 00:39:38 +00:00
|
|
|
* in addition, such as detecting shared library jump stubs and
|
2002-09-18 23:29:20 +00:00
|
|
|
* returning the address of the shlib function that would be called.
|
2007-06-09 14:20:24 +00:00
|
|
|
* That functionality has been moved into the gdbarch_skip_trampoline_code and
|
2002-09-19 00:39:38 +00:00
|
|
|
* IN_SOLIB_TRAMPOLINE macros, which are resolved in the target-
|
|
|
|
* dependent modules.
|
2002-09-18 23:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct objc_submethod_helper_data {
|
2002-12-03 03:52:37 +00:00
|
|
|
int (*f) (CORE_ADDR, CORE_ADDR *);
|
2002-09-18 23:29:20 +00:00
|
|
|
CORE_ADDR pc;
|
|
|
|
CORE_ADDR *new_pc;
|
|
|
|
};
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
static int
|
2002-10-04 01:18:48 +00:00
|
|
|
find_objc_msgcall_submethod_helper (void * arg)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
struct objc_submethod_helper_data *s =
|
|
|
|
(struct objc_submethod_helper_data *) arg;
|
|
|
|
|
|
|
|
if (s->f (s->pc, s->new_pc) == 0)
|
2002-09-18 23:29:20 +00:00
|
|
|
return 1;
|
2002-09-19 00:39:38 +00:00
|
|
|
else
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
static int
|
2002-12-03 03:52:37 +00:00
|
|
|
find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *),
|
2002-09-19 00:39:38 +00:00
|
|
|
CORE_ADDR pc,
|
|
|
|
CORE_ADDR *new_pc)
|
2002-09-18 23:29:20 +00:00
|
|
|
{
|
|
|
|
struct objc_submethod_helper_data s;
|
|
|
|
|
|
|
|
s.f = f;
|
|
|
|
s.pc = pc;
|
|
|
|
s.new_pc = new_pc;
|
|
|
|
|
|
|
|
if (catch_errors (find_objc_msgcall_submethod_helper,
|
2002-10-04 01:18:48 +00:00
|
|
|
(void *) &s,
|
2002-09-19 00:39:38 +00:00
|
|
|
"Unable to determine target of Objective-C method call (ignoring):\n",
|
|
|
|
RETURN_MASK_ALL) == 0)
|
2002-09-18 23:29:20 +00:00
|
|
|
return 1;
|
2002-09-19 00:39:38 +00:00
|
|
|
else
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
find_objc_msgsend ();
|
2003-04-06 19:25:04 +00:00
|
|
|
if (new_pc != NULL)
|
|
|
|
{
|
|
|
|
*new_pc = 0;
|
|
|
|
}
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
for (i = 0; i < nmethcalls; i++)
|
|
|
|
if ((pc >= methcalls[i].begin) && (pc < methcalls[i].end))
|
|
|
|
{
|
|
|
|
if (methcalls[i].stop_at != NULL)
|
|
|
|
return find_objc_msgcall_submethod (methcalls[i].stop_at,
|
|
|
|
pc, new_pc);
|
|
|
|
else
|
|
|
|
return 0;
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
2002-09-19 00:39:38 +00:00
|
|
|
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-06-11 13:16:30 +00:00
|
|
|
extern initialize_file_ftype _initialize_objc_language; /* -Wmissing-prototypes */
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
|
2002-09-18 23:29:20 +00:00
|
|
|
void
|
|
|
|
_initialize_objc_language (void)
|
|
|
|
{
|
|
|
|
add_language (&objc_language_defn);
|
2002-09-19 00:39:38 +00:00
|
|
|
add_info ("selectors", selectors_info, /* INFO SELECTORS command. */
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 15:49:28 +00:00
|
|
|
_("All Objective-C selectors, or those matching REGEXP."));
|
2002-09-19 00:39:38 +00:00
|
|
|
add_info ("classes", classes_info, /* INFO CLASSES command. */
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 15:49:28 +00:00
|
|
|
_("All Objective-C classes, or those matching REGEXP."));
|
2002-09-18 23:29:20 +00:00
|
|
|
add_com ("print-object", class_vars, print_object_command,
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 15:49:28 +00:00
|
|
|
_("Ask an Objective-C object to print itself."));
|
2002-09-18 23:29:20 +00:00
|
|
|
add_com_alias ("po", "print-object", class_vars, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
read_objc_method (CORE_ADDR addr, struct objc_method *method)
|
|
|
|
{
|
2002-09-19 00:39:38 +00:00
|
|
|
method->name = read_memory_unsigned_integer (addr + 0, 4);
|
2002-09-18 23:29:20 +00:00
|
|
|
method->types = read_memory_unsigned_integer (addr + 4, 4);
|
2002-09-19 00:39:38 +00:00
|
|
|
method->imp = read_memory_unsigned_integer (addr + 8, 4);
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
unsigned long read_objc_methlist_nmethods (CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
return read_memory_unsigned_integer (addr + 4, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
read_objc_methlist_method (CORE_ADDR addr, unsigned long num,
|
|
|
|
struct objc_method *method)
|
|
|
|
{
|
2003-05-23 16:02:30 +00:00
|
|
|
gdb_assert (num < read_objc_methlist_nmethods (addr));
|
2002-09-18 23:29:20 +00:00
|
|
|
read_objc_method (addr + 8 + (12 * num), method);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
read_objc_object (CORE_ADDR addr, struct objc_object *object)
|
|
|
|
{
|
|
|
|
object->isa = read_memory_unsigned_integer (addr, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
read_objc_super (CORE_ADDR addr, struct objc_super *super)
|
|
|
|
{
|
|
|
|
super->receiver = read_memory_unsigned_integer (addr, 4);
|
|
|
|
super->class = read_memory_unsigned_integer (addr + 4, 4);
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
read_objc_class (CORE_ADDR addr, struct objc_class *class)
|
|
|
|
{
|
|
|
|
class->isa = read_memory_unsigned_integer (addr, 4);
|
|
|
|
class->super_class = read_memory_unsigned_integer (addr + 4, 4);
|
|
|
|
class->name = read_memory_unsigned_integer (addr + 8, 4);
|
|
|
|
class->version = read_memory_unsigned_integer (addr + 12, 4);
|
|
|
|
class->info = read_memory_unsigned_integer (addr + 16, 4);
|
|
|
|
class->instance_size = read_memory_unsigned_integer (addr + 18, 4);
|
|
|
|
class->ivars = read_memory_unsigned_integer (addr + 24, 4);
|
|
|
|
class->methods = read_memory_unsigned_integer (addr + 28, 4);
|
|
|
|
class->cache = read_memory_unsigned_integer (addr + 32, 4);
|
|
|
|
class->protocols = read_memory_unsigned_integer (addr + 36, 4);
|
|
|
|
}
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
static CORE_ADDR
|
2002-09-18 23:29:20 +00:00
|
|
|
find_implementation_from_class (CORE_ADDR class, CORE_ADDR sel)
|
|
|
|
{
|
|
|
|
CORE_ADDR subclass = class;
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
while (subclass != 0)
|
|
|
|
{
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
struct objc_class class_str;
|
|
|
|
unsigned mlistnum = 0;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
read_objc_class (subclass, &class_str);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
CORE_ADDR mlist;
|
|
|
|
unsigned long nmethods;
|
|
|
|
unsigned long i;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
mlist = read_memory_unsigned_integer (class_str.methods +
|
|
|
|
(4 * mlistnum), 4);
|
|
|
|
if (mlist == 0)
|
|
|
|
break;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
nmethods = read_objc_methlist_nmethods (mlist);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
for (i = 0; i < nmethods; i++)
|
|
|
|
{
|
|
|
|
struct objc_method meth_str;
|
|
|
|
read_objc_methlist_method (mlist, i, &meth_str);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
#if 0
|
2002-09-19 00:39:38 +00:00
|
|
|
fprintf (stderr,
|
|
|
|
"checking method 0x%lx against selector 0x%lx\n",
|
|
|
|
meth_str.name, sel);
|
2002-09-18 23:29:20 +00:00
|
|
|
#endif
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
if (meth_str.name == sel)
|
2003-05-30 02:45:21 +00:00
|
|
|
/* FIXME: hppa arch was doing a pointer dereference
|
|
|
|
here. There needs to be a better way to do that. */
|
|
|
|
return meth_str.imp;
|
2002-09-19 00:39:38 +00:00
|
|
|
}
|
|
|
|
mlistnum++;
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
2002-09-19 00:39:38 +00:00
|
|
|
subclass = class_str.super_class;
|
2002-09-18 23:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-06-08 Andrew Cagney <cagney@redhat.com>
* acinclude.m4 (gcc_AC_CHECK_DECL, (gcc_AC_CHECK_DECL): Stolen
from GCC's acinclude.m4.
* configure.in: Check for getopt's delcaration.
* aclocal.m4, config.in, configure: Re-generate.
* main.c (error_init): Delete declaration.
* defs.h (error_init): Declare.
* rs6000-tdep.c (rs6000_fetch_pointer_argument): Make static.
(rs6000_convert_from_func_ptr_addr): Make static.
(_initialize_rs6000_tdep): Add declaration.
* cli/cli-cmds.c (dont_repeat): Delete declaration.
(show_commands, set_verbose, show_history): Delete declaration.
* top.h (set_verbose): Add declaration.
(show_history, set_history, show_commands): Add declaration.
(do_restore_instream_cleanup): Add declaration.
* objc-lang.c (specialcmp): Make static.
(print_object_command): Make static.
(find_objc_msgsend): Make static.
(find_objc_msgcall_submethod_helper): Make static.
(find_objc_msgcall_submethod): Make static.
(_initialize_objc_language): Add declaration.
(find_implementation_from_class): Make static.
(find_implementation): Make static.
* objc-exp.y (yylex): Delete lookup_struct_typedef declaration.
* objc-lang.h (lookup_struct_typedef): Add declaration.
* cli/cli-interp.c (_initialize_cli_interp): Add declaration.
* cli/cli-script.c (clear_hook_in_cleanup): Make static.
(do_restore_user_call_depth): Make static.
(do_restore_instream_cleanup): Delete declaration.
(dont_repeat): Delete declaration.
* cli/cli-decode.c (add_abbrev_cmd): Delete function.
* cli/cli-dump.c (_initialize_cli_dump): Add declaration.
* reggroups.c (_initialize_reggroup): Add declaration.
* cp-support.c (_initialize_cp_support): Add declaration.
* cp-abi.c (_initialize_cp_abi): Add declaration.
* hpacc-abi.c (_initialize_hpacc_abi): Add declaration.
* gnu-v3-abi.c (gnuv3_baseclass_offset): Make static.
(_initialize_gnu_v3_abi): Add declaration.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Make static.
(_initialize_gnu_v2_abi): Add declaration.
* frame-base.c (_initialize_frame_base): Add declaration.
* doublest.c (floatformat_from_length): Make static.
* frame-unwind.c (_initialize_frame_unwind): Add declaration.
* frame.c (create_sentinel_frame): Make static.
(_initialize_frame): Add declaration.
* top.c (do_catch_errors): Make static.
(gdb_rl_operate_and_get_next_completion): Make static.
* typeprint.c: Include "typeprint.h".
* sentinel-frame.c (sentinel_frame_prev_register): Make static.
(sentinel_frame_this_id): Make static.
* p-valprint.c (_initialize_pascal_valprint): Add declaration.
* ui-out.c (make_cleanup_ui_out_begin_end): Delete function.
* dwarf2-frame.c (dwarf2_frame_cache): Make static.
* p-exp.y (push_current_type, pop_current_type): ISO C declaration.
* dwarf2expr.h (dwarf_expr_context): ISO C declaration.
* maint.c (maintenance_print_architecture): Make static.
* signals/signals.c (_initialize_signals): Add declaration.
* std-regs.c (_initialize_frame_reg): Add declaration.
* jv-exp.y (push_variable): ISO C definition.
(push_qualified_expression_name): Ditto.
* memattr.c (_initialize_mem): Add declaration.
* remote.c (remote_check_watch_resources): Make static.
(remote_stopped_by_watchpoint): Make static.
(remote_stopped_data_address): Make static.
* d10v-tdep.c (nr_dmap_regs): Make static.
(a0_regnum): Make static.
(d10v_frame_unwind_cache): Make static.
(d10v_frame_p): Make static.
* osabi.c (show_osabi): Make static.
(_initialize_gdb_osabi): Add extern declaration.
* gdbtypes.c (make_qualified_type): Make static.
(safe_parse_type): Make static.
* macrocmd.c (_initialize_macrocmd): Add extern declaration.
* macrotab.c (macro_bcache_free): Make static.
* interps.c (interp_set_quiet): Make static.
(interpreter_exec_cmd): Make static.
* stack.h (select_frame_command): New file.
* stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete function.
(select_frame_command): Make global.
* infcall.c: Include "infcall.h".
* linespec.c: Include "linespec.h".
* symfile.c (sections_overlap): Make static.
* cp-support.h (cp_initialize_namespace): ISO C declaration.
* charset.c (_initialize_charset): Add missing prototype.
* regcache.c (init_legacy_regcache_descr): Make static.
(do_regcache_xfree): Make static.
(regcache_xfer_part): Make static.
(_initialize_regcache): Add missing prototype.
* breakpoint.c (parse_breakpoint_sals): Make static.
(breakpoint_sals_to_pc): Make static.
* interps.h (clear_interpreter_hooks): ISO C declaration.
* Makefile.in (stack_h): Define.
(stack.o, typeprint.o, mi-main.o): Update dependencies.
(mi-cmd-stack.o, infcall.o, linespec.o): Update dependencies.
Index: mi/ChangeLog
2003-06-08 Andrew Cagney <cagney@redhat.com>
* mi-parse.c (_initialize_mi_parse): Delete function.
* mi-main.c: Include "mi-main.h".
* mi-interp.c (_initialize_mi_interp): Add declaration.
* mi-cmd-stack.c: Include "stack.h".
(select_frame_command_wrapper): Delete extern declaration.
(mi_cmd_stack_select_frame): Replace select_frame_command_wrapper
with select_frame_command.
2003-06-08 18:27:14 +00:00
|
|
|
static CORE_ADDR
|
2002-09-18 23:29:20 +00:00
|
|
|
find_implementation (CORE_ADDR object, CORE_ADDR sel)
|
|
|
|
{
|
|
|
|
struct objc_object ostr;
|
|
|
|
|
2002-09-19 00:39:38 +00:00
|
|
|
if (object == 0)
|
|
|
|
return 0;
|
2002-09-18 23:29:20 +00:00
|
|
|
read_objc_object (object, &ostr);
|
2002-09-19 00:39:38 +00:00
|
|
|
if (ostr.isa == 0)
|
|
|
|
return 0;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
return find_implementation_from_class (ostr.isa, sel);
|
|
|
|
}
|
|
|
|
|
2003-06-08 02:31:24 +00:00
|
|
|
#define OBJC_FETCH_POINTER_ARGUMENT(argi) \
|
2007-06-06 15:43:26 +00:00
|
|
|
gdbarch_fetch_pointer_argument (current_gdbarch, get_current_frame (), \
|
|
|
|
argi, builtin_type_void_func_ptr)
|
2003-06-08 02:31:24 +00:00
|
|
|
|
2002-09-18 23:29:20 +00:00
|
|
|
static int
|
|
|
|
resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc)
|
|
|
|
{
|
|
|
|
CORE_ADDR object;
|
|
|
|
CORE_ADDR sel;
|
|
|
|
CORE_ADDR res;
|
|
|
|
|
2003-06-08 02:31:24 +00:00
|
|
|
object = OBJC_FETCH_POINTER_ARGUMENT (0);
|
|
|
|
sel = OBJC_FETCH_POINTER_ARGUMENT (1);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
res = find_implementation (object, sel);
|
2002-09-19 00:39:38 +00:00
|
|
|
if (new_pc != 0)
|
|
|
|
*new_pc = res;
|
|
|
|
if (res == 0)
|
|
|
|
return 1;
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
|
|
|
|
{
|
|
|
|
CORE_ADDR object;
|
|
|
|
CORE_ADDR sel;
|
|
|
|
CORE_ADDR res;
|
|
|
|
|
2003-06-08 02:31:24 +00:00
|
|
|
object = OBJC_FETCH_POINTER_ARGUMENT (1);
|
|
|
|
sel = OBJC_FETCH_POINTER_ARGUMENT (2);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
res = find_implementation (object, sel);
|
2002-09-19 00:39:38 +00:00
|
|
|
if (new_pc != 0)
|
|
|
|
*new_pc = res;
|
|
|
|
if (res == 0)
|
|
|
|
return 1;
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
|
|
|
|
{
|
|
|
|
struct objc_super sstr;
|
|
|
|
|
|
|
|
CORE_ADDR super;
|
|
|
|
CORE_ADDR sel;
|
|
|
|
CORE_ADDR res;
|
|
|
|
|
2003-06-08 02:31:24 +00:00
|
|
|
super = OBJC_FETCH_POINTER_ARGUMENT (0);
|
|
|
|
sel = OBJC_FETCH_POINTER_ARGUMENT (1);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
read_objc_super (super, &sstr);
|
2002-09-19 00:39:38 +00:00
|
|
|
if (sstr.class == 0)
|
|
|
|
return 0;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
res = find_implementation_from_class (sstr.class, sel);
|
2002-09-19 00:39:38 +00:00
|
|
|
if (new_pc != 0)
|
|
|
|
*new_pc = res;
|
|
|
|
if (res == 0)
|
|
|
|
return 1;
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
|
|
|
|
{
|
|
|
|
struct objc_super sstr;
|
|
|
|
|
|
|
|
CORE_ADDR super;
|
|
|
|
CORE_ADDR sel;
|
|
|
|
CORE_ADDR res;
|
|
|
|
|
2003-06-08 02:31:24 +00:00
|
|
|
super = OBJC_FETCH_POINTER_ARGUMENT (1);
|
|
|
|
sel = OBJC_FETCH_POINTER_ARGUMENT (2);
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
read_objc_super (super, &sstr);
|
2002-09-19 00:39:38 +00:00
|
|
|
if (sstr.class == 0)
|
|
|
|
return 0;
|
2002-09-18 23:29:20 +00:00
|
|
|
|
|
|
|
res = find_implementation_from_class (sstr.class, sel);
|
2002-09-19 00:39:38 +00:00
|
|
|
if (new_pc != 0)
|
|
|
|
*new_pc = res;
|
|
|
|
if (res == 0)
|
|
|
|
return 1;
|
2002-09-18 23:29:20 +00:00
|
|
|
return 0;
|
|
|
|
}
|