From: Daniel Jacobowitz <drow@false.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Jason Kraftcheck <kraftche@cae.wisc.edu>,
gdb-patches@sources.redhat.com
Subject: Re: fix list/edit command in hook-stop
Date: Wed, 01 Mar 2006 17:58:00 -0000 [thread overview]
Message-ID: <20060301175814.GB6465@nevyn.them.org> (raw)
In-Reply-To: <uzmkbp7p2.fsf@gnu.org>
On Tue, Feb 28, 2006 at 10:08:41PM +0200, Eli Zaretskii wrote:
> Thanks. However, I thought we should explain why
> set_current_sal_from_frame is called here. I believe the reason is
> that without the call, the current sal will not be up to date if
> `edit' or `list' are called inside a hook-stop.
I think the patch ought to set the sal regardless of whether a stop
hook is defined. However, there's something more complicated going on.
The obvious patch from my description causes lots of test failures like
this one:
(gdb) PASS: gdb.base/call-ar-st.exp: run until breakpoint set at a line
print print_double_array(double_array)
array_d :
=========
0.000000
23.456700 46.913400 70.370100 93.826800 117.283500 140.740200
164.196900 187.653600
$1 = void
(gdb) PASS: gdb.base/call-ar-st.exp: print
print_double_array(double_array)
print print_char_array(char_array)
array_c :
=========
Z
aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ
aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ
aZaZaZaZaZaZaZaZaZa
$2 = void
(gdb) PASS: gdb.base/call-ar-st.exp: print print_char_array(char_array)
tbreak 1216
No line 1216 in file "../sysdeps/x86_64/elf/start.S".
(gdb) FAIL: gdb.base/call-ar-st.exp: tbreakpoint line 1216
The reason we're suddenly in start.S is that the breakpoint we hit
after calling print_double_array is in _start. So the right patch
would actually look like the attached.
Is this better?
--
Daniel Jacobowitz
CodeSourcery
2006-03-01 Daniel Jacobowitz <dan@codesourcery.com>
* frame.h (set_current_sal_from_frame): New prototype.
* stack.c (set_current_sal_from_frame): Make global.
* infrun.c (normal_stop): Call set_current_sal_from_frame.
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.147
diff -u -p -r1.147 frame.h
--- frame.h 17 Dec 2005 22:33:59 -0000 1.147
+++ frame.h 1 Mar 2006 17:53:12 -0000
@@ -300,6 +300,12 @@ extern CORE_ADDR get_frame_func (struct
extern void find_frame_sal (struct frame_info *frame,
struct symtab_and_line *sal);
+/* Set the current source and line to the location given by frame
+ FRAME, if possible. When CENTER is true, adjust so the relevant
+ line is in the center of the next 'list'. */
+
+void set_current_sal_from_frame (struct frame_info *, int);
+
/* Return the frame base (what ever that is) (DEPRECATED).
Old code was trying to use this single method for two conflicting
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.209
diff -u -p -r1.209 infrun.c
--- infrun.c 4 Jan 2006 19:34:58 -0000 1.209
+++ infrun.c 1 Mar 2006 17:53:13 -0000
@@ -3044,6 +3044,12 @@ Further execution is probably impossible
target_terminal_ours ();
+ /* Set the current source location. This will also happen if we
+ display the frame below, but the current SAL will be incorrect
+ during a user hook-stop function. */
+ if (target_has_stack && !stop_stack_dummy)
+ set_current_sal_from_frame (get_current_frame (), 1);
+
/* Look up the hook_stop and run it (CLI internally handles problem
of stop_command's pre-hook not existing). */
if (stop_command)
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.137
diff -u -p -r1.137 stack.c
--- stack.c 17 Dec 2005 22:34:03 -0000 1.137
+++ stack.c 1 Mar 2006 17:53:14 -0000
@@ -61,8 +61,6 @@ static void print_frame (struct frame_in
enum print_what print_what, int print_args,
struct symtab_and_line sal);
-static void set_current_sal_from_frame (struct frame_info *, int);
-
/* Zero means do things normally; we are interacting directly with the
user. One means print the full filename and linenumber when a
frame is printed, and do so in a format emacs18/emacs19.22 can
@@ -373,7 +371,7 @@ print_args_stub (void *args)
FRAME, if possible. When CENTER is true, adjust so the relevant
line is in the center of the next 'list'. */
-static void
+void
set_current_sal_from_frame (struct frame_info *frame, int center)
{
struct symtab_and_line sal;
next prev parent reply other threads:[~2006-03-01 17:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-23 18:21 Jason Kraftcheck
2006-02-23 21:13 ` Daniel Jacobowitz
2006-02-23 22:52 ` Jason Kraftcheck
2006-02-24 7:53 ` Eli Zaretskii
2006-02-28 18:49 ` Jason Kraftcheck
2006-02-28 22:33 ` Eli Zaretskii
2006-03-01 17:58 ` Daniel Jacobowitz [this message]
2006-03-01 19:19 ` Eli Zaretskii
2006-03-30 16:48 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060301175814.GB6465@nevyn.them.org \
--to=drow@false.org \
--cc=eliz@gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=kraftche@cae.wisc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox