aboutsummaryrefslogtreecommitdiff
path: root/gdb/dummy-frame.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2005-04-02 00:45:52 +0000
committerMichael Snyder <msnyder@vmware.com>2005-04-02 00:45:52 +0000
commit0c98cc2b815b97889f89c397a0e91121eefd1b71 (patch)
tree306109dcf69135651b0005f6bfeb1ddda5831168 /gdb/dummy-frame.c
parentf6fe78d68c664e09c0d43de2fd17a6f49eee93f9 (diff)
downloadgdb-0c98cc2b815b97889f89c397a0e91121eefd1b71.zip
gdb-0c98cc2b815b97889f89c397a0e91121eefd1b71.tar.gz
gdb-0c98cc2b815b97889f89c397a0e91121eefd1b71.tar.bz2
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 2d4c097..a1f2592 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;