aboutsummaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-05-03 00:37:35 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-05-03 00:37:35 +0000
commitbccdca4a5f7b9879d67a35d78063a9ac3b5f5104 (patch)
tree6f5c583a8507dcac9b3a08aa00929c6c123af41a /gdb/linespec.c
parent0315afbc1dfcbdd1af230eb7b6d5193634bc254a (diff)
downloadgdb-bccdca4a5f7b9879d67a35d78063a9ac3b5f5104.zip
gdb-bccdca4a5f7b9879d67a35d78063a9ac3b5f5104.tar.gz
gdb-bccdca4a5f7b9879d67a35d78063a9ac3b5f5104.tar.bz2
* linespec.c: Include "target.h".
(minsym_found): Handle minimal symbols pointing to function descriptors. Use find_function_start_pc. * minsyms.c (msymbol_objfile): New function. * parse.c (write_exp_msymbol): Handle minimal symbols pointing to function descriptors. * symtab.c (fixup_section): Only use minimal symbol at the same address to determine section of a symbol. (find_function_start_pc): New function. (find_function_start_sal): Use it. * symtab.h (msymbol_objfile): Add prototype. (find_function_start_pc): Likewise. * value.c: Include "objfiles.h". (value_fn_field): Handle minimal symbols pointing to function descriptors. * Makefile.in (linespec.o): Update dependencies. (value.o): Likewise.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 9ffbfd7..c63f162 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -38,6 +38,7 @@
#include "language.h"
#include "interps.h"
#include "mi/mi-cmds.h"
+#include "target.h"
/* We share this one with symtab.c, but it is not exported widely. */
@@ -1846,21 +1847,32 @@ symbol_found (int funfirstline, char ***canonical, char *copy,
static struct symtabs_and_lines
minsym_found (int funfirstline, struct minimal_symbol *msymbol)
{
+ struct objfile *objfile = msymbol_objfile (msymbol);
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct symtabs_and_lines values;
+ CORE_ADDR pc;
values.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));
values.sals[0] = find_pc_sect_line (SYMBOL_VALUE_ADDRESS (msymbol),
(struct bfd_section *) 0, 0);
values.sals[0].section = SYMBOL_BFD_SECTION (msymbol);
+
+ /* The minimal symbol might point to a function descriptor;
+ resolve it to the actual code address instead. */
+ pc = gdbarch_convert_from_func_ptr_addr (gdbarch,
+ values.sals[0].pc,
+ &current_target);
+ if (pc != values.sals[0].pc)
+ values.sals[0] = find_pc_sect_line (pc, NULL, 0);
+
if (funfirstline)
{
struct symtab_and_line sal;
- values.sals[0].pc
- += gdbarch_deprecated_function_start_offset (current_gdbarch);
- values.sals[0].pc = gdbarch_skip_prologue
- (current_gdbarch, values.sals[0].pc);
+ values.sals[0].pc = find_function_start_pc (gdbarch,
+ values.sals[0].pc,
+ values.sals[0].section);
sal = find_pc_sect_line (values.sals[0].pc, values.sals[0].section, 0);