From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13549 invoked by alias); 5 Jun 2009 21:18:38 -0000 Received: (qmail 13524 invoked by uid 22791); 5 Jun 2009 21:18:36 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_22,J_CHICKENPOX_25,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtagate7.de.ibm.com (HELO mtagate7.de.ibm.com) (195.212.29.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 05 Jun 2009 21:18:30 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.14.3/8.13.8) with ESMTP id n55LIHnN164310 for ; Fri, 5 Jun 2009 21:18:17 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n55LIHpg3317804 for ; Fri, 5 Jun 2009 23:18:17 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n55LIHx2029035 for ; Fri, 5 Jun 2009 23:18:17 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n55LIGmw029014 for ; Fri, 5 Jun 2009 23:18:16 +0200 Message-Id: <200906052118.n55LIGmw029014@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 05 Jun 2009 23:18:16 +0200 Subject: [10/19] record_line To: gdb-patches@sourceware.org Date: Fri, 05 Jun 2009 21:18:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00127.txt.bz2 Hello, the record_line routine calls gdbarch_addr_bits_remove on the PC it is passed. As there is no appropriate objfile at hand in this routine, the following patch moves this operation up into the callers of record_line, which will use the objfile architecture of the file they are processing. Bye, Ulrich ChangeLog: * buildsym.c (record_line): Remove call to gdbarch_addr_bits_remove. * coffread.c (coff_symtab_read): Call gdbarch_addr_bits_remove before calling record_line. (enter_linenos): Likewise. * dbxread.c (process_one_symbol): Likewise. * dwarf2read.c (dwarf_decode_lines): Likewise. * mdebugread.c (psymtab_to_symtab_1): Likewise. * xcoffread.c (enter_line_range): Likewise. Index: gdb-head/gdb/buildsym.c =================================================================== --- gdb-head.orig/gdb/buildsym.c +++ gdb-head/gdb/buildsym.c @@ -731,8 +731,6 @@ record_line (struct subfile *subfile, in * sizeof (struct linetable_entry)))); } - pc = gdbarch_addr_bits_remove (current_gdbarch, pc); - /* Normally, we treat lines as unsorted. But the end of sequence marker is special. We sort line markers at the same PC by line number, so end of sequence markers (which have line == 0) appear Index: gdb-head/gdb/coffread.c =================================================================== --- gdb-head.orig/gdb/coffread.c +++ gdb-head/gdb/coffread.c @@ -1024,7 +1024,8 @@ coff_symtab_read (long symtab_offset, un for which we do not have any other statement-line-number. */ if (fcn_last_line == 1) record_line (current_subfile, fcn_first_line, - fcn_first_line_addr); + gdbarch_addr_bits_remove (gdbarch, + fcn_first_line_addr)); else enter_linenos (fcn_line_ptr, fcn_first_line, fcn_last_line, objfile); @@ -1350,6 +1351,7 @@ static void enter_linenos (long file_offset, int first_line, int last_line, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); char *rawptr; struct internal_lineno lptr; @@ -1382,9 +1384,12 @@ enter_linenos (long file_offset, int fir /* The next function, or the sentinel, will have L_LNNO32 zero; we exit. */ if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line) - record_line (current_subfile, first_line + L_LNNO32 (&lptr), - lptr.l_addr.l_paddr - + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))); + { + CORE_ADDR addr = lptr.l_addr.l_paddr; + addr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); + record_line (current_subfile, first_line + L_LNNO32 (&lptr), + gdbarch_addr_bits_remove (gdbarch, addr)); + } else break; } Index: gdb-head/gdb/dbxread.c =================================================================== --- gdb-head.orig/gdb/dbxread.c +++ gdb-head/gdb/dbxread.c @@ -2790,7 +2790,11 @@ process_one_symbol (int type, int desc, which may have an N_FUN stabs at the end of the function, but no N_SLINE stabs. */ if (sline_found_in_function) - record_line (current_subfile, 0, last_function_start + valu); + { + CORE_ADDR addr = last_function_start + valu; + record_line (current_subfile, 0, + gdbarch_addr_bits_remove (gdbarch, addr)); + } within_function = 0; new = pop_context (); @@ -3006,14 +3010,15 @@ no enclosing block")); if (within_function && sline_found_in_function == 0) { - if (processing_gcc_compilation == 2) - record_line (current_subfile, desc, last_function_start); - else - record_line (current_subfile, desc, valu); + CORE_ADDR addr = processing_gcc_compilation == 2 ? + last_function_start : valu; + record_line (current_subfile, desc, + gdbarch_addr_bits_remove (gdbarch, addr)); sline_found_in_function = 1; } else - record_line (current_subfile, desc, valu); + record_line (current_subfile, desc, + gdbarch_addr_bits_remove (gdbarch, valu)); break; case N_BCOMM: Index: gdb-head/gdb/dwarf2read.c =================================================================== --- gdb-head.orig/gdb/dwarf2read.c +++ gdb-head/gdb/dwarf2read.c @@ -7247,6 +7247,7 @@ dwarf_decode_lines (struct line_header * unsigned char op_code, extended_op, adj_opcode; CORE_ADDR baseaddr; struct objfile *objfile = cu->objfile; + struct gdbarch *gdbarch = get_objfile_arch (objfile); const int decode_for_pst_p = (pst != NULL); struct subfile *last_subfile = NULL, *first_subfile = current_subfile; @@ -7266,6 +7267,7 @@ dwarf_decode_lines (struct line_header * int is_stmt = lh->default_is_stmt; int basic_block = 0; int end_sequence = 0; + CORE_ADDR addr; if (!decode_for_pst_p && lh->num_file_names >= file) { @@ -7306,16 +7308,18 @@ dwarf_decode_lines (struct line_header * { lh->file_names[file - 1].included_p = 1; if (!decode_for_pst_p) - { - if (last_subfile != current_subfile) - { - if (last_subfile) - record_line (last_subfile, 0, address); - last_subfile = current_subfile; - } + { + if (last_subfile != current_subfile) + { + addr = gdbarch_addr_bits_remove (gdbarch, address); + if (last_subfile) + record_line (last_subfile, 0, addr); + last_subfile = current_subfile; + } /* Append row to matrix using current values. */ - record_line (current_subfile, line, - check_cu_functions (address, cu)); + addr = check_cu_functions (address, cu); + addr = gdbarch_addr_bits_remove (gdbarch, addr); + record_line (current_subfile, line, addr); } } basic_block = 1; @@ -7379,16 +7383,18 @@ dwarf_decode_lines (struct line_header * { lh->file_names[file - 1].included_p = 1; if (!decode_for_pst_p) - { - if (last_subfile != current_subfile) - { - if (last_subfile) - record_line (last_subfile, 0, address); - last_subfile = current_subfile; - } - record_line (current_subfile, line, - check_cu_functions (address, cu)); - } + { + if (last_subfile != current_subfile) + { + addr = gdbarch_addr_bits_remove (gdbarch, address); + if (last_subfile) + record_line (last_subfile, 0, addr); + last_subfile = current_subfile; + } + addr = check_cu_functions (address, cu); + addr = gdbarch_addr_bits_remove (gdbarch, addr); + record_line (current_subfile, line, addr); + } } basic_block = 0; break; @@ -7468,7 +7474,10 @@ dwarf_decode_lines (struct line_header * { lh->file_names[file - 1].included_p = 1; if (!decode_for_pst_p) - record_line (current_subfile, 0, address); + { + addr = gdbarch_addr_bits_remove (gdbarch, address); + record_line (current_subfile, 0, addr); + } } } Index: gdb-head/gdb/mdebugread.c =================================================================== --- gdb-head.orig/gdb/mdebugread.c +++ gdb-head/gdb/mdebugread.c @@ -3966,6 +3966,7 @@ psymtab_to_symtab_1 (struct partial_symt if (processing_gcc_compilation != 0) { + struct gdbarch *gdbarch = get_objfile_arch (pst->objfile); /* This symbol table contains stabs-in-ecoff entries. */ @@ -4060,7 +4061,8 @@ psymtab_to_symtab_1 (struct partial_symt { /* Handle encoded stab line number. */ valu += ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)); - record_line (current_subfile, sh.index, valu); + record_line (current_subfile, sh.index, + gdbarch_addr_bits_remove (gdbarch, valu)); } } else if (sh.st == stProc || sh.st == stStaticProc Index: gdb-head/gdb/xcoffread.c =================================================================== --- gdb-head.orig/gdb/xcoffread.c +++ gdb-head/gdb/xcoffread.c @@ -765,6 +765,8 @@ enter_line_range (struct subfile *subfil CORE_ADDR startaddr, /* offsets to line table */ CORE_ADDR endaddr, unsigned *firstLine) { + struct objfile *objfile = this_symtab_psymtab->objfile; + struct gdbarch *gdbarch = get_objfile_arch (objfile); unsigned int curoffset; CORE_ADDR addr; void *ext_lnno; @@ -777,7 +779,7 @@ enter_line_range (struct subfile *subfil return; curoffset = beginoffset; limit_offset = - ((struct coff_symfile_info *) this_symtab_psymtab->objfile->deprecated_sym_private) + ((struct coff_symfile_info *) objfile->deprecated_sym_private) ->max_lineno_offset; if (endoffset != 0) @@ -793,7 +795,7 @@ enter_line_range (struct subfile *subfil else limit_offset -= 1; - abfd = this_symtab_psymtab->objfile->obfd; + abfd = objfile->obfd; linesz = coff_data (abfd)->local_linesz; ext_lnno = alloca (linesz); @@ -807,8 +809,7 @@ enter_line_range (struct subfile *subfil addr = (int_lnno.l_lnno ? int_lnno.l_addr.l_paddr : read_symbol_nvalue (int_lnno.l_addr.l_symndx)); - addr += ANOFFSET (this_symtab_psymtab->objfile->section_offsets, - SECT_OFF_TEXT (this_symtab_psymtab->objfile)); + addr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); if (addr < startaddr || (endaddr && addr >= endaddr)) return; @@ -816,11 +817,12 @@ enter_line_range (struct subfile *subfil if (int_lnno.l_lnno == 0) { *firstLine = read_symbol_lineno (int_lnno.l_addr.l_symndx); - record_line (subfile, 0, addr); + record_line (subfile, 0, gdbarch_addr_bits_remove (gdbarch, addr)); --(*firstLine); } else - record_line (subfile, *firstLine + int_lnno.l_lnno, addr); + record_line (subfile, *firstLine + int_lnno.l_lnno, + gdbarch_addr_bits_remove (gdbarch, addr)); curoffset += linesz; } } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com