aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.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/parse.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/parse.c')
-rw-r--r--gdb/parse.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 09ef1df..734739a 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -400,39 +400,46 @@ write_exp_msymbol (struct minimal_symbol *msymbol,
struct type *text_symbol_type,
struct type *data_symbol_type)
{
- struct gdbarch *gdbarch = current_gdbarch;
- CORE_ADDR addr;
+ struct objfile *objfile = msymbol_objfile (msymbol);
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+
+ CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (msymbol);
+ asection *bfd_section = SYMBOL_BFD_SECTION (msymbol);
+ enum minimal_symbol_type type = msymbol->type;
+ CORE_ADDR pc;
+
+ /* 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, addr, &current_target);
+ if (pc != addr)
+ {
+ /* In this case, assume we have a code symbol instead of
+ a data symbol. */
+ type = mst_text;
+ bfd_section = NULL;
+ addr = pc;
+ }
+
+ if (overlay_debugging)
+ addr = symbol_overlayed_address (addr, bfd_section);
write_exp_elt_opcode (OP_LONG);
/* Let's make the type big enough to hold a 64-bit address. */
write_exp_elt_type (builtin_type_CORE_ADDR);
-
- addr = SYMBOL_VALUE_ADDRESS (msymbol);
- if (overlay_debugging)
- addr = symbol_overlayed_address (addr, SYMBOL_BFD_SECTION (msymbol));
write_exp_elt_longcst ((LONGEST) addr);
-
write_exp_elt_opcode (OP_LONG);
- if (SYMBOL_BFD_SECTION (msymbol)
- && SYMBOL_BFD_SECTION (msymbol)->flags & SEC_THREAD_LOCAL)
+ if (bfd_section && bfd_section->flags & SEC_THREAD_LOCAL)
{
- bfd *bfd = SYMBOL_BFD_SECTION (msymbol)->owner;
- struct objfile *ofp;
-
- ALL_OBJFILES (ofp)
- if (ofp->obfd == bfd)
- break;
-
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
- write_exp_elt_objfile (ofp);
+ write_exp_elt_objfile (objfile);
write_exp_elt_type (builtin_type (gdbarch)->nodebug_tls_symbol);
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
return;
}
write_exp_elt_opcode (UNOP_MEMVAL);
- switch (msymbol->type)
+ switch (type)
{
case mst_text:
case mst_file_text: