From 556f3d9029f10733007a87814d7a46ea0c480be2 Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Fri, 3 Apr 1992 20:25:57 +0000 Subject: [PATCH] * munch: Must pre-pend "_" to "initialize" for SYSV style nm. * tm-rs6000.h, xcoffexec.c, xcoffread.c, xm-rs6000.h: Merge in more patches for rs6000 from Metin Ozisik. * utils.c: Fix typo in comment. --- gdb/ChangeLog | 7 +++++++ gdb/munch | 4 ++-- gdb/tm-rs6000.h | 24 +++++++----------------- gdb/xcoffexec.c | 22 ++++++++++++++++++++++ gdb/xcoffread.c | 48 +++++++++++++++++++++--------------------------- gdb/xm-rs6000.h | 6 ------ 6 files changed, 59 insertions(+), 52 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 273f4573a70..3de96f3d235 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Fri Apr 3 12:17:14 1992 Per Bothner (bothner@cygnus.com) + + * munch: Must pre-pend "_" to "initialize" for SYSV style nm. + * tm-rs6000.h, xcoffexec.c, xcoffread.c, xm-rs6000.h: + Merge in more patches for rs6000 from Metin Ozisik. + * utils.c: Fix typo in comment. + Fri Apr 3 11:23:03 1992 Fred Fish (fnf@cygnus.com) * procfs.c (procinfo struct): Add nopass_next_sigstop member. diff --git a/gdb/munch b/gdb/munch index 740c670b8d4..75c6521df2c 100755 --- a/gdb/munch +++ b/gdb/munch @@ -23,8 +23,8 @@ if test "`$MUNCH_NM main.o | egrep main | egrep FUNC | egrep GLOB`" != "" ; then elif test "`$MUNCH_NM main.o | egrep '[TD] _?main$'`" = "" ; then # System V style nm shift; - $MUNCH_NM $* | egrep '^(.*[^a-zA-Z_]_|_)_?initialize_.*' | egrep '\.text'|\ - sed -e 's/^.*\(_initialize_[a-zA-Z0-9_]*\)/ {extern void \1 (); \1 ();}/' + $MUNCH_NM $* | egrep '_initialize_.*' | egrep '\.text'|\ + sed -e 's/^.*\(_initialize_[a-zA-Z0-9_]*\).*/ {extern void \1 (); \1 ();}/' else # BSD style nm # We now accept either text or data symbols, since the RT/PC uses data. diff --git a/gdb/tm-rs6000.h b/gdb/tm-rs6000.h index b99deb3cf03..83212886122 100644 --- a/gdb/tm-rs6000.h +++ b/gdb/tm-rs6000.h @@ -136,30 +136,20 @@ extern int aix_loadInfoTextIndex; } while (0) -#if 0 - The following comment is not correct anymore. AIX has a trap signal - that might be sent with a "stopped after a load" status. This might - show up when the inferior is just started, or anytime inferior - loads something else. It is incorrect to try to skip over it *only* in - startup-time. It always has to be ignored and should not be mixed up - with breakpoint traps. See the macro SIGTRAP_STOP_AFTER_LOAD and its - usage in infrun.c. - -/* In aix, number of the trap signals we need to skip over once the - inferior process starts running is different in version 3.1 and 3.2. - This will be 2 for version 3.1x, 3 for version 3.2x. */ - -#define START_INFERIOR_TRAPS_EXPECTED aix_starting_inferior_traps () -#endif /* 0 */ +/* Number of trap signals we need to skip over, once the inferior process + starts running. */ #define START_INFERIOR_TRAPS_EXPECTED 2 /* AIX might return a sigtrap, with a "stop after load" status. It should be ignored by gdb, shouldn't be mixed up with breakpoint traps. */ +/* Another little glitch in AIX is signal 0. I have no idea why wait(2) + returns with this status word. It looks harmless. */ + #define SIGTRAP_STOP_AFTER_LOAD(W) \ - if ( (W) == 0x57c ) { \ - if (breakpoints_inserted) { \ + if ( (W) == 0x57c || (W) == 0x7f) { \ + if ((W)==0x57c && breakpoints_inserted) { \ mark_breakpoints_out (); \ insert_breakpoints (); \ insert_step_breakpoint (); \ diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c index 544aa47ec30..b17d87464a6 100644 --- a/gdb/xcoffexec.c +++ b/gdb/xcoffexec.c @@ -422,15 +422,37 @@ struct stat *vip; for (; s; s = s->next) if (!s->nonreloc || LINETABLE(s)) vmap_symtab_1(s, vp, old_start); + +#if 0 + Himm.., recently we nullified trampoline entry names in order not + to confuse them with real symbols. Appearently this turned into a + problem, and msymbol vector did not get relocated properly. If + msymbols have to have non-null names, then we should name + trampoline entries with empty strings. + + ALL_MSYMBOLS (objfile, msymbol) +#else + for (msymbol = objfile->msymbols; + msymbol->name || msymbol->address; (msymbol)++) +#endif + if (msymbol->address < TEXT_SEGMENT_BASE) + msymbol -> address += vp->tstart - old_start; + break; } } } 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); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 1312f9be3f6..b3e4f30cc24 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -495,17 +495,6 @@ struct coff_symbol *cs; } -static void -dumpIncludeChain () -{ - int ii; - if (inclTable && inclLength) - for (ii=0; ii < inclIndx; ++ii) - printf ("name: %s, begin: 0x%x, end: 0x%x\n", - inclTable[ii].name, inclTable[ii].begin, inclTable[ii].end); -} - - /* given the start and end addresses of a compilation unit (or a csect, at times) process its lines and create appropriate line vectors. */ @@ -537,6 +526,8 @@ process_linenos (start, end) first_fun_line_offset = 0; if (inclIndx == 0) + /* All source lines were in the main source file. None in include files. */ + enter_line_range (&main_subfile, offset, 0, start, end, &main_source_baseline); @@ -601,7 +592,7 @@ process_linenos (start, end) current_subfile->line_vector_length = current_subfile->line_vector->nitems; - + } /* Now, process included files' line numbers. */ @@ -654,11 +645,6 @@ process_linenos (start, end) start_subfile (pop_subfile (), (char*)0); } } - } - else - /* I am not sure this logic is correct. There might be no lines in the - main file, whereas there are some in included ones. FIXMEibm */ - current_subfile->line_vector = NULL; return_after_cleanup: @@ -761,11 +747,13 @@ retrieve_tracebackinfo (abfd, textsec, cs) /* keep reading blocks of data from the text section, until finding a zero word and a traceback table. */ - while (bfd_get_section_contents (abfd, textsec, buffer, - (file_ptr)(functionstart + bytesread), + while ( bufferbytes = ( (TBTABLE_BUFSIZ < (textsec->_raw_size - functionstart - bytesread)) ? - TBTABLE_BUFSIZ : (textsec->_raw_size - functionstart - bytesread)))) + TBTABLE_BUFSIZ : (textsec->_raw_size - functionstart - bytesread)) + + && bfd_get_section_contents (abfd, textsec, buffer, + (file_ptr)(functionstart + bytesread), bufferbytes)) { bytesread += bufferbytes; pinsn = (int*) buffer; @@ -1019,6 +1007,7 @@ read_xcoff_symtab (objfile, nsyms) int next_file_symnum = -1; int just_started = 1; int depth = 0; + int toc_offset = 0; /* toc offset value in data section. */ int val; int fcn_last_line; int fcn_start_addr; @@ -1217,10 +1206,10 @@ read_xcoff_symtab (objfile, nsyms) uninitialized data will show up as XTY_CM/XMC_RW pair. */ case XMC_TC0: -#ifdef XCOFF_ADD_TOC_TO_LOADINFO - XCOFF_ADD_TOC_TO_LOADINFO (cs->c_value); -#endif - /* fall down to default case. */ + if (toc_offset) + warning ("More than one xmc_tc0 symbol found."); + toc_offset = cs->c_value; + continue; case XMC_TC : /* ignore toc entries */ default : /* any other XMC_XXX */ @@ -1585,6 +1574,12 @@ function_entry_point: free (symtbl); current_objfile = NULL; + + /* Record the toc offset value of this symbol table into ldinfo structure. + If no XMC_TC0 is found, toc_offset should be zero. Another place to obtain + this information would be file auxiliary header. */ + + xcoff_add_toc_to_loadinfo (toc_offset); } #define SYMBOL_DUP(SYMBOL1, SYMBOL2) \ @@ -2295,10 +2290,9 @@ aixcoff_symfile_read (objfile, addr, mainline) init_minimal_symbol_collection (); make_cleanup (discard_minimal_symbols, 0); -#ifdef XCOFF_INIT_LOADINFO + /* Initialize load info structure. */ if (mainline) - XCOFF_INIT_LOADINFO (); -#endif + xcoff_init_loadinfo (); /* Now that the executable file is positioned at symbol table, process it and define symbols accordingly. */ diff --git a/gdb/xm-rs6000.h b/gdb/xm-rs6000.h index f75cead2b9a..4b323c6a66a 100644 --- a/gdb/xm-rs6000.h +++ b/gdb/xm-rs6000.h @@ -60,12 +60,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define NO_SINGLE_STEP -/* Interface between xcoff symbol reading code and AIX shared library - handling code. FIXME, this probably needs generalizing. */ - -#define XCOFF_INIT_LOADINFO() xcoff_init_loadinfo() -#define XCOFF_ADD_TOC_TO_LOADINFO(x) xcoff_add_toc_to_loadinfo (x) - /* AIX's assembler doesn't grok dollar signs in identifiers. So we use dots instead. This item must be coordinated with G++. */ #undef CPLUS_MARKER -- 2.30.2