aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2004-09-01 14:13:33 +0000
committerAndrew Cagney <cagney@redhat.com>2004-09-01 14:13:33 +0000
commitc8cd9f6c4cdd895e65e4feb4b2402a2dfdbc3822 (patch)
tree5e76c9e65865d68734971b40825f26f140c255b3 /gdb/frame.c
parent0df3d27f988df8bdb52cd320fd20ae30f55255bd (diff)
downloadgdb-c8cd9f6c4cdd895e65e4feb4b2402a2dfdbc3822.zip
gdb-c8cd9f6c4cdd895e65e4feb4b2402a2dfdbc3822.tar.gz
gdb-c8cd9f6c4cdd895e65e4feb4b2402a2dfdbc3822.tar.bz2
2004-08-31 Andrew Cagney <cagney@gnu.org>
* frame.c: Include "objfiles.h". (inside_main_func): New function. (get_prev_frame): Use new inside_main_func. * Makefile.in (frame.o): Update dependencies. * defs.h (inside_main_func): Delete declaration. * blockframe.c (inside_main_func): Delete function.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index a723b32..0d0e2c9 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -40,6 +40,7 @@
#include "command.h"
#include "gdbcmd.h"
#include "observer.h"
+#include "objfiles.h"
static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
@@ -1108,6 +1109,27 @@ frame_debug_got_null_frame (struct ui_file *file,
}
}
+/* Is this (non-sentinel) frame in the "main"() function? */
+
+static int
+inside_main_func (struct frame_info *this_frame)
+{
+ struct minimal_symbol *msymbol;
+ CORE_ADDR maddr;
+
+ if (symfile_objfile == 0)
+ return 0;
+ msymbol = lookup_minimal_symbol (main_name (), NULL, symfile_objfile);
+ if (msymbol == NULL)
+ return 0;
+ /* Make certain that the code, and not descriptor, address is
+ returned. */
+ maddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+ SYMBOL_VALUE_ADDRESS (msymbol),
+ &current_target);
+ return maddr == get_frame_func (this_frame);
+}
+
/* Return a structure containing various interesting information about
the frame that called THIS_FRAME. Returns NULL if there is entier
no such frame or the frame fails any of a set of target-independent
@@ -1163,17 +1185,13 @@ get_prev_frame (struct frame_info *this_frame)
get_current_frame(). */
gdb_assert (this_frame != NULL);
- /* Make sure we pass an address within THIS_FRAME's code block to
- inside_main_func(). Otherwise, we might stop unwinding at a
- function which has a call instruction as its last instruction if
- that function immediately precedes main(). */
if (this_frame->level >= 0
&& !backtrace_past_main
- && inside_main_func (get_frame_address_in_block (this_frame)))
- /* Don't unwind past main(), but always unwind the sentinel frame.
- Note, this is done _before_ the frame has been marked as
- previously unwound. That way if the user later decides to
- allow unwinds past main(), that just happens. */
+ && inside_main_func (this_frame))
+ /* Don't unwind past main(). Note, this is done _before_ the
+ frame has been marked as previously unwound. That way if the
+ user later decides to enable unwinds past main(), that will
+ automatically happen. */
{
frame_debug_got_null_frame (gdb_stdlog, this_frame, "inside main func");
return NULL;