X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fhppa-tdep.c;h=be30359638c37fab2bd3ac3e9e4389333e43a7ad;hb=9a73f0ad6ca2a9c027f30fca3d79fa958784dcbf;hp=7adc71cc636cdb600c41c53896c4d87588eae50a;hpb=42a4f53d2bf8938c2aeda9f52be7a20534b214a9;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 7adc71cc63..be30359638 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -84,7 +84,9 @@ struct hppa_objfile_private that separately and make this static. The solib data is probably hpux- specific, so we can create a separate extern objfile_data that is registered by hppa-hpux-tdep.c and shared with pa64solib.c and somsolib.c. */ -static const struct objfile_data *hppa_objfile_priv_data = NULL; +static const struct objfile_key> + hppa_objfile_priv_data; /* Get at various relevent fields of an instruction word. */ #define MASK_5 0x1f @@ -208,7 +210,7 @@ hppa_init_objfile_priv_data (struct objfile *objfile) hppa_objfile_private *priv = OBSTACK_ZALLOC (&objfile->objfile_obstack, hppa_objfile_private); - set_objfile_data (objfile, hppa_objfile_priv_data, priv); + hppa_objfile_priv_data.set (objfile, priv); return priv; } @@ -466,8 +468,7 @@ read_unwind_info (struct objfile *objfile) compare_unwind_entries); /* Keep a pointer to the unwind information. */ - obj_private = (struct hppa_objfile_private *) - objfile_data (objfile, hppa_objfile_priv_data); + obj_private = hppa_objfile_priv_data.get (objfile); if (obj_private == NULL) obj_private = hppa_init_objfile_priv_data (objfile); @@ -483,7 +484,6 @@ struct unwind_table_entry * find_unwind_entry (CORE_ADDR pc) { int first, middle, last; - struct objfile *objfile; struct hppa_objfile_private *priv; if (hppa_debug) @@ -498,61 +498,59 @@ find_unwind_entry (CORE_ADDR pc) return NULL; } - ALL_OBJFILES (objfile) - { - struct hppa_unwind_info *ui; - ui = NULL; - priv = ((struct hppa_objfile_private *) - objfile_data (objfile, hppa_objfile_priv_data)); - if (priv) - ui = ((struct hppa_objfile_private *) priv)->unwind_info; - - if (!ui) - { - read_unwind_info (objfile); - priv = ((struct hppa_objfile_private *) - objfile_data (objfile, hppa_objfile_priv_data)); - if (priv == NULL) - error (_("Internal error reading unwind information.")); - ui = ((struct hppa_objfile_private *) priv)->unwind_info; - } + for (objfile *objfile : current_program_space->objfiles ()) + { + struct hppa_unwind_info *ui; + ui = NULL; + priv = hppa_objfile_priv_data.get (objfile); + if (priv) + ui = ((struct hppa_objfile_private *) priv)->unwind_info; - /* First, check the cache. */ + if (!ui) + { + read_unwind_info (objfile); + priv = hppa_objfile_priv_data.get (objfile); + if (priv == NULL) + error (_("Internal error reading unwind information.")); + ui = ((struct hppa_objfile_private *) priv)->unwind_info; + } - if (ui->cache - && pc >= ui->cache->region_start - && pc <= ui->cache->region_end) - { - if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n", - hex_string ((uintptr_t) ui->cache)); - return ui->cache; - } + /* First, check the cache. */ - /* Not in the cache, do a binary search. */ + if (ui->cache + && pc >= ui->cache->region_start + && pc <= ui->cache->region_end) + { + if (hppa_debug) + fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n", + hex_string ((uintptr_t) ui->cache)); + return ui->cache; + } - first = 0; - last = ui->last; + /* Not in the cache, do a binary search. */ - 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]; - if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, "%s }\n", - hex_string ((uintptr_t) ui->cache)); - return &ui->table[middle]; - } + first = 0; + last = ui->last; - if (pc < ui->table[middle].region_start) - last = middle - 1; - else - first = middle + 1; - } - } /* ALL_OBJFILES() */ + 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]; + if (hppa_debug) + fprintf_unfiltered (gdb_stdlog, "%s }\n", + hex_string ((uintptr_t) ui->cache)); + return &ui->table[middle]; + } + + if (pc < ui->table[middle].region_start) + last = middle - 1; + else + first = middle + 1; + } + } if (hppa_debug) fprintf_unfiltered (gdb_stdlog, "NULL (not found) }\n"); @@ -2506,14 +2504,6 @@ static const struct frame_unwind hppa_stub_frame_unwind = { hppa_stub_unwind_sniffer }; -static struct frame_id -hppa_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) -{ - return frame_id_build (get_frame_register_unsigned (this_frame, - HPPA_SP_REGNUM), - get_frame_pc (this_frame)); -} - CORE_ADDR hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) { @@ -2541,24 +2531,25 @@ struct bound_minimal_symbol hppa_lookup_stub_minimal_symbol (const char *name, enum unwind_stub_types stub_type) { - struct objfile *objfile; - struct minimal_symbol *msym; struct bound_minimal_symbol result = { NULL, NULL }; - ALL_MSYMBOLS (objfile, msym) + for (objfile *objfile : current_program_space->objfiles ()) { - if (strcmp (MSYMBOL_LINKAGE_NAME (msym), name) == 0) - { - struct unwind_table_entry *u; - - u = find_unwind_entry (MSYMBOL_VALUE (msym)); - if (u != NULL && u->stub_unwind.stub_type == stub_type) + for (minimal_symbol *msym : objfile->msymbols ()) + { + if (strcmp (MSYMBOL_LINKAGE_NAME (msym), name) == 0) { - result.objfile = objfile; - result.minsym = msym; - return result; + struct unwind_table_entry *u; + + u = find_unwind_entry (MSYMBOL_VALUE (msym)); + if (u != NULL && u->stub_unwind.stub_type == stub_type) + { + result.objfile = objfile; + result.minsym = msym; + return result; + } } - } + } } return result; @@ -2588,10 +2579,8 @@ unwind_command (const char *exp, int from_tty) printf_unfiltered ("unwind_table_entry (%s):\n", host_address_to_string (u)); printf_unfiltered ("\tregion_start = %s\n", hex_string (u->region_start)); - gdb_flush (gdb_stdout); printf_unfiltered ("\tregion_end = %s\n", hex_string (u->region_end)); - gdb_flush (gdb_stdout); #define pif(FLD) if (u->FLD) printf_unfiltered (" "#FLD); @@ -3156,7 +3145,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read); /* Frame unwind methods. */ - set_gdbarch_dummy_id (gdbarch, hppa_dummy_id); set_gdbarch_unwind_pc (gdbarch, hppa_unwind_pc); /* Hook in ABI-specific overrides, if they have been registered. */ @@ -3185,8 +3173,6 @@ _initialize_hppa_tdep (void) { gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep); - hppa_objfile_priv_data = register_objfile_data (); - add_cmd ("unwind", class_maintenance, unwind_command, _("Print unwind table entry at given address."), &maintenanceprintlist);