diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d96c503839..96a8e77197 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ 2005-04-01 Michael Snyder + * dummy-frame.c (dummy_frame_sniffer): Optimization: don't bother + computing this_id if there are no dummy frames on the stack. + * mn10300-tdep.c (mn10300_frame_unwind_cache): Use find_partial_func instead of unwind_pc to identify frame. (mn10300_push_dummy_call): Handle struct args, struct_return. diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 2d4c097553..a1f2592754 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -137,25 +137,31 @@ dummy_frame_sniffer (const struct frame_unwind *self, entry point, or some random address on the stack. Trying to use that PC to apply standard frame ID unwind techniques is just asking for trouble. */ - /* Use an architecture specific method to extract the prev's dummy - ID from the next frame. Note that this method uses - frame_register_unwind to obtain the register values needed to - determine the dummy frame's ID. */ - this_id = gdbarch_unwind_dummy_id (get_frame_arch (next_frame), next_frame); - - /* Use that ID to find the corresponding cache entry. */ - for (dummyframe = dummy_frame_stack; - dummyframe != NULL; - dummyframe = dummyframe->next) + + /* Don't bother unles there is at least one dummy frame. */ + if (dummy_frame_stack != NULL) { - if (frame_id_eq (dummyframe->id, this_id)) + /* Use an architecture specific method to extract the prev's + dummy ID from the next frame. Note that this method uses + frame_register_unwind to obtain the register values needed to + determine the dummy frame's ID. */ + this_id = gdbarch_unwind_dummy_id (get_frame_arch (next_frame), + next_frame); + + /* Use that ID to find the corresponding cache entry. */ + for (dummyframe = dummy_frame_stack; + dummyframe != NULL; + dummyframe = dummyframe->next) { - struct dummy_frame_cache *cache; - cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache); - cache->prev_regcache = dummyframe->regcache; - cache->this_id = this_id; - (*this_prologue_cache) = cache; - return 1; + if (frame_id_eq (dummyframe->id, this_id)) + { + struct dummy_frame_cache *cache; + cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache); + cache->prev_regcache = dummyframe->regcache; + cache->this_id = this_id; + (*this_prologue_cache) = cache; + return 1; + } } } return 0;