diff options
author | Stu Grossman <grossman@cygnus> | 1993-01-15 00:06:50 +0000 |
---|---|---|
committer | Stu Grossman <grossman@cygnus> | 1993-01-15 00:06:50 +0000 |
commit | fa9265e55deac681e0664cbea1c4367f81cadc68 (patch) | |
tree | 9ffbeea1837f03eb79e4fbf80ed448b7d7ff91a0 /gdb/hppah-tdep.c | |
parent | 30ea4a2d918f78e39ce54619fe08d1f26909e10a (diff) | |
download | gdb-fa9265e55deac681e0664cbea1c4367f81cadc68.zip gdb-fa9265e55deac681e0664cbea1c4367f81cadc68.tar.gz gdb-fa9265e55deac681e0664cbea1c4367f81cadc68.tar.bz2 |
* hppa-pinsn.c (print_insn): Use read_memory_integer, instead of
read_memory to get byte order right.
* hppah-tdep.c (find_unwind_info): Don't read in unwind info
anymore. This is done in paread.c now. We expect unwind info
to hang off of objfiles, and search all of the objfiles when until
we find a match.
* (skip_trampoline_code): Cast arg to target_read_memory.
* objfiles.h (struct objfile): Add new field obj_private to hold
per object file private data (unwind info in this case).
* paread.c (read_unwind_info): New routine to read unwind info
for the objfile. This data is hung off of obj_private.
* tm-hppa.h: Define struct obj_unwind_info, to hold pointers to
the unwind info for this objfile. Also define OBJ_UNWIND_INFO to
make this easier to access.
Diffstat (limited to 'gdb/hppah-tdep.c')
-rw-r--r-- | gdb/hppah-tdep.c | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/gdb/hppah-tdep.c b/gdb/hppah-tdep.c index 7c0c6f3..5a1227a 100644 --- a/gdb/hppah-tdep.c +++ b/gdb/hppah-tdep.c @@ -56,6 +56,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "gdbcore.h" #include "gdbcmd.h" #include "target.h" +#include "symfile.h" +#include "objfiles.h" /* Routines to extract various sized constants out of hppa @@ -218,55 +220,58 @@ extract_17 (word) (word & 0x1) << 16, 17) << 2; } -int use_unwind = 0; +static int use_unwind = 0; + +/* Lookup the unwind (stack backtrace) info for the given PC. We search all + of the objfiles seeking the unwind table entry for this PC. Each objfile + contains a sorted list of struct unwind_table_entry. Since we do a binary + search of the unwind tables, we depend upon them to be sorted. */ static struct unwind_table_entry * find_unwind_entry(pc) CORE_ADDR pc; { - static struct unwind_table_entry *unwind = NULL; - static int unwind_last; - static int unwind_cache = -1; int first, middle, last; + struct objfile *objfile; - if (!unwind) + ALL_OBJFILES (objfile) { - asection *unwind_sec; + struct obj_unwind_info *ui; - unwind_sec = bfd_get_section_by_name (exec_bfd, "$UNWIND_START$"); - if (unwind_sec) - { - int size; + ui = OBJ_UNWIND_INFO (objfile); - size = bfd_section_size (exec_bfd, unwind_sec); - unwind = malloc (size); - unwind_last = size / sizeof (struct unwind_table_entry) - 1; + if (!ui) + continue; - bfd_get_section_contents (exec_bfd, unwind_sec, unwind, 0, size); - } - } + /* First, check the cache */ - if (unwind_cache > 0 - && pc >= unwind[unwind_cache].region_start - && pc <= unwind[unwind_cache].region_end) - return &unwind[unwind_cache]; + if (ui->cache + && pc >= ui->cache->region_start + && pc <= ui->cache->region_end) + return ui->cache; - first = 0; - last = unwind_last; + /* Not in the cache, do a binary search */ - while (first <= last) - { - middle = (first + last) / 2; - if (pc >= unwind[middle].region_start - && pc <= unwind[middle].region_end) - return &unwind[middle]; + first = 0; + last = ui->last; - if (pc < unwind[middle].region_start) - last = middle - 1; - else - first = middle + 1; - } - return NULL; + while (first <= last) + { + middle = (first + last) / 2; + if (pc >= ui->table[middle].region_start + && pc <= ui->table[middle].region_end) + { + ui->cache = &ui->table[middle]; + return &ui->table[middle]; + } + + if (pc < ui->table[middle].region_start) + last = middle - 1; + else + first = middle + 1; + } + } /* ALL_OBJFILES() */ + return NULL; } static int @@ -819,7 +824,7 @@ skip_prologue(pc) int inst; int status; - status = target_read_memory (pc, &inst, 4); + status = target_read_memory (pc, (char *)&inst, 4); SWAP_TARGET_AND_HOST (&inst, sizeof (inst)); if (status != 0) return pc; |