aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/ada-lang.c15
-rw-r--r--gdb/frame.c23
-rw-r--r--gdb/frame.h23
-rw-r--r--gdb/stack.c16
-rw-r--r--gdb/tui/ChangeLog5
-rw-r--r--gdb/tui/tuiStack.c5
7 files changed, 70 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0b9664a..434ec84 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2002-11-28 Andrew Cagney <ac131313@redhat.com>
+
+ * frame.c (pc_notcurrent): New function.
+ (find_frame_sal): New function.
+ * frame.h (find_frame_sal): Declare.
+ (struct symtab_and_line): Add opaque declaration.
+ * stack.c (print_frame_info_base): Use find_pc_line instead of
+ find_frame_sal.
+ (frame_info): Ditto.
+ * ada-lang.c (find_printable_frame): Ditto.
+
2002-11-28 J. Brobecker <brobecker@gnat.com>
* configure.in: Check that the pthdebug library is recent enough
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index e83037a..04d2183 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5032,20 +5032,7 @@ find_printable_frame (struct frame_info *fi, int level)
for (; fi != NULL; level += 1, fi = get_prev_frame (fi))
{
- /* If fi is not the innermost frame, that normally means that
- fi->pc points at the return instruction (which is *after* the
- call instruction), and we want to get the line containing the
- call (because the call is where the user thinks the program
- is). However, if the next frame is either a SIGTRAMP_FRAME
- or a DUMMY_FRAME, then the next frame will contain a saved
- interrupt PC and such a PC indicates the current (rather than
- next) instruction/line, consequently, for such cases, want to
- get the line containing fi->pc. */
- sal =
- find_pc_line (fi->pc,
- fi->next != NULL
- && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
- && !(get_frame_type (fi->next) == DUMMY_FRAME));
+ find_frame_sal (fi, &sal);
if (sal.symtab && !is_ada_runtime_file (sal.symtab->filename))
{
#if defined(__alpha__) && defined(__osf__) && !defined(VXWORKS_TARGET)
diff --git a/gdb/frame.c b/gdb/frame.c
index 44207f3..1918114 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1021,6 +1021,29 @@ get_frame_pc (struct frame_info *frame)
return frame->pc;
}
+static int
+pc_notcurrent (struct frame_info *frame)
+{
+ /* If FRAME is not the innermost frame, that normally means that
+ FRAME->pc points at the return instruction (which is *after* the
+ call instruction), and we want to get the line containing the
+ call (because the call is where the user thinks the program is).
+ However, if the next frame is either a SIGTRAMP_FRAME or a
+ DUMMY_FRAME, then the next frame will contain a saved interrupt
+ PC and such a PC indicates the current (rather than next)
+ instruction/line, consequently, for such cases, want to get the
+ line containing fi->pc. */
+ struct frame_info *next = get_next_frame (frame);
+ int notcurrent = (next != NULL && get_frame_type (next) == NORMAL_FRAME);
+ return notcurrent;
+}
+
+void
+find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal)
+{
+ (*sal) = find_pc_line (frame->pc, pc_notcurrent (frame));
+}
+
/* Per "frame.h", return the ``address'' of the frame. Code should
really be using get_frame_id(). */
CORE_ADDR
diff --git a/gdb/frame.h b/gdb/frame.h
index 2a5e47d..202f9c8 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -23,6 +23,8 @@
#if !defined (FRAME_H)
#define FRAME_H 1
+struct symtab_and_line;
+
/* The frame object. */
struct frame_info;
@@ -99,6 +101,27 @@ extern struct frame_info *frame_find_by_id (struct frame_id id);
this frame. */
extern CORE_ADDR get_frame_pc (struct frame_info *);
+/* Closely related to the resume address, various symbol table
+ attributes that are determined by the PC. Note that for a normal
+ frame, the PC refers to the resume address after the return, and
+ not the call instruction. In such a case, the address is adjusted
+ so that it (approximatly) identifies the call site (and not return
+ site).
+
+ NOTE: cagney/2002-11-28: The frame cache could be used to cache the
+ computed value. Working on the assumption that the bottle-neck is
+ in the single step code, and that code causes the frame cache to be
+ constantly flushed, caching things in a frame is probably of little
+ benefit. As they say `show us the numbers'.
+
+ NOTE: cagney/2002-11-28: Plenty more where this one came from:
+ find_frame_block(), find_frame_partial_function(),
+ find_frame_symtab(), find_frame_function(). Each will need to be
+ carefully considered to determine if the real intent was for it to
+ apply to the PC or the adjusted PC. */
+extern void find_frame_sal (struct frame_info *frame,
+ struct symtab_and_line *sal);
+
/* Return the frame address from FI. Except in the machine-dependent
*FRAME* macros, a frame address has no defined meaning other than
as a magic cookie which identifies a frame over calls to the
diff --git a/gdb/stack.c b/gdb/stack.c
index effa18c..999de6fd 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -356,11 +356,7 @@ print_frame_info_base (struct frame_info *fi, int level, int source, int args)
frame is a SIGTRAMP_FRAME or a DUMMY_FRAME, then the next frame
was not entered as the result of a call, and we want to get the
line containing fi->pc. */
- sal =
- find_pc_line (fi->pc,
- fi->next != NULL
- && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
- && !(get_frame_type (fi->next) == DUMMY_FRAME));
+ find_frame_sal (fi, &sal);
location_print = (source == LOCATION
|| source == LOC_AND_ADDRESS
@@ -757,11 +753,10 @@ frame_info (char *addr_exp, int from_tty)
if (fi == NULL)
error ("Invalid frame specified.");
- sal = find_pc_line (fi->pc,
- fi->next != NULL
- && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
- && !(get_frame_type (fi->next) == DUMMY_FRAME));
+ find_frame_sal (fi, &sal);
func = get_frame_function (fi);
+ /* FIXME: cagney/2002-11-28: Why bother? Won't sal.symtab contain
+ the same value. */
s = find_pc_symtab (fi->pc);
if (func)
{
@@ -858,7 +853,8 @@ frame_info (char *addr_exp, int from_tty)
if (fi->next || calling_frame_info)
puts_filtered ("\n");
if (s)
- printf_filtered (" source language %s.\n", language_str (s->language));
+ printf_filtered (" source language %s.\n",
+ language_str (s->language));
#ifdef PRINT_EXTRA_FRAME_INFO
PRINT_EXTRA_FRAME_INFO (fi);
diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog
index 3c72765..779360d 100644
--- a/gdb/tui/ChangeLog
+++ b/gdb/tui/ChangeLog
@@ -1,3 +1,8 @@
+2002-11-28 Andrew Cagney <ac131313@redhat.com>
+
+ * tuiStack.c (tuiShowFrameInfo): Use find_frame_sal instead of
+ find_pc_line.
+
2002-11-23 Andrew Cagney <ac131313@redhat.com>
* tuiStack.c (tuiShowFrameInfo): Use get_frame_type instead of
diff --git a/gdb/tui/tuiStack.c b/gdb/tui/tuiStack.c
index 7f46d57..bbd30e6 100644
--- a/gdb/tui/tuiStack.c
+++ b/gdb/tui/tuiStack.c
@@ -349,10 +349,7 @@ tuiShowFrameInfo (struct frame_info *fi)
int sourceAlreadyDisplayed;
struct symtab_and_line sal;
- sal = find_pc_line (fi->pc,
- (fi->next != (struct frame_info *) NULL
- && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
- && !(get_frame_type (fi->next) == DUMMY_FRAME)));
+ find_frame_sap (fi, &sal);
sourceAlreadyDisplayed = sal.symtab != 0
&& tuiSourceIsDisplayed (sal.symtab->filename);