From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17892 invoked by alias); 18 Sep 2002 20:51:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17879 invoked from network); 18 Sep 2002 20:51:38 -0000 Received: from unknown (HELO zenia.red-bean.com) (66.244.67.22) by sources.redhat.com with SMTP; 18 Sep 2002 20:51:38 -0000 Received: (from jimb@localhost) by zenia.red-bean.com (8.11.6/8.11.6) id g8IKbLL10812; Wed, 18 Sep 2002 15:37:21 -0500 Date: Wed, 18 Sep 2002 13:51:00 -0000 Message-Id: <200209182037.g8IKbLL10812@zenia.red-bean.com> From: Jim Blandy To: gdb-patches@sources.redhat.com Subject: PATCH: Revert change of 2001-10-23 X-SW-Source: 2002-09/txt/msg00425.txt.bz2 2002-09-18 Jim Blandy * dbxread.c, mdebugread.c: Revert my change of 2001-10-23. Moving texthigh and textlow to reader-specific structs caused objfile_relocate to miss them. This is fixable, but the work that the change was supposed to prepare GDB for never got done anyway. Index: gdb/dbxread.c =================================================================== RCS file: /cvs/src/src/gdb/dbxread.c,v retrieving revision 1.34 diff -c -r1.34 dbxread.c *** gdb/dbxread.c 29 Jul 2002 22:55:26 -0000 1.34 --- gdb/dbxread.c 18 Sep 2002 20:05:17 -0000 *************** *** 76,89 **** struct symloc { - /* The start (inclusive) and end (exclusive) addresses for this - partial symtab's text. STABS doesn't reliably give us nice - start and end addresses for each function. Instead, we are - told the addresses of various boundary points, and we have to - gather those together to build ranges. These are our running - best guess as to the range of text addresses for this psymtab. */ - CORE_ADDR textlow, texthigh; - /* Offset within the file symbol table of first local symbol for this file. */ --- 76,81 ---- *************** *** 112,119 **** #define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff) #define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen) #define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private)) - #define TEXTLOW(p) (SYMLOC(p)->textlow) - #define TEXTHIGH(p) (SYMLOC(p)->texthigh) #define SYMBOL_SIZE(p) (SYMLOC(p)->symbol_size) #define SYMBOL_OFFSET(p) (SYMLOC(p)->symbol_offset) #define STRING_OFFSET(p) (SYMLOC(p)->string_offset) --- 104,109 ---- *************** *** 607,625 **** read_dbx_dynamic_symtab (objfile); - /* Take the text ranges the STABS partial symbol scanner computed - for each of the psymtabs and convert it into the canonical form - for psymtabs. */ - { - struct partial_symtab *p; - - ALL_OBJFILE_PSYMTABS (objfile, p) - { - p->textlow = TEXTLOW (p); - p->texthigh = TEXTHIGH (p); - } - } - /* Install any minimal symbols that have been collected as the current minimal symbols for this objfile. */ --- 597,602 ---- *************** *** 1445,1456 **** if (past_first_source_file && pst /* The gould NP1 uses low values for .o and -l symbols which are not the address. */ ! && nlist.n_value >= TEXTLOW (pst)) { end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, ! nlist.n_value > TEXTHIGH (pst) ! ? nlist.n_value : TEXTHIGH (pst), dependency_list, dependencies_used, textlow_not_set); pst = (struct partial_symtab *) 0; includes_used = 0; --- 1422,1433 ---- if (past_first_source_file && pst /* The gould NP1 uses low values for .o and -l symbols which are not the address. */ ! && nlist.n_value >= pst->textlow) { end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, ! nlist.n_value > pst->texthigh ! ? nlist.n_value : pst->texthigh, dependency_list, dependencies_used, textlow_not_set); pst = (struct partial_symtab *) 0; includes_used = 0; *************** *** 1572,1578 **** { end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, ! valu > TEXTHIGH (pst) ? valu : TEXTHIGH (pst), dependency_list, dependencies_used, prev_textlow_not_set); pst = (struct partial_symtab *) 0; --- 1549,1555 ---- { end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, ! valu > pst->texthigh ? valu : pst->texthigh, dependency_list, dependencies_used, prev_textlow_not_set); pst = (struct partial_symtab *) 0; *************** *** 1731,1738 **** function relative stabs, or the address of the function's end for old style stabs. */ valu = nlist.n_value + last_function_start; ! if (TEXTHIGH (pst) == 0 || valu > TEXTHIGH (pst)) ! TEXTHIGH (pst) = valu; break; } --- 1708,1715 ---- function relative stabs, or the address of the function's end for old style stabs. */ valu = nlist.n_value + last_function_start; ! if (pst->texthigh == 0 || valu > pst->texthigh) ! pst->texthigh = valu; break; } *************** *** 1934,1940 **** } if (pst && textlow_not_set) { ! TEXTLOW (pst) = nlist.n_value; textlow_not_set = 0; } #endif --- 1911,1917 ---- } if (pst && textlow_not_set) { ! pst->textlow = nlist.n_value; textlow_not_set = 0; } #endif *************** *** 1950,1961 **** the partial symbol table. */ if (pst && (textlow_not_set ! || (nlist.n_value < TEXTLOW (pst) && (nlist.n_value != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))))) { ! TEXTLOW (pst) = nlist.n_value; textlow_not_set = 0; } add_psymbol_to_list (namestring, p - namestring, --- 1927,1938 ---- the partial symbol table. */ if (pst && (textlow_not_set ! || (nlist.n_value < pst->textlow && (nlist.n_value != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))))) { ! pst->textlow = nlist.n_value; textlow_not_set = 0; } add_psymbol_to_list (namestring, p - namestring, *************** *** 1999,2005 **** } if (pst && textlow_not_set) { ! TEXTLOW (pst) = nlist.n_value; textlow_not_set = 0; } #endif --- 1976,1982 ---- } if (pst && textlow_not_set) { ! pst->textlow = nlist.n_value; textlow_not_set = 0; } #endif *************** *** 2015,2026 **** the partial symbol table. */ if (pst && (textlow_not_set ! || (nlist.n_value < TEXTLOW (pst) && (nlist.n_value != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))))) { ! TEXTLOW (pst) = nlist.n_value; textlow_not_set = 0; } add_psymbol_to_list (namestring, p - namestring, --- 1992,2003 ---- the partial symbol table. */ if (pst && (textlow_not_set ! || (nlist.n_value < pst->textlow && (nlist.n_value != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))))) { ! pst->textlow = nlist.n_value; textlow_not_set = 0; } add_psymbol_to_list (namestring, p - namestring, *************** *** 2132,2138 **** case N_ENDM: #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Solaris 2 end of module, finish current partial symbol table. ! end_psymtab will set TEXTHIGH (pst) to the proper value, which is necessary if a module compiled without debugging info follows this module. */ if (pst) --- 2109,2115 ---- case N_ENDM: #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Solaris 2 end of module, finish current partial symbol table. ! end_psymtab will set pst->texthigh to the proper value, which is necessary if a module compiled without debugging info follows this module. */ if (pst) *************** *** 2212,2218 **** end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, ! text_end > TEXTHIGH (pst) ? text_end : TEXTHIGH (pst), dependency_list, dependencies_used, textlow_not_set); } --- 2189,2195 ---- end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, ! text_end > pst->texthigh ? text_end : pst->texthigh, dependency_list, dependencies_used, textlow_not_set); } *************** *** 2238,2245 **** result->read_symtab_private = (char *) obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); - TEXTLOW (result) = result->textlow; - TEXTHIGH (result) = result->texthigh; LDSYMOFF (result) = ldsymoff; result->read_symtab = dbx_psymtab_to_symtab; SYMBOL_SIZE (result) = symbol_size; --- 2215,2220 ---- *************** *** 2275,2281 **** if (capping_symbol_offset != -1) LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst); ! TEXTHIGH (pst) = capping_text; #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Under Solaris, the N_SO symbols always have a value of 0, --- 2250,2256 ---- if (capping_symbol_offset != -1) LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst); ! pst->texthigh = capping_text; #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Under Solaris, the N_SO symbols always have a value of 0, *************** *** 2293,2299 **** a reliable texthigh by taking the address plus size of the last function in the file. */ ! if (TEXTHIGH (pst) == 0 && last_function_name) { char *p; int n; --- 2268,2274 ---- a reliable texthigh by taking the address plus size of the last function in the file. */ ! if (pst->texthigh == 0 && last_function_name) { char *p; int n; *************** *** 2319,2332 **** } if (minsym) ! TEXTHIGH (pst) = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym); last_function_name = NULL; } /* this test will be true if the last .o file is only data */ if (textlow_not_set) ! TEXTLOW (pst) = TEXTHIGH (pst); else { struct partial_symtab *p1; --- 2294,2307 ---- } if (minsym) ! pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym); last_function_name = NULL; } /* this test will be true if the last .o file is only data */ if (textlow_not_set) ! pst->textlow = pst->texthigh; else { struct partial_symtab *p1; *************** *** 2339,2350 **** ALL_OBJFILE_PSYMTABS (objfile, p1) { ! if (TEXTHIGH (p1) == 0 && TEXTLOW (p1) != 0 && p1 != pst) { ! TEXTHIGH (p1) = TEXTLOW (pst); /* if this file has only data, then make textlow match texthigh */ ! if (TEXTLOW (p1) == 0) ! TEXTLOW (p1) = TEXTHIGH (p1); } } } --- 2314,2325 ---- ALL_OBJFILE_PSYMTABS (objfile, p1) { ! if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst) { ! p1->texthigh = pst->textlow; /* if this file has only data, then make textlow match texthigh */ ! if (p1->textlow == 0) ! p1->textlow = p1->texthigh; } } } *************** *** 2381,2388 **** sizeof (struct symloc)); LDSYMOFF (subpst) = LDSYMLEN (subpst) = ! TEXTLOW (subpst) = ! TEXTHIGH (subpst) = 0; /* We could save slight bits of space by only making one of these, shared by the entire set of include files. FIXME-someday. */ --- 2356,2363 ---- sizeof (struct symloc)); LDSYMOFF (subpst) = LDSYMLEN (subpst) = ! subpst->textlow = ! subpst->texthigh = 0; /* We could save slight bits of space by only making one of these, shared by the entire set of include files. FIXME-someday. */ *************** *** 2550,2557 **** objfile = pst->objfile; sym_offset = LDSYMOFF (pst); sym_size = LDSYMLEN (pst); ! text_offset = TEXTLOW (pst); ! text_size = TEXTHIGH (pst) - TEXTLOW (pst); /* This cannot be simply objfile->section_offsets because of elfstab_offset_sections() which initializes the psymtab section offsets information in a special way, and that is different from --- 2525,2532 ---- objfile = pst->objfile; sym_offset = LDSYMOFF (pst); sym_size = LDSYMLEN (pst); ! text_offset = pst->textlow; ! text_size = pst->texthigh - pst->textlow; /* This cannot be simply objfile->section_offsets because of elfstab_offset_sections() which initializes the psymtab section offsets information in a special way, and that is different from *************** *** 2696,2708 **** /* In a Solaris elf file, this variable, which comes from the value of the N_SO symbol, will still be 0. Luckily, text_offset, ! which comes from TEXTLOW (pst) is correct. */ if (last_source_start_addr == 0) last_source_start_addr = text_offset; /* In reordered executables last_source_start_addr may not be the lower bound for this symtab, instead use text_offset which comes ! from TEXTLOW (pst) which is correct. */ if (last_source_start_addr > text_offset) last_source_start_addr = text_offset; --- 2671,2683 ---- /* In a Solaris elf file, this variable, which comes from the value of the N_SO symbol, will still be 0. Luckily, text_offset, ! which comes from pst->textlow is correct. */ if (last_source_start_addr == 0) last_source_start_addr = text_offset; /* In reordered executables last_source_start_addr may not be the lower bound for this symtab, instead use text_offset which comes ! from pst->textlow which is correct. */ if (last_source_start_addr > text_offset) last_source_start_addr = text_offset; Index: gdb/mdebugread.c =================================================================== RCS file: /cvs/src/src/gdb/mdebugread.c,v retrieving revision 1.28 diff -c -r1.28 mdebugread.c *** gdb/mdebugread.c 29 Jul 2002 22:55:26 -0000 1.28 --- gdb/mdebugread.c 18 Sep 2002 20:05:21 -0000 *************** *** 106,116 **** struct symloc { - /* Our running best guess as to the range of text addresses for - this psymtab. After we've read everything in, we use this to - build pst->text_addrs. */ - CORE_ADDR textlow, texthigh; - /* Index of the FDR that this psymtab represents. */ int fdr_idx; /* The BFD that the psymtab was created from. */ --- 106,111 ---- *************** *** 126,133 **** }; #define PST_PRIVATE(p) ((struct symloc *)(p)->read_symtab_private) - #define TEXTLOW(p) (PST_PRIVATE(p)->textlow) - #define TEXTHIGH(p) (PST_PRIVATE(p)->texthigh) #define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx) #define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd) #define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap) --- 121,126 ---- *************** *** 497,515 **** parse_partial_symbols (objfile); - /* Take the text ranges the partial symbol scanner computed for each - of the psymtabs and convert it into the canonical form for - psymtabs. */ - { - struct partial_symtab *p; - - ALL_OBJFILE_PSYMTABS (objfile, p) - { - p->textlow = TEXTLOW (p); - p->texthigh = TEXTHIGH (p); - } - } - #if 0 /* Check to make sure file was compiled with -g. If not, warn the user of this limitation. */ --- 490,495 ---- *************** *** 2169,2175 **** halt = base + fh->cbLine; base += pr->cbLineOffset; ! adr = TEXTLOW (pst) + pr->adr - lowest_pdr_addr; l = adr >> 2; /* in words */ for (lineno = pr->lnLow; base < halt;) --- 2149,2155 ---- halt = base + fh->cbLine; base += pr->cbLineOffset; ! adr = pst->textlow + pr->adr - lowest_pdr_addr; l = adr >> 2; /* in words */ for (lineno = pr->lnLow; base < halt;) *************** *** 2550,2557 **** memset (pst->read_symtab_private, 0, sizeof (struct symloc)); save_pst = pst; - TEXTLOW (pst) = pst->textlow; - TEXTHIGH (pst) = pst->texthigh; FDR_IDX (pst) = f_idx; CUR_BFD (pst) = cur_bfd; DEBUG_SWAP (pst) = debug_swap; --- 2530,2535 ---- *************** *** 2587,2593 **** psymtab_language = prev_language; PST_PRIVATE (pst)->pst_language = psymtab_language; ! TEXTHIGH (pst) = TEXTLOW (pst); /* For stabs-in-ecoff files, the second symbol must be @stab. This symbol is emitted by mips-tfile to signal that the --- 2565,2571 ---- psymtab_language = prev_language; PST_PRIVATE (pst)->pst_language = psymtab_language; ! pst->texthigh = pst->textlow; /* For stabs-in-ecoff files, the second symbol must be @stab. This symbol is emitted by mips-tfile to signal that the *************** *** 2654,2663 **** /* Kludge for Irix 5.2 zero fh->adr. */ if (!relocatable ! && (TEXTLOW (pst) == 0 || procaddr < TEXTLOW (pst))) ! TEXTLOW (pst) = procaddr; ! if (high > TEXTHIGH (pst)) ! TEXTHIGH (pst) = high; } } else if (sh.st == stStatic) --- 2632,2641 ---- /* Kludge for Irix 5.2 zero fh->adr. */ if (!relocatable ! && (pst->textlow == 0 || procaddr < pst->textlow)) ! pst->textlow = procaddr; ! if (high > pst->texthigh) ! pst->texthigh = high; } } else if (sh.st == stStatic) *************** *** 3231,3240 **** case N_ENDM: #ifdef SOFUN_ADDRESS_MAYBE_MISSING ! /* Solaris 2 end of module, finish current partial symbol table. ! END_PSYMTAB will set TEXTHIGH (pst) to the proper value, which ! is necessary if a module compiled without debugging info ! follows this module. */ if (pst) { pst = (struct partial_symtab *) 0; --- 3209,3219 ---- case N_ENDM: #ifdef SOFUN_ADDRESS_MAYBE_MISSING ! /* Solaris 2 end of module, finish current partial ! symbol table. END_PSYMTAB will set ! pst->texthigh to the proper value, which is ! necessary if a module compiled without ! debugging info follows this module. */ if (pst) { pst = (struct partial_symtab *) 0; *************** *** 3245,3252 **** continue; case N_RBRAC: ! if (sh.value > TEXTHIGH (save_pst)) ! TEXTHIGH (save_pst) = sh.value; continue; case N_EINCL: case N_DSLINE: --- 3224,3231 ---- continue; case N_RBRAC: ! if (sh.value > save_pst->texthigh) ! save_pst->texthigh = sh.value; continue; case N_EINCL: case N_DSLINE: *************** *** 3413,3424 **** /* Kludge for Irix 5.2 zero fh->adr. */ if (!relocatable ! && (TEXTLOW (pst) == 0 || procaddr < TEXTLOW (pst))) ! TEXTLOW (pst) = procaddr; high = procaddr + sh.value; ! if (high > TEXTHIGH (pst)) ! TEXTHIGH (pst) = high; continue; case stStatic: /* Variable */ --- 3392,3403 ---- /* Kludge for Irix 5.2 zero fh->adr. */ if (!relocatable ! && (pst->textlow == 0 || procaddr < pst->textlow)) ! pst->textlow = procaddr; high = procaddr + sh.value; ! if (high > pst->texthigh) ! pst->texthigh = high; continue; case stStatic: /* Variable */ *************** *** 3592,3607 **** empty and put on the free list. */ fdr_to_pst[f_idx].pst = end_psymtab (save_pst, psymtab_include_list, includes_used, ! -1, TEXTHIGH (save_pst), dependency_list, dependencies_used, textlow_not_set); includes_used = 0; dependencies_used = 0; ! if (objfile->ei.entry_point >= TEXTLOW (save_pst) && ! objfile->ei.entry_point < TEXTHIGH (save_pst)) { ! objfile->ei.entry_file_lowpc = TEXTLOW (save_pst); ! objfile->ei.entry_file_highpc = TEXTHIGH (save_pst); } /* The objfile has its functions reordered if this partial symbol --- 3571,3586 ---- empty and put on the free list. */ fdr_to_pst[f_idx].pst = end_psymtab (save_pst, psymtab_include_list, includes_used, ! -1, save_pst->texthigh, dependency_list, dependencies_used, textlow_not_set); includes_used = 0; dependencies_used = 0; ! if (objfile->ei.entry_point >= save_pst->textlow && ! objfile->ei.entry_point < save_pst->texthigh) { ! objfile->ei.entry_file_lowpc = save_pst->textlow; ! objfile->ei.entry_file_highpc = save_pst->texthigh; } /* The objfile has its functions reordered if this partial symbol *************** *** 3617,3631 **** other cases. */ save_pst = fdr_to_pst[f_idx].pst; if (save_pst != NULL ! && TEXTLOW (save_pst) != 0 && !(objfile->flags & OBJF_REORDERED)) { ALL_OBJFILE_PSYMTABS (objfile, pst) { if (save_pst != pst ! && TEXTLOW (save_pst) >= TEXTLOW (pst) ! && TEXTLOW (save_pst) < TEXTHIGH (pst) ! && TEXTHIGH (save_pst) > TEXTHIGH (pst)) { objfile->flags |= OBJF_REORDERED; break; --- 3596,3610 ---- other cases. */ save_pst = fdr_to_pst[f_idx].pst; if (save_pst != NULL ! && save_pst->textlow != 0 && !(objfile->flags & OBJF_REORDERED)) { ALL_OBJFILE_PSYMTABS (objfile, pst) { if (save_pst != pst ! && save_pst->textlow >= pst->textlow ! && save_pst->textlow < pst->texthigh ! && save_pst->texthigh > pst->texthigh) { objfile->flags |= OBJF_REORDERED; break; *************** *** 3829,3835 **** /* Do nothing if this is a dummy psymtab. */ if (pst->n_global_syms == 0 && pst->n_static_syms == 0 ! && TEXTLOW (pst) == 0 && TEXTHIGH (pst) == 0) return; /* Now read the symbols for this symtab */ --- 3808,3814 ---- /* Do nothing if this is a dummy psymtab. */ if (pst->n_global_syms == 0 && pst->n_static_syms == 0 ! && pst->textlow == 0 && pst->texthigh == 0) return; /* Now read the symbols for this symtab */ *************** *** 3977,3983 **** if (! last_symtab_ended) { ! st = end_symtab (TEXTHIGH (pst), pst->objfile, SECT_OFF_TEXT (pst->objfile)); end_stabs (); } --- 3956,3962 ---- if (! last_symtab_ended) { ! st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT (pst->objfile)); end_stabs (); } *************** *** 4067,4073 **** top_stack->cur_st = st; top_stack->cur_block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (st), STATIC_BLOCK); ! BLOCK_START (top_stack->cur_block) = TEXTLOW (pst); BLOCK_END (top_stack->cur_block) = 0; top_stack->blocktype = stFile; top_stack->maxsyms = 2 * f_max; --- 4046,4052 ---- top_stack->cur_st = st; top_stack->cur_block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (st), STATIC_BLOCK); ! BLOCK_START (top_stack->cur_block) = pst->textlow; BLOCK_END (top_stack->cur_block) = 0; top_stack->blocktype = stFile; top_stack->maxsyms = 2 * f_max;