From 93f75411f6c54ef8e94712aa06f792fc6eafa413 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Fri, 13 Mar 1998 20:39:00 +0000 Subject: [PATCH] * sim-base.h (struct sim_state_base): Add prog_syms and define macro STATE_PROG_SYMS. * sim-trace.c (trace_one_insn): Add variables abfd, symsize, symbol_count, and asymbols. Call bfd_get_symtab_upper_bound and bfd_canonicalize_symtab, to get symbol table on first use and preserve it via STATE_PROG_SYMS for future calls to bfd_find_nearest_line. --- sim/common/ChangeLog | 57 ++++++++++++++++++++++++++++++++++++++++++ sim/common/sim-trace.c | 35 ++++++++++++++++++++------ 2 files changed, 84 insertions(+), 8 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 161fa7ed905..95fefc9cdd8 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,60 @@ +1998-03-13 Fred Fish + + * sim-base.h (struct sim_state_base): Add prog_syms and + define macro STATE_PROG_SYMS. + * sim-trace.c (trace_one_insn): Add variables abfd, symsize, + symbol_count, and asymbols. Call bfd_get_symtab_upper_bound + and bfd_canonicalize_symtab, to get symbol table on first use + and preserve it via STATE_PROG_SYMS for future calls to + bfd_find_nearest_line. + +Wed Mar 11 14:02:47 1998 Andrew Cagney + + * sim-core.h, sim-core.c (sim_core_map_to_str): Delete. + + * sim-core.c (sim_core_attach): Handle a generic number of maps - + up to nr_maps, not just access_* maps. + + * sim-profile.h (struct PROFILE_DATA): Track nr_maps different + maps. + + * sim-profile.c (profile_print_core): Make map unsigned. Iterate + over nr_maps not sim_core_nr_maps. + + * sim-events.h, sim-events.c (sim_events_watch_core): Change + core_map argument to unsigned. + (struct _sim_core): Ditto for struct member core_map. + + * sim-core.h (nr_sim_core_maps, sim_core_*_map): Delete + + * sim-basics.h (access_io, access_*_io): Define. + (map_read, map_write, map_exec, map_io): Define. + + * sim-core.c, sim-core.h (sim_core_attach): Replace argument + attach with more generic mapmask. + (sim_core_{read,write}_*): Change map argument to unsigned. + + * sim-core.c (sim_core_uninstall, sim_core_attach, + sim_core_detach): Iterate over nr_maps instead of + sim_core_nr_maps. + + * sim-break.c (insert_breakpoint): Write breakpoints to exec_map + instead of the write_map. + (remove_breakpoint): Ditto. + + * genmloop.sh (engine_resume_full): Replace sim_core_*_map + with read_map, write_map, exec_map resp. + + * cgen-mem.h (DECLARE_GETMEM, DECLARE_SETMEM, DECLARE_GETIMEM): + Ditto. + + * cgen-utils.c (sim_disassemble_insn): Ditto. + + * sim-hrw.c (sim_write, sim_write): Ditto. + + * sim-utils.h, sim-utils.c (access_to_str, map_to_str, + transfer_to_str): New functions. + Mon Mar 9 12:50:59 1998 Doug Evans * sim-base.h (sim_state_base): New member environment. diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c index 60a8f8cefa2..2e9e9797521 100644 --- a/sim/common/sim-trace.c +++ b/sim/common/sim-trace.c @@ -192,11 +192,8 @@ set_trace_option (sd, name, idx, arg) static SIM_RC -trace_option_handler (sd, opt, arg, is_command) - SIM_DESC sd; - int opt; - char *arg; - int is_command; +trace_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, + char *arg, int is_command) { int n; @@ -344,7 +341,7 @@ trace_install (SIM_DESC sd) SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); - sim_add_option_table (sd, trace_options); + sim_add_option_table (sd, NULL, trace_options); memset (STATE_TRACE_DATA (sd), 0, sizeof (* STATE_TRACE_DATA (sd))); for (i = 0; i < MAX_NR_PROCESSORS; ++i) memset (CPU_TRACE_DATA (STATE_CPU (sd, i)), 0, @@ -592,10 +589,32 @@ trace_prefix (SIM_DESC sd, const char *pc_filename = (const char *)0; const char *pc_function = (const char *)0; unsigned int pc_linenum = 0; + bfd *abfd; + asymbol **asymbols; - if (bfd_find_nearest_line (STATE_PROG_BFD (CPU_STATE (cpu)), + abfd = STATE_PROG_BFD (CPU_STATE (cpu)); + asymbols = STATE_PROG_SYMS (CPU_STATE (cpu)); + if (asymbols == NULL) + { + long symsize; + long symbol_count; + + symsize = bfd_get_symtab_upper_bound (abfd); + if (symsize < 0) + { + sim_engine_abort (sd, cpu, 0, "could not read symbols\n"); + } + asymbols = (asymbol **) xmalloc (symsize); + symbol_count = bfd_canonicalize_symtab (abfd, asymbols); + if (symbol_count < 0) + { + sim_engine_abort (sd, cpu, 0, "could not canonicalize symbols\n"); + } + STATE_PROG_SYMS (CPU_STATE (cpu)) = asymbols; + } + if (bfd_find_nearest_line (abfd, STATE_TEXT_SECTION (CPU_STATE (cpu)), - (struct symbol_cache_entry **) 0, + asymbols, pc - STATE_TEXT_START (CPU_STATE (cpu)), &pc_filename, &pc_function, &pc_linenum)) { -- 2.30.2