#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", \
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)
#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 */
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 <secname> <addr>
+ or maintenance translate-address <addr>
+*/
+
+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 <section-name> and <address>");
+ *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
"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\
/* 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
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;
}
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;
}
}
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));
}
}
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;
+}
+
\f
/* Find the definition for a specified symbol name NAME
in namespace NAMESPACE, visible from lexical block BLOCK.
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;
*symtab = s;
}
- return (sym);
+ return fixup_symbol_section (sym, objfile);
}
block = BLOCK_SUPERBLOCK (block);
}
block_found = b;
if (symtab != NULL)
*symtab = s;
- return sym;
+ return fixup_symbol_section (sym, objfile);
}
}
}
*is_a_field_of_this = 1;
if (symtab != NULL)
*symtab = NULL;
- return 0;
+ return NULL;
}
}
block_found = block;
if (symtab != NULL)
*symtab = s;
- return sym;
+ return fixup_symbol_section (sym, objfile);
}
}
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
{
/* 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.
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);
}
}
block_found = block;
if (symtab != NULL)
*symtab = s;
- return sym;
+ return fixup_symbol_section (sym, objfile);
}
}
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);
}
}