From: Stu Grossman Date: Sat, 4 Jan 1997 00:33:01 +0000 (+0000) Subject: * Makefile.in configure configure.in: Remove ENABLE_CLIBS, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4c681116af400ae163c0772ffca9e7fdc92e036c;p=binutils-gdb.git * Makefile.in configure configure.in: Remove ENABLE_CLIBS, ENABLE_OBS, and THREAD_DB_OBS. These are consolidated into LIBS and CONFIG_OBS. * configure configure.in: Clean up test cases around thread support. start-sanitize-v850 * configure.tgt (v850-*-*): Include v850ice.o and v850.lib if host is Windows. end-sanitize-v850 * c-valprint.c ch-valprint.c cp-valprint.c eval.c expprint.c printcmd.c valops.c value.h values.c: Add bfd_section arg to value_at and value_at_lazy. * coffread.c dbxread.c elfread.c mdebugread.c minsyms.c symtab.h: Add bfd_section arg to prim_record_minimal_symbol_and_info. * corefile.c gdbcore.h printcmd.c valops.c: Use read_memory_section instead of read_memory. It takes a bfd_section arg. * coffread.c dbxread.c elfread.c gdb-stabs.h objfiles.h: Remove unnecessary cast for assignment of struct dbx_symfile_info. Struct objfile now uses a real pointer instead of PTR for this element. * dbxread.c (dbx_symfile_init): Stash bfd section pointers for text, data and bss into dbx_symfile_info. * exec.c (xfer_memory): Handle transfers for user-specified sections. * findvar.c (read_var_value locate_var_value): Copy bfd section from the symbol to the value. * gdb-stabs.h: Add section pointers for text, data and bss sections. * maint.c (translate address command): Add test code for overlay address translation. * printcmd.c (do_examine do_one_display): Now takes a bfd section arg. * (print_formatted x_command): Record current section along with current address for repeated commands. * sparc-nat.c (fetch_inferior_registers): Change target_xfer_memory to target_{read write}_memory to allow changes to target_xfer_memory interface for section info. * symmisc.c (dump_msymbols print_symbol): Print section assocaited with symbol. * symtab.c (fixup_symbol_section): New routine to add section info to symbols returned by lookup_symbol. * symtab.h (struct general_symbol_info): Add bfd section to symbols. * target.c target.h (target_xfer_memory): Add bfd section to args. * (target_read_memory_section): New routine to read data from a specific section. * (target_memory_bfd_section): New global variable to pass bfd section in to targets. * valarith.c (value_add value_addr value_array): Preserve bfd section when computing new value. * value.h (struct value): Add bfd section to values. * values.c (allocate_value value_copy): Initialize/preserve bfd section. * (unpack_double): Clean up _MSC_VER conditionals to remove duplicate code. start-sanitize-v850 * v850ice.c: New module to support communication with NEC's PC-based ICE. * config/v850/tm-v850.h (REGISTER_NAMES): Replace sp, gp, fp, and ep names with rxx names. sp and fp are renamed via a different mechanism. end-sanitize-v850 --- diff --git a/gdb/config/v850/tm-v850.h b/gdb/config/v850/tm-v850.h index bc37144a3c6..7afd568e8dd 100644 --- a/gdb/config/v850/tm-v850.h +++ b/gdb/config/v850/tm-v850.h @@ -23,10 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NUM_REGS 65 #define REGISTER_NAMES \ -{ "r0", "r1", "r2", "sp", "gp", "r5", "r6", "r7", \ +{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ - "r24", "r25", "r26", "r27", "r28", "fp", "ep", "r31", \ + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \ \ "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", \ "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", \ diff --git a/gdb/gdb-stabs.h b/gdb/gdb-stabs.h index fabe17c2fe8..1ad782abdca 100644 --- a/gdb/gdb-stabs.h +++ b/gdb/gdb-stabs.h @@ -69,9 +69,15 @@ struct dbx_symfile_info { struct header_file *header_files; int n_header_files; int n_allocated_header_files; + + /* Pointers to BFD sections. These are used to speed up the building of + minimal symbols. */ + asection *text_section; + asection *data_section; + asection *bss_section; }; -#define DBX_SYMFILE_INFO(o) ((struct dbx_symfile_info *)((o)->sym_stab_info)) +#define DBX_SYMFILE_INFO(o) ((o)->sym_stab_info) #define DBX_TEXT_ADDR(o) (DBX_SYMFILE_INFO(o)->text_addr) #define DBX_TEXT_SIZE(o) (DBX_SYMFILE_INFO(o)->text_size) #define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->symcount) @@ -79,5 +85,8 @@ struct dbx_symfile_info { #define DBX_STRINGTAB_SIZE(o) (DBX_SYMFILE_INFO(o)->stringtab_size) #define DBX_SYMTAB_OFFSET(o) (DBX_SYMFILE_INFO(o)->symtab_offset) #define DBX_SYMBOL_SIZE(o) (DBX_SYMFILE_INFO(o)->symbol_size) +#define DBX_TEXT_SECTION(o) (DBX_SYMFILE_INFO(o)->text_section) +#define DBX_DATA_SECTION(o) (DBX_SYMFILE_INFO(o)->data_section) +#define DBX_BSS_SECTION(o) (DBX_SYMFILE_INFO(o)->bss_section) #endif /* GDBSTABS_H */ diff --git a/gdb/maint.c b/gdb/maint.c index 4269d9156e8..54fc62691cd 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -278,6 +278,47 @@ maintenance_print_command (arg, from_tty) help_list (maintenanceprintlist, "maintenance print ", -1, gdb_stdout); } +/* The "maintenance translate-address" command converts a section and address + to a symbol. This can be called in two ways: + maintenance translate-address + or maintenance translate-address +*/ + +static void +maintenance_translate_address (arg, from_tty) + char *arg; + int from_tty; +{ + CORE_ADDR address; + asection *sect; + char *p; + struct symbol *sym; + + sect = NULL; + p = arg; + + if (!isdigit (p)) + { /* See if we have a valid section name */ + while (*p && !isspace (*p)) /* Find end of section name */ + p++; + if (*p == '\000') /* End of command? */ + error ("Need to specify and
"); + *p++ = '\000'; + while (isspace (*p)) p++; /* Skip whitespace */ + + sect = bfd_get_section_by_name (exec_bfd, arg); + if (!sect) + error ("Unknown section %s.", arg); + } + + address = parse_and_eval_address (p); + + return; +/* sym = find_pc_function_section (address, sect);*/ + + printf_unfiltered ("%s+%u\n", SYMBOL_SOURCE_NAME (sym), address - SYMBOL_VALUE_ADDRESS (sym)); +} + #endif /* MAINTENANCE_CMDS */ void @@ -370,6 +411,10 @@ If a SOURCE file is specified, dump only that file's partial symbols.", "Check consistency of psymtabs and symtabs.", &maintenancelist); + add_cmd ("translate-address", class_maintenance, maintenance_translate_address, + "Translate a section name and address to a symbol.", + &maintenancelist); + add_show_from_set ( add_set_cmd ("watchdog", class_maintenance, var_zinteger, (char *)&watchdog, "Set watchdog timer.\n\ diff --git a/gdb/objfiles.h b/gdb/objfiles.h index f5c1bb9a20e..937d0d4e629 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -316,7 +316,7 @@ struct objfile /* Information about stabs. Will be filled in with a dbx_symfile_info struct by those readers that need it. */ - PTR sym_stab_info; + struct dbx_symfile_info *sym_stab_info; /* Hook for information for use by the symbol reader (currently used for information shared by sym_init and sym_read). It is diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c index 4c21c35730f..a4fa9e9b851 100644 --- a/gdb/sparc-nat.c +++ b/gdb/sparc-nat.c @@ -116,9 +116,9 @@ fetch_inferior_registers (regno) all (16 ptrace calls!) if we really need them. */ if (regno == -1) { - target_xfer_memory (*(CORE_ADDR*)®isters[REGISTER_BYTE (SP_REGNUM)], + target_read_memory (*(CORE_ADDR*)®isters[REGISTER_BYTE (SP_REGNUM)], ®isters[REGISTER_BYTE (L0_REGNUM)], - 16*REGISTER_RAW_SIZE (L0_REGNUM), 0); + 16*REGISTER_RAW_SIZE (L0_REGNUM)); for (i = L0_REGNUM; i <= I7_REGNUM; i++) register_valid[i] = 1; } @@ -128,8 +128,8 @@ fetch_inferior_registers (regno) i = REGISTER_BYTE (regno); if (register_valid[regno]) printf_unfiltered("register %d valid and read\n", regno); - target_xfer_memory (sp + i - REGISTER_BYTE (L0_REGNUM), - ®isters[i], REGISTER_RAW_SIZE (regno), 0); + target_read_memory (sp + i - REGISTER_BYTE (L0_REGNUM), + ®isters[i], REGISTER_RAW_SIZE (regno)); register_valid[regno] = 1; } } @@ -192,16 +192,16 @@ store_inferior_registers (regno) if (regno < 0 || regno == SP_REGNUM) { if (!register_valid[L0_REGNUM+5]) abort(); - target_xfer_memory (sp, - ®isters[REGISTER_BYTE (L0_REGNUM)], - 16*REGISTER_RAW_SIZE (L0_REGNUM), 1); + target_write_memory (sp, + ®isters[REGISTER_BYTE (L0_REGNUM)], + 16*REGISTER_RAW_SIZE (L0_REGNUM)); } else { if (!register_valid[regno]) abort(); - target_xfer_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM), - ®isters[REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno), 1); + target_write_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM), + ®isters[REGISTER_BYTE (regno)], + REGISTER_RAW_SIZE (regno)); } } diff --git a/gdb/symtab.c b/gdb/symtab.c index ccfdf6708a5..bc20016a8f0 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -459,6 +459,30 @@ find_pc_psymbol (psymtab, pc) return best; } +/* Debug symbols usually don't have section information. We need to dig that + out of the minimal symbols and stash that in the debug symbol. */ + +static +struct symbol * fixup_symbol_section PARAMS ((struct symbol *sym, + struct objfile *objfile)); +static struct symbol * +fixup_symbol_section (sym, objfile) + struct symbol *sym; + struct objfile *objfile; +{ + struct minimal_symbol *msym; + + if (SYMBOL_BFD_SECTION (sym)) + return sym; + + msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, objfile); + + if (msym) + SYMBOL_BFD_SECTION (sym) = SYMBOL_BFD_SECTION (msym); + + return sym; +} + /* Find the definition for a specified symbol name NAME in namespace NAMESPACE, visible from lexical block BLOCK. @@ -493,7 +517,7 @@ lookup_symbol (name, block, namespace, is_a_field_of_this, symtab) register struct symtab *s = NULL; register struct partial_symtab *ps; struct blockvector *bv; - register struct objfile *objfile; + register struct objfile *objfile = NULL; register struct block *b; register struct minimal_symbol *msymbol; @@ -521,7 +545,7 @@ found: *symtab = s; } - return (sym); + return fixup_symbol_section (sym, objfile); } block = BLOCK_SUPERBLOCK (block); } @@ -550,7 +574,7 @@ found: block_found = b; if (symtab != NULL) *symtab = s; - return sym; + return fixup_symbol_section (sym, objfile); } } } @@ -569,7 +593,7 @@ found: *is_a_field_of_this = 1; if (symtab != NULL) *symtab = NULL; - return 0; + return NULL; } } @@ -586,7 +610,7 @@ found: block_found = block; if (symtab != NULL) *symtab = s; - return sym; + return fixup_symbol_section (sym, objfile); } } @@ -630,7 +654,7 @@ found: if (symtab != NULL) *symtab = s; - return sym; + return fixup_symbol_section (sym, objfile); } else if (MSYMBOL_TYPE (msymbol) != mst_text && MSYMBOL_TYPE (msymbol) != mst_file_text @@ -638,8 +662,10 @@ found: { /* This is a mangled variable, look it up by its mangled name. */ - return lookup_symbol (SYMBOL_NAME (msymbol), block, - namespace, is_a_field_of_this, symtab); + return fixup_symbol_section + (lookup_symbol (SYMBOL_NAME (msymbol), block, + namespace, is_a_field_of_this, symtab), + NULL); } /* There are no debug symbols for this file, or we are looking for an unmangled variable. @@ -659,7 +685,7 @@ found: error ("Internal: global symbol `%s' found in %s psymtab but not in symtab", name, ps->filename); if (symtab != NULL) *symtab = s; - return sym; + return fixup_symbol_section (sym, objfile); } } @@ -677,7 +703,7 @@ found: block_found = block; if (symtab != NULL) *symtab = s; - return sym; + return fixup_symbol_section (sym, objfile); } } @@ -693,7 +719,7 @@ found: error ("Internal: static symbol `%s' found in %s psymtab but not in symtab", name, ps->filename); if (symtab != NULL) *symtab = s; - return sym; + return fixup_symbol_section (sym, objfile); } }