2005-04-01 Michael Snyder <msnyder@redhat.com>
authorMichael Snyder <msnyder@vmware.com>
Sat, 2 Apr 2005 00:45:52 +0000 (00:45 +0000)
committerMichael Snyder <msnyder@vmware.com>
Sat, 2 Apr 2005 00:45:52 +0000 (00:45 +0000)
* dummy-frame.c (dummy_frame_sniffer): Optimization: don't bother
computing this_id if there are no dummy frames on the stack.

gdb/ChangeLog
gdb/dummy-frame.c

index d96c503839243a2db7b0df0003061de1cf206737..96a8e771975b35040ff5162180f7dadc4ab8aa4f 100644 (file)
@@ -1,5 +1,8 @@
 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.
+       
        * 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.
index 2d4c09755366d8d205d388e8c9ae45c783049dc2..a1f2592754b02a18d32687cb427cacc72c84479b 100644 (file)
@@ -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;
This page took 0.029109 seconds and 4 git commands to generate.