* [patch] Delete dwarf2read.c:check_cu_functions et.al.
@ 2011-12-06 18:37 Doug Evans
0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2011-12-06 18:37 UTC (permalink / raw)
To: gdb-patches
Hi.
I happened upon an oversight in check_cu_functions and when digging
deeper I discovered this code has effectively been disabled since
gdb 6.7.1 when we switched the order of reading line info and dies.
Since then the cached_fn list is empty when dwarf_decode_lines is called.
Approved by Daniel off list, but I'll wait a few more days before checking in.
Regression tested on amd64-linux.
2011-12-05 Doug Evans <dje@google.com>
* dwarf2read.c (struct dwarf2_cu): Delete members first_fn, last_fn,
cached_fn.
(struct function_range): Delete.
(initialize_cu_func_list, add_to_cu_func_list): Delete. All callers
updated.
(check_cu_functions): Ditto.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.584
diff -u -p -r1.584 dwarf2read.c
--- dwarf2read.c 2 Dec 2011 17:01:19 -0000 1.584
+++ dwarf2read.c 6 Dec 2011 00:30:08 -0000
@@ -346,8 +346,6 @@ struct dwarf2_cu
/* Non-zero if base_address has been set. */
int base_known;
- struct function_range *first_fn, *last_fn, *cached_fn;
-
/* The language we are debugging. */
enum language language;
const struct language_defn *language_defn;
@@ -701,14 +699,6 @@ struct die_info
struct attribute attrs[1];
};
-struct function_range
-{
- const char *name;
- CORE_ADDR lowpc, highpc;
- int seen_line;
- struct function_range *next;
-};
-
/* Get at parts of an attribute structure. */
#define DW_STRING(attr) ((attr)->u.str)
@@ -1241,11 +1231,6 @@ static struct abbrev_info *dwarf_alloc_a
static struct die_info *dwarf_alloc_die (struct dwarf2_cu *, int);
-static void initialize_cu_func_list (struct dwarf2_cu *);
-
-static void add_to_cu_func_list (const char *, CORE_ADDR, CORE_ADDR,
- struct dwarf2_cu *);
-
static void dwarf_decode_macros (struct line_header *, unsigned int,
char *, bfd *, struct dwarf2_cu *,
struct dwarf2_section_info *,
@@ -5545,12 +5530,6 @@ read_import_statement (struct die_info *
do_cleanups (cleanups);
}
-static void
-initialize_cu_func_list (struct dwarf2_cu *cu)
-{
- cu->first_fn = cu->last_fn = cu->cached_fn = NULL;
-}
-
/* Cleanup function for read_file_scope. */
static void
@@ -5685,8 +5664,6 @@ read_file_scope (struct die_info *die, s
record_debugformat ("DWARF 2");
record_producer (cu->producer);
- initialize_cu_func_list (cu);
-
handle_DW_AT_stmt_list (die, cu, comp_dir);
/* Process all dies in compilation unit. */
@@ -5811,28 +5788,6 @@ read_type_unit_scope (struct die_info *d
do_cleanups (back_to);
}
-static void
-add_to_cu_func_list (const char *name, CORE_ADDR lowpc, CORE_ADDR highpc,
- struct dwarf2_cu *cu)
-{
- struct function_range *thisfn;
-
- thisfn = (struct function_range *)
- obstack_alloc (&cu->comp_unit_obstack, sizeof (struct function_range));
- thisfn->name = name;
- thisfn->lowpc = lowpc;
- thisfn->highpc = highpc;
- thisfn->seen_line = 0;
- thisfn->next = NULL;
-
- if (cu->last_fn == NULL)
- cu->first_fn = thisfn;
- else
- cu->last_fn->next = thisfn;
-
- cu->last_fn = thisfn;
-}
-
/* qsort helper for inherit_abstract_dies. */
static int
@@ -6027,9 +5982,6 @@ read_func_scope (struct die_info *die, s
lowpc += baseaddr;
highpc += baseaddr;
- /* Record the function range for dwarf_decode_lines. */
- add_to_cu_func_list (name, lowpc, highpc, cu);
-
/* If we have any template arguments, then we must allocate a
different sort of symbol. */
for (child_die = die->child; child_die; child_die = sibling_die (child_die))
@@ -11053,52 +11005,6 @@ dwarf_decode_line_header (unsigned int o
return lh;
}
-/* This function exists to work around a bug in certain compilers
- (particularly GCC 2.95), in which the first line number marker of a
- function does not show up until after the prologue, right before
- the second line number marker. This function shifts ADDRESS down
- to the beginning of the function if necessary, and is called on
- addresses passed to record_line. */
-
-static CORE_ADDR
-check_cu_functions (CORE_ADDR address, struct dwarf2_cu *cu)
-{
- struct function_range *fn;
-
- /* Find the function_range containing address. */
- if (!cu->first_fn)
- return address;
-
- if (!cu->cached_fn)
- cu->cached_fn = cu->first_fn;
-
- fn = cu->cached_fn;
- while (fn)
- if (fn->lowpc <= address && fn->highpc > address)
- goto found;
- else
- fn = fn->next;
-
- fn = cu->first_fn;
- while (fn && fn != cu->cached_fn)
- if (fn->lowpc <= address && fn->highpc > address)
- goto found;
- else
- fn = fn->next;
-
- return address;
-
- found:
- if (fn->seen_line)
- return address;
- if (address != fn->lowpc)
- complaint (&symfile_complaints,
- _("misplaced first line number at 0x%lx for '%s'"),
- (unsigned long) address, fn->name);
- fn->seen_line = 1;
- return fn->lowpc;
-}
-
/* Subroutine of dwarf_decode_lines to simplify it.
Return the file name of the psymtab for included file FILE_INDEX
in line header LH of PST.
@@ -11296,8 +11202,7 @@ dwarf_decode_lines (struct line_header *
last_subfile = current_subfile;
}
/* Append row to matrix using current values. */
- addr = check_cu_functions (address, cu);
- addr = gdbarch_addr_bits_remove (gdbarch, addr);
+ addr = gdbarch_addr_bits_remove (gdbarch, address);
(*p_record_line) (current_subfile, line, addr);
}
}
@@ -11395,8 +11300,7 @@ dwarf_decode_lines (struct line_header *
(*p_record_line) (last_subfile, 0, addr);
last_subfile = current_subfile;
}
- addr = check_cu_functions (address, cu);
- addr = gdbarch_addr_bits_remove (gdbarch, addr);
+ addr = gdbarch_addr_bits_remove (gdbarch, address);
(*p_record_line) (current_subfile, line, addr);
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-12-06 18:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-06 18:37 [patch] Delete dwarf2read.c:check_cu_functions et.al Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).