From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org
Subject: [10/19] record_line
Date: Fri, 05 Jun 2009 21:18:00 -0000 [thread overview]
Message-ID: <200906052118.n55LIGmw029014@d12av02.megacenter.de.ibm.com> (raw)
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
next reply other threads:[~2009-06-05 21:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-05 21:18 Ulrich Weigand [this message]
2009-06-06 1:15 ` Eli Zaretskii
2009-06-08 14:53 ` Ulrich Weigand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200906052118.n55LIGmw029014@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox