This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Eliminate get_current_block()
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 28 Nov 2002 19:18:46 -0500
- Subject: [commit] Eliminate get_current_block()
With only one caller, I couldn't see the need for this function.
(As the comment notes, I'm also struggling to understand why it even
special cases no selected frame.)
committed,
Andrew
2002-11-28 Andrew Cagney <cagney@redhat.com>
* stack.c (get_selected_block): In-line get_current_block.
* frame.h (get_current_block): Delete declaration.
* blockframe.c (get_current_block): Delete function.
Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.54
diff -u -r1.54 blockframe.c
--- blockframe.c 28 Nov 2002 21:38:43 -0000 1.54
+++ blockframe.c 29 Nov 2002 00:14:27 -0000
@@ -247,17 +247,6 @@
return block_for_pc (pc);
}
-struct block *
-get_current_block (CORE_ADDR *addr_in_block)
-{
- CORE_ADDR pc = read_pc ();
-
- if (addr_in_block)
- *addr_in_block = pc;
-
- return block_for_pc (pc);
-}
-
CORE_ADDR
get_pc_function_start (CORE_ADDR pc)
{
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.38
diff -u -r1.38 frame.h
--- frame.h 28 Nov 2002 17:11:41 -0000 1.38
+++ frame.h 29 Nov 2002 00:14:27 -0000
@@ -419,8 +419,6 @@
extern struct block *get_frame_block (struct frame_info *,
CORE_ADDR *addr_in_block);
-extern struct block *get_current_block (CORE_ADDR *addr_in_block);
-
extern struct block *get_selected_block (CORE_ADDR *addr_in_block);
extern struct symbol *get_frame_function (struct frame_info *);
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.52
diff -u -r1.52 stack.c
--- stack.c 24 Nov 2002 19:48:13 -0000 1.52
+++ stack.c 29 Nov 2002 00:14:28 -0000
@@ -1543,8 +1543,22 @@
if (!target_has_stack)
return 0;
+ /* NOTE: cagney/2002-11-28: Why go to all this effort to not create
+ a selected/current frame? Perhaphs this function is called,
+ indirectly, by WFI in "infrun.c" where avoiding the creation of
+ an inner most frame is very important (it slows down single
+ step). I suspect, though that this was true in the deep dark
+ past but is no longer the case. A mindless look at all the
+ callers tends to support this theory. I think we should be able
+ to assume that there is always a selcted frame. */
+ /* gdb_assert (selected_frame != NULL); So, do you feel lucky? */
if (!selected_frame)
- return get_current_block (addr_in_block);
+ {
+ CORE_ADDR pc = read_pc ();
+ if (addr_in_block != NULL)
+ *addr_in_block = pc;
+ return block_for_pc (pc);
+ }
return get_frame_block (selected_frame, addr_in_block);
}