summaryrefslogtreecommitdiff
path: root/gdb/dummy-frame.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2005-04-02 00:45:52 +0000
committerMichael Snyder <msnyder@specifix.com>2005-04-02 00:45:52 +0000
commita839401c45f5781325a4ba1800ab2c74d321e2d8 (patch)
tree755ade1f26866558c2a14989255b68667d54f3d9 /gdb/dummy-frame.c
parentd374de1e11cdfe1122485e0c01bbb7ef2f121f7c (diff)
downloadgdb-a839401c45f5781325a4ba1800ab2c74d321e2d8.tar.gz
2005-04-01 Michael Snyder <msnyder@redhat.com>
* dummy-frame.c (dummy_frame_sniffer): Optimization: don't bother computing this_id if there are no dummy frames on the stack.
Diffstat (limited to 'gdb/dummy-frame.c')
-rw-r--r--gdb/dummy-frame.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 2d4c0975536..a1f2592754b 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;