From 9b280a7f5363e4b2ebd8c0a9b2e1782e9769880c Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Sat, 29 Aug 1992 00:32:58 +0000 Subject: RS/6000 portability changes (for hosting cross-debuggers). * breakpoint.c (fixup_breakpoints): Re-kludge to IBM6000_TARGET. * buildsym.c, rs6000-xdep.c, rs6000-tdep.c, tm-rs6000.h, xcoffexec.c, xcoffread.c: Rename aixcoff to xcoff everywhere. * printcmd.c (print_frame_args): Remove an RS/6000 dependency. * stabsread.c (define_symbol): Remove RS/6000 dependencies. * tm-rs6000.h (ATTACH_DETACH): Remove: host-dependent. (PTRACE_ATTACH, PTRACE_DETACH): Remove: host-dep. (NO_SINGLE_STEP): Add, target-dependent. (loadinfotextindex): Lowercase, remove "aix_". * xm-rs6000.h: Add for infptrace.c. (NO_SINGLE_STEP): Remove, target-dependent. * xcoffexec.c (vmap_symtab): Cleanup #if 0'd code. * xcoffread.c: Only build file if RS/6000 native GDB. (build_function_symbol): Remove #if 0'd code. * rs6000-tdep.c: Cleanup. Add static fn protos. Use CORE_ADDR for addresses throughout. Make void fns void. (pop_dummy_frame): Add FIXME about bogosity of design here. (rs6000_struct_return_address): Ditto. (frameless_function_invocation, frame_get_cache_fsr, frame_initial_stack_address, xcoff_relocate_symtab, xcoff_init_loadinfo, free_loadinfo, xcoff_add_toc_to_loadinfo, add_text_to_loadinfo, find_toc_address): Move from xdep file. Use CORE_ADDRs. Change identifiers to lowercase. * rs6000-xdep.c: Make whole file conditional on native RS/6000, supplying dummy routines if non-native. Add prototype for static exec_one_dummy_insn. Move a mess of functions to rs6000-tdep.c (as above). Remove #if 0'd code. * config/rs6000.mh (XDEPFILES): Move xcoffexec.o to target side. (XM_CLIBS): Add -lm to circumvent AIX 3.2 libc ldexp bug. * config/rs6000.mt (TDEPFILES): Adopt xcoffexec.o. --- gdb/ChangeLog | 38 +++++++ gdb/breakpoint.c | 49 +++++---- gdb/buildsym.c | 4 +- gdb/rs6000-xdep.c | 319 +++++------------------------------------------------- gdb/stabsread.c | 25 +---- gdb/tm-rs6000.h | 25 ++--- gdb/xcoffexec.c | 12 +- gdb/xcoffread.c | 90 ++++++--------- gdb/xm-rs6000.h | 7 +- 9 files changed, 143 insertions(+), 426 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8f14731..83e7c40 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,43 @@ Fri Aug 28 13:13:33 1992 John Gilmore (gnu@cygnus.com) + RS/6000 portability changes (for hosting cross-debuggers). + + * breakpoint.c (fixup_breakpoints): Re-kludge to IBM6000_TARGET. + * buildsym.c, rs6000-xdep.c, rs6000-tdep.c, tm-rs6000.h, + xcoffexec.c, xcoffread.c: Rename aixcoff to xcoff everywhere. + * printcmd.c (print_frame_args): Remove an RS/6000 dependency. + * stabsread.c (define_symbol): Remove RS/6000 dependencies. + * tm-rs6000.h (ATTACH_DETACH): Remove: host-dependent. + (PTRACE_ATTACH, PTRACE_DETACH): Remove: host-dep. + (NO_SINGLE_STEP): Add, target-dependent. + (loadinfotextindex): Lowercase, remove "aix_". + * xm-rs6000.h: Add for infptrace.c. + (NO_SINGLE_STEP): Remove, target-dependent. + * xcoffexec.c (vmap_symtab): Cleanup #if 0'd code. + * xcoffread.c: Only build file if RS/6000 native GDB. + (build_function_symbol): Remove #if 0'd code. + * rs6000-tdep.c: Cleanup. Add static fn protos. + Use CORE_ADDR for addresses throughout. Make void fns void. + (pop_dummy_frame): Add FIXME about bogosity of design here. + (rs6000_struct_return_address): Ditto. + (frameless_function_invocation, frame_get_cache_fsr, + frame_initial_stack_address, xcoff_relocate_symtab, + xcoff_init_loadinfo, free_loadinfo, xcoff_add_toc_to_loadinfo, + add_text_to_loadinfo, find_toc_address): Move from xdep file. + Use CORE_ADDRs. Change identifiers to lowercase. + + * rs6000-xdep.c: Make whole file conditional on native RS/6000, + supplying dummy routines if non-native. Add prototype for + static exec_one_dummy_insn. Move a mess of functions to + rs6000-tdep.c (as above). Remove #if 0'd code. + + * config/rs6000.mh (XDEPFILES): Move xcoffexec.o to target side. + (XM_CLIBS): Add -lm to circumvent AIX 3.2 libc ldexp bug. + * config/rs6000.mt (TDEPFILES): Adopt xcoffexec.o. + + * gdbtypes.h (TYPE_ALLOC): Parenthesize result to avoid problems + for callers. + * vx-share/README, nindy-share/README: New files describing how these directories' code is shared, and with whom. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index fa9ed10..87e8f7c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -317,11 +317,8 @@ commands_command (arg, from_tty) if (b->number == bnum) { if (from_tty && input_from_terminal_p ()) - { - printf_filtered ("Type commands for when breakpoint %d is hit, one per line.\n\ + printf_filtered ("Type commands for when breakpoint %d is hit, one per line.\n\ End with a line saying just \"end\".\n", bnum); - fflush (stdout); - } l = read_command_lines (); free_command_lines (&b->commands); b->commands = l; @@ -1112,9 +1109,11 @@ breakpoints_info (bnum_exp, from_tty) breakpoint_1 (bnum, 0); } +#if MAINTENANCE_CMDS + /* ARGSUSED */ static void -all_breakpoints_info (bnum_exp, from_tty) +maintenance_info_breakpoints (bnum_exp, from_tty) char *bnum_exp; int from_tty; { @@ -1126,6 +1125,8 @@ all_breakpoints_info (bnum_exp, from_tty) breakpoint_1 (bnum, 1); } +#endif + /* Print a message describing any breakpoints set at PC. */ static void @@ -1286,7 +1287,10 @@ enable_longjmp_breakpoint() ALL_BREAKPOINTS (b) if (b->type == bp_longjmp) - b->enable = enabled; + { + b->enable = enabled; + check_duplicates (b->address); + } } void @@ -1295,9 +1299,12 @@ disable_longjmp_breakpoint() register struct breakpoint *b; ALL_BREAKPOINTS (b) - if (b->type == bp_longjmp + if ( b->type == bp_longjmp || b->type == bp_longjmp_resume) - b->enable = disabled; + { + b->enable = disabled; + check_duplicates (b->address); + } } /* Call this after hitting the longjmp() breakpoint. Use this to set a new @@ -1323,6 +1330,7 @@ set_longjmp_resume_breakpoint(pc, frame) b->frame = FRAME_FP(frame); else b->frame = 0; + check_duplicates (b->address); return; } } @@ -2247,6 +2255,11 @@ breakpoint_re_set () static char message1[] = "Error in re-setting breakpoint %d:\n"; char message[sizeof (message1) + 30 /* slop */]; + if (current_source_symtab == NULL) + { + select_source_symtab (NULL); + } + ALL_BREAKPOINTS_SAFE (b, temp) { sprintf (message, message1, b->number); /* Format possible error msg */ @@ -2509,15 +2522,6 @@ decode_line_spec_1 (string, funfirstline) return sals; } - -/* Chain containing all defined enable commands. */ - -extern struct cmd_list_element - *enablelist, *disablelist, - *deletelist, *enablebreaklist; - -extern struct cmd_list_element *cmdlist; - void _initialize_breakpoint () { @@ -2662,7 +2666,9 @@ are set to the address of the last breakpoint listed.\n\n\ Convenience variable \"$bpnum\" contains the number of the last\n\ breakpoint set."); - add_info ("all-breakpoints", all_breakpoints_info, +#if MAINTENANCE_CMDS + + add_cmd ("breakpoints", class_maintenance, maintenance_info_breakpoints, "Status of all breakpoints, or breakpoint number NUMBER.\n\ The \"Type\" column indicates one of:\n\ \tbreakpoint - normal breakpoint\n\ @@ -2678,7 +2684,10 @@ address and file/line number respectively.\n\n\ Convenience variable \"$_\" and default examine address for \"x\"\n\ are set to the address of the last breakpoint listed.\n\n\ Convenience variable \"$bpnum\" contains the number of the last\n\ -breakpoint set."); +breakpoint set.", + &maintenanceinfolist); + +#endif /* MAINTENANCE_CMDS */ add_com ("catch", class_breakpoint, catch_command, "Set breakpoints to catch exceptions that are raised.\n\ @@ -2701,7 +2710,7 @@ an expression changes."); "Synonym for ``info breakpoints''."); } -#ifdef IBM6000_HOST +#ifdef IBM6000_TARGET /* Where should this function go? It is used by AIX only. FIXME. */ /* Breakpoint address relocation used to be done in breakpoint_re_set(). That diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 566a66f..a25190a 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -590,7 +590,7 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile) } } - /* It is unfortunate that in aixcoff, pending blocks might not be ordered + /* It is unfortunate that in xcoff, pending blocks might not be ordered in this stage. Especially, blocks for static functions will show up at the end. We need to sort them, so tools like `find_pc_function' and `find_pc_block' can work reliably. */ @@ -649,7 +649,7 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile) } #ifdef PROCESS_LINENUMBER_HOOK - PROCESS_LINENUMBER_HOOK (); /* Needed for aixcoff. */ + PROCESS_LINENUMBER_HOOK (); /* Needed for xcoff. */ #endif /* Now create the symtab objects proper, one for each subfile. */ diff --git a/gdb/rs6000-xdep.c b/gdb/rs6000-xdep.c index b4a1851..a80ee14 100644 --- a/gdb/rs6000-xdep.c +++ b/gdb/rs6000-xdep.c @@ -1,5 +1,5 @@ /* IBM RS/6000 host-dependent code for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. This file is part of GDB. @@ -23,6 +23,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "symtab.h" #include "target.h" +#ifdef RS6000_TARGET + #include #include #include @@ -37,11 +39,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include -#include -#include extern int errno; -extern int attach_flag; + +static void +exec_one_dummy_insn PARAMS ((void)); /* Conversion from gdb-to-system special purpose register numbers.. */ @@ -54,13 +56,6 @@ static int special_regs[] = { XER, /* XER_REGNUM */ MQ /* MQ_REGNUM */ }; - - -/* Nonzero if we just simulated a single step break. */ -extern int one_stepped; - -extern struct obstack frame_cache_obstack; - void fetch_inferior_registers (regno) @@ -229,269 +224,10 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) } -frameless_function_invocation (fi) -struct frame_info *fi; -{ - CORE_ADDR func_start; - struct aix_framedata fdata; - - func_start = get_pc_function_start (fi->pc) + FUNCTION_START_OFFSET; - - /* If we failed to find the start of the function, it is a mistake - to inspect the instructions. */ - - if (!func_start) - return 0; - - function_frame_info (func_start, &fdata); - return fdata.frameless; -} - - -/* If saved registers of frame FI are not known yet, read and cache them. - &FDATAP contains aix_framedata; TDATAP can be NULL, - in which case the framedata are read. - */ - -static void -frame_get_cache_fsr (fi, fdatap) - struct frame_info *fi; - struct aix_framedata *fdatap; -{ - int ii; - CORE_ADDR frame_addr; - struct aix_framedata work_fdata; - if (fi->cache_fsr) - return; - - if (fdatap == NULL) { - fdatap = &work_fdata; - function_frame_info (get_pc_function_start (fi->pc), fdatap); - } - - fi->cache_fsr = (struct frame_saved_regs *) - obstack_alloc (&frame_cache_obstack, sizeof (struct frame_saved_regs)); - bzero (fi->cache_fsr, sizeof (struct frame_saved_regs)); - - if (fi->prev && fi->prev->frame) - frame_addr = fi->prev->frame; - else - frame_addr = read_memory_integer (fi->frame, 4); - - /* if != -1, fdatap->saved_fpr is the smallest number of saved_fpr. - All fpr's from saved_fpr to fp31 are saved right underneath caller - stack pointer, starting from fp31 first. */ - - if (fdatap->saved_fpr >= 0) { - for (ii=31; ii >= fdatap->saved_fpr; --ii) - fi->cache_fsr->regs [FP0_REGNUM + ii] = frame_addr - ((32 - ii) * 8); - frame_addr -= (32 - fdatap->saved_fpr) * 8; - } - - /* if != -1, fdatap->saved_gpr is the smallest number of saved_gpr. - All gpr's from saved_gpr to gpr31 are saved right under saved fprs, - starting from r31 first. */ - - if (fdatap->saved_gpr >= 0) - for (ii=31; ii >= fdatap->saved_gpr; --ii) - fi->cache_fsr->regs [ii] = frame_addr - ((32 - ii) * 4); -} - -/* Return the address of a frame. This is the inital %sp value when the frame - was first allocated. For functions calling alloca(), it might be saved in - an alloca register. */ - -CORE_ADDR -frame_initial_stack_address (fi) - struct frame_info *fi; -{ - CORE_ADDR tmpaddr; - struct aix_framedata fdata; - struct frame_info *callee_fi; - - /* if the initial stack pointer (frame address) of this frame is known, - just return it. */ - - if (fi->initial_sp) - return fi->initial_sp; - - /* find out if this function is using an alloca register.. */ - - function_frame_info (get_pc_function_start (fi->pc), &fdata); - - /* if saved registers of this frame are not known yet, read and cache them. */ - - if (!fi->cache_fsr) - frame_get_cache_fsr (fi, &fdata); - - /* If no alloca register used, then fi->frame is the value of the %sp for - this frame, and it is good enough. */ - - if (fdata.alloca_reg < 0) { - fi->initial_sp = fi->frame; - return fi->initial_sp; - } - - /* This function has an alloca register. If this is the top-most frame - (with the lowest address), the value in alloca register is good. */ - - if (!fi->next) - return fi->initial_sp = read_register (fdata.alloca_reg); - - /* Otherwise, this is a caller frame. Callee has usually already saved - registers, but there are exceptions (such as when the callee - has no parameters). Find the address in which caller's alloca - register is saved. */ - - for (callee_fi = fi->next; callee_fi; callee_fi = callee_fi->next) { - - if (!callee_fi->cache_fsr) - frame_get_cache_fsr (fi, NULL); - - /* this is the address in which alloca register is saved. */ - - tmpaddr = callee_fi->cache_fsr->regs [fdata.alloca_reg]; - if (tmpaddr) { - fi->initial_sp = read_memory_integer (tmpaddr, 4); - return fi->initial_sp; - } - - /* Go look into deeper levels of the frame chain to see if any one of - the callees has saved alloca register. */ - } - - /* If alloca register was not saved, by the callee (or any of its callees) - then the value in the register is still good. */ - - return fi->initial_sp = read_register (fdata.alloca_reg); -} - - - -/* aixcoff_relocate_symtab - hook for symbol table relocation. - also reads shared libraries.. */ - -aixcoff_relocate_symtab (pid) -unsigned int pid; -{ -#define MAX_LOAD_SEGS 64 /* maximum number of load segments */ - - struct ld_info *ldi; - int temp; - - ldi = (void *) alloca(MAX_LOAD_SEGS * sizeof (*ldi)); - - /* According to my humble theory, aixcoff has some timing problems and - when the user stack grows, kernel doesn't update stack info in time - and ptrace calls step on user stack. That is why we sleep here a little, - and give kernel to update its internals. */ - - usleep (36000); - - errno = 0; - ptrace(PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi, - MAX_LOAD_SEGS * sizeof(*ldi), ldi); - if (errno) { - perror_with_name ("ptrace ldinfo"); - return 0; - } - - vmap_ldinfo(ldi); - - do { - add_text_to_loadinfo (ldi->ldinfo_textorg, ldi->ldinfo_dataorg); - } while (ldi->ldinfo_next - && (ldi = (void *) (ldi->ldinfo_next + (char *) ldi))); - -#if 0 - /* Now that we've jumbled things around, re-sort them. */ - sort_minimal_symbols (); -#endif - - /* relocate the exec and core sections as well. */ - vmap_exec (); -} - - -/* Keep an array of load segment information and their TOC table addresses. - This info will be useful when calling a shared library function by hand. */ - -typedef struct { - unsigned long textorg, dataorg, toc_offset; -} LoadInfo; - -#define LOADINFOLEN 10 - -static LoadInfo *loadInfo = NULL; -static int loadInfoLen = 0; -static int loadInfoTocIndex = 0; -int aix_loadInfoTextIndex = 0; - - -xcoff_init_loadinfo () -{ - loadInfoTocIndex = 0; - aix_loadInfoTextIndex = 0; - - if (loadInfoLen == 0) { - loadInfo = (void*) xmalloc (sizeof (LoadInfo) * LOADINFOLEN); - loadInfoLen = LOADINFOLEN; - } -} - - -free_loadinfo () -{ - if (loadInfo) - free (loadInfo); - loadInfo = NULL; - loadInfoLen = 0; - loadInfoTocIndex = 0; - aix_loadInfoTextIndex = 0; -} - - -xcoff_add_toc_to_loadinfo (unsigned long tocaddr) -{ - while (loadInfoTocIndex >= loadInfoLen) { - loadInfoLen += LOADINFOLEN; - loadInfo = (void*) xrealloc (loadInfo, sizeof(LoadInfo) * loadInfoLen); - } - loadInfo [loadInfoTocIndex++].toc_offset = tocaddr; -} - - -add_text_to_loadinfo (unsigned long textaddr, unsigned long dataaddr) -{ - while (aix_loadInfoTextIndex >= loadInfoLen) { - loadInfoLen += LOADINFOLEN; - loadInfo = (void*) xrealloc (loadInfo, sizeof(LoadInfo) * loadInfoLen); - } - loadInfo [aix_loadInfoTextIndex].textorg = textaddr; - loadInfo [aix_loadInfoTextIndex].dataorg = dataaddr; - ++aix_loadInfoTextIndex; -} - - -unsigned long -find_toc_address (unsigned long pc) -{ - int ii, toc_entry, tocbase = 0; - - for (ii=0; ii < aix_loadInfoTextIndex; ++ii) - if (pc > loadInfo [ii].textorg && loadInfo [ii].textorg > tocbase) { - toc_entry = ii; - tocbase = loadInfo [ii].textorg; - } - - return loadInfo [toc_entry].dataorg + loadInfo [toc_entry].toc_offset; -} - - -/* execute one dummy breakpoint instruction. This way we give kernel +/* Execute one dummy breakpoint instruction. This way we give the kernel a chance to do some housekeeping and update inferior's internal data, including u_area. */ - +static void exec_one_dummy_insn () { #define DUMMY_INSN_ADDR (TEXT_SEGMENT_BASE)+0x200 @@ -517,28 +253,29 @@ exec_one_dummy_insn () } -#if 0 +#else /* RS6000_TARGET */ - *** not needed anymore *** +/* FIXME: Kludge this til we separate host vs. target vs. native code. */ -/* Return the number of initial trap signals we need to ignore once the inferior - process starts running. This will be `2' for aix-3.1, `3' for aix-3.2 */ - -int -aix_starting_inferior_traps () +void +fetch_inferior_registers (regno) + int regno; { - struct utsname unamebuf; +} - if (uname (&unamebuf) == -1) - fatal ("uname(3) failed."); +void +store_inferior_registers (regno) + int regno; +{ +} - /* Assume the future versions will behave like 3.2 and return '3' for - anything other than 3.1x. The extra trap in 3.2 is the "trap after the - program is loaded" signal. */ - - if (unamebuf.version[0] == '3' && unamebuf.release[0] == '1') - return 2; - else - return 3; +void +fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) + char *core_reg_sect; + unsigned core_reg_size; + int which; + unsigned int reg_addr; /* Unused in this version */ +{ } -#endif + +#endif /* RS6000_TARGET */ diff --git a/gdb/stabsread.c b/gdb/stabsread.c index f74e435..832d9c3 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -447,26 +447,12 @@ define_symbol (valu, string, desc, type, objfile) } } p++; + /* Determine the type of name being defined. */ /* The Acorn RISC machine's compiler can put out locals that don't start with "234=" or "(3,4)=", so assume anything other than the deftypes we know how to handle is a local. */ - /* (Peter Watkins @ Computervision) - Handle Sun-style local fortran array types 'ar...' . - (gnu@cygnus.com) -- this strchr() handles them properly? - (tiemann@cygnus.com) -- 'C' is for catch. */ - -#ifdef IBM6000_TARGET - - /* 'R' is for register parameters. */ - if (!strchr ("cfFGpPrStTvVXCR", *p)) - -#else - - if (!strchr ("cfFGpPrStTvVXC", *p)) - -#endif deftype = 'l'; else deftype = *p++; @@ -543,12 +529,6 @@ define_symbol (valu, string, desc, type, objfile) SYMBOL_TYPE (sym) = lookup_pointer_type (lookup_function_type (read_type (&p, objfile))); } - -#ifdef IBM6000_TARGET - else if (deftype == 'R') - SYMBOL_TYPE (sym) = read_type (&p, objfile); -#endif - else { /* The symbol class letter is followed by a type (typically the @@ -754,9 +734,7 @@ define_symbol (valu, string, desc, type, objfile) add_symbol_to_list (sym, &local_symbols); break; -#ifdef IBM6000_TARGET case 'R': -#endif case 'r': /* Register variable (either global or local). */ SYMBOL_CLASS (sym) = LOC_REGISTER; @@ -2970,7 +2948,6 @@ void end_stabs () void finish_global_stabs (objfile) - struct objfile *objfile; { if (global_stabs) diff --git a/gdb/tm-rs6000.h b/gdb/tm-rs6000.h index 43eb2d3..34d2606 100644 --- a/gdb/tm-rs6000.h +++ b/gdb/tm-rs6000.h @@ -133,12 +133,12 @@ struct aix_framedata { figured out where they go. But we want to do this relocation just once. */ -extern int aix_loadInfoTextIndex; +extern int loadinfotextindex; #define SOLIB_CREATE_INFERIOR_HOOK(PID) \ do { \ - if (aix_loadInfoTextIndex == 0) \ - aixcoff_relocate_symtab (PID); \ + if (loadinfotextindex == 0) \ + xcoff_relocate_symtab (PID); \ } while (0) @@ -164,7 +164,7 @@ extern int aix_loadInfoTextIndex; continue; \ } -/* In aixcoff, we cannot process line numbers when we see them. This is +/* In xcoff, we cannot process line numbers when we see them. This is mainly because we don't know the boundaries of the include files. So, we postpone that, and then enter and sort(?) the whole line table at once, when we are closing the current symbol table in end_symtab(). */ @@ -179,7 +179,7 @@ extern int aix_loadInfoTextIndex; load segments. */ #define SOLIB_ADD(a, b, c) \ - if (inferior_pid) aixcoff_relocate_symtab (inferior_pid) + if (inferior_pid) xcoff_relocate_symtab (inferior_pid) /* Immediately after a function call, return the saved pc. Can't go through the frames for this because on some machines @@ -413,17 +413,6 @@ extern unsigned int rs6000_struct_return_address; as a CORE_ADDR (or an expression that can be used as one). */ #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) rs6000_struct_return_address - - -/* Do implement the attach and detach commands. */ - -#define ATTACH_DETACH - -/* infptrace.c requires those. */ - -#define PTRACE_ATTACH 30 -#define PTRACE_DETACH 31 - /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ @@ -638,3 +627,7 @@ aix_resizewindow () \ /* Flag for machine-specific stuff in shared files. FIXME */ #define IBM6000_TARGET + +/* RS6000/AIX does not support PT_STEP. Has to be simulated. */ + +#define NO_SINGLE_STEP diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c index f9b9e32..d4586ee 100644 --- a/gdb/xcoffexec.c +++ b/gdb/xcoffexec.c @@ -445,16 +445,6 @@ struct stat *vip; } if (vp->tstart != old_start) { - -#if 0 - We don't have a valid `objfile' at this point. This is moved into the - previous statement; ALL_OBJFILES() for-loop. - - ALL_MSYMBOLS (objfile, msymbol) - if (msymbol->address < TEXT_SEGMENT_BASE) - msymbol -> address += vp->tstart - old_start; -#endif /* 0 */ - /* breakpoints need to be relocated as well. */ fixup_breakpoints (0, TEXT_SEGMENT_BASE, vp->tstart - old_start); } @@ -565,7 +555,7 @@ register struct ld_info *ldi; { register char *mem, *objname; /* This ldi structure was allocated using alloca() in - aixcoff_relocate_symtab(). Now we need to have persistent object + xcoff_relocate_symtab(). Now we need to have persistent object and member names, so we should save them. */ mem = ldi->ldinfo_filename + strlen(ldi->ldinfo_filename) + 1; diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 7719785..579ed30 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1,5 +1,6 @@ -/* Read AIXcoff symbol tables and convert to internal format, for GDB. - Copyright (C) 1986-1991 Free Software Foundation, Inc. +/* Read AIX xcoff symbol tables and convert to internal format, for GDB. + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 + Free Software Foundation, Inc. Derived from coffread.c, dbxread.c, and a lot of hacking. Contributed by IBM Corporation. @@ -22,10 +23,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "bfd.h" -#ifdef IBM6000_HOST -/* Native only: Need struct tbtable in . */ +#if defined(IBM6000_HOST) && defined(IBM6000_TARGET) +/* Native only: Need struct tbtable in from host, and + need xcoff_add_toc_to_loadinfo in rs6000-tdep.c from target. */ -/* AIX COFF names have a preceeding dot `.' */ +/* AIX XCOFF names have a preceeding dot `.' */ #define NAMES_HAVE_DOT 1 #include @@ -175,21 +177,21 @@ static int init_stringtab PARAMS ((bfd *, long, struct objfile *)); static void -aixcoff_symfile_init PARAMS ((struct objfile *)); +xcoff_symfile_init PARAMS ((struct objfile *)); static void -aixcoff_new_init PARAMS ((struct objfile *)); +xcoff_new_init PARAMS ((struct objfile *)); struct section_offset; static void -aixcoff_symfile_read PARAMS ((struct objfile *, struct section_offset *, int)); +xcoff_symfile_read PARAMS ((struct objfile *, struct section_offset *, int)); static void -aixcoff_symfile_finish PARAMS ((struct objfile *)); +xcoff_symfile_finish PARAMS ((struct objfile *)); static struct section_offsets * -aixcoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR)); +xcoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR)); static int init_lineno PARAMS ((bfd *, long, int)); @@ -453,11 +455,11 @@ static void record_include_begin (cs) struct coff_symbol *cs; { - /* In aixcoff, we assume include files cannot be nested (not in .c files + /* In xcoff, we assume include files cannot be nested (not in .c files of course, but in corresponding .s files.) */ if (inclDepth) - fatal ("aix internal: pending include file exists."); + fatal ("xcoff internal: pending include file exists."); ++inclDepth; @@ -489,7 +491,7 @@ struct coff_symbol *cs; InclTable *pTbl; if (inclDepth == 0) - fatal ("aix internal: Mismatch C_BINCL/C_EINCL pair found."); + fatal ("xcoff internal: Mismatch C_BINCL/C_EINCL pair found."); pTbl = &inclTable [inclIndx]; pTbl->end = cs->c_value; @@ -979,7 +981,7 @@ static struct symbol parmsym = { /* default parameter symbol */ } -/* aixcoff has static blocks marked in `.bs', `.es' pairs. They cannot be +/* xcoff has static blocks marked in `.bs', `.es' pairs. They cannot be nested. At any given time, a symbol can only be in one static block. This is the base address of current static block, zero if non exists. */ @@ -1073,7 +1075,7 @@ read_xcoff_symtab (objfile, nsyms) /* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */ /* read one symbol into `cs' structure. After processing the whole symbol table, only string table will be kept in memory, symbol table and debug - section of aixcoff will be freed. Thus we can mark symbols with names + section of xcoff will be freed. Thus we can mark symbols with names in string table as `alloced'. */ { int ii; @@ -2030,7 +2032,7 @@ init_lineno (abfd, offset, size) (a \ at the end of the text of a name) call this function to get the continuation. */ /* So far, I haven't seen this happenning xlc output. I doubt we'll need this - for aixcoff. */ + for xcoff. */ #undef next_symbol_text #define next_symbol_text() \ @@ -2100,42 +2102,14 @@ char **pp; } } -#if 0 /* Seems to be unused, don't bother converting from old misc function - vector usage to new minimal symbol tables. FIXME: Delete this? */ - -/* if we now nothing about a function but its address, make a function symbol - out of it with the limited knowladge you have. This will be used when - somebody refers to a function, which doesn't exist in the symbol table, - but is in the minimal symbol table. */ - -struct symbol * -build_function_symbol (ind, objfile) - int ind; - struct objfile *objfile; -{ - struct symbol *sym = - (struct symbol *) obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); - SYMBOL_NAME (sym) = misc_function_vector[ind].name; - /* SYMBOL_VALUE (sym) = misc_function_vector[ind].address; */ - SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; - SYMBOL_CLASS (sym) = LOC_BLOCK; - SYMBOL_TYPE (sym) = lookup_function_type (lookup_fundamental_type (current_objfile, FT_INTEGER)); - SYMBOL_BLOCK_VALUE (sym) = (struct block *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct block)); - BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) = misc_function_vector[ind].address; - return sym; -} - -#endif - static void -aixcoff_new_init (objfile) +xcoff_new_init (objfile) struct objfile *objfile; { } static void -aixcoff_symfile_init (objfile) +xcoff_symfile_init (objfile) struct objfile *objfile; { bfd *abfd = objfile->obfd; @@ -2152,7 +2126,7 @@ aixcoff_symfile_init (objfile) objfile struct from the global list of known objfiles. */ static void -aixcoff_symfile_finish (objfile) +xcoff_symfile_finish (objfile) struct objfile *objfile; { if (objfile -> sym_private != NULL) @@ -2251,10 +2225,10 @@ free_debugsection() } -/* aixcoff version of symbol file read. */ +/* xcoff version of symbol file read. */ static void -aixcoff_symfile_read (objfile, section_offset, mainline) +xcoff_symfile_read (objfile, section_offset, mainline) struct objfile *objfile; struct section_offset *section_offset; int mainline; @@ -2341,7 +2315,7 @@ aixcoff_symfile_read (objfile, section_offset, mainline) static struct section_offsets * -aixcoff_symfile_offsets (objfile, addr) +xcoff_symfile_offsets (objfile, addr) struct objfile *objfile; CORE_ADDR addr; { @@ -2358,24 +2332,24 @@ aixcoff_symfile_offsets (objfile, addr) return section_offsets; } -/* Register our ability to parse symbols for aixcoff BFD files. */ +/* Register our ability to parse symbols for xcoff BFD files. */ -static struct sym_fns aixcoff_sym_fns = +static struct sym_fns xcoff_sym_fns = { "aixcoff-rs6000", /* sym_name: name or name prefix of BFD target type */ 15, /* sym_namelen: number of significant sym_name chars */ - aixcoff_new_init, /* sym_new_init: init anything gbl to entire symtab */ - aixcoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - aixcoff_symfile_read, /* sym_read: read a symbol file into symtab */ - aixcoff_symfile_finish, /* sym_finish: finished with file, cleanup */ - aixcoff_symfile_offsets, /* sym_offsets: xlate offsets ext->int form */ + xcoff_new_init, /* sym_new_init: init anything gbl to entire symtab */ + xcoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */ + xcoff_symfile_read, /* sym_read: read a symbol file into symtab */ + xcoff_symfile_finish, /* sym_finish: finished with file, cleanup */ + xcoff_symfile_offsets, /* sym_offsets: xlate offsets ext->int form */ NULL /* next: pointer to next struct sym_fns */ }; void _initialize_xcoffread () { - add_symtab_fns(&aixcoff_sym_fns); + add_symtab_fns(&xcoff_sym_fns); } #else /* IBM6000_HOST */ diff --git a/gdb/xm-rs6000.h b/gdb/xm-rs6000.h index 9c09341..9c820f4 100644 --- a/gdb/xm-rs6000.h +++ b/gdb/xm-rs6000.h @@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +#include /* Big end is at the low address */ @@ -49,6 +50,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* The IBM compiler requires this in order to properly compile alloca(). */ #pragma alloca +/* There is no vfork. */ + #define vfork fork /* Do implement the attach and detach commands. */ @@ -63,10 +66,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define SETPGRP_ARGS 1 -/* RS6000/AIXCOFF does not support PT_STEP. Has to be simulated. */ - -#define NO_SINGLE_STEP - /* Flag for machine-specific stuff in shared files. FIXME */ #define IBM6000_HOST -- cgit v1.1