Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jason Kraftcheck <kraftche@cae.wisc.edu>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: fix list/edit command in hook-stop
Date: Thu, 23 Feb 2006 22:52:00 -0000	[thread overview]
Message-ID: <43FE336D.1010502@cae.wisc.edu> (raw)
In-Reply-To: <20060223210220.GC2353@nevyn.them.org>

Daniel Jacobowitz wrote:
> On Thu, Feb 23, 2006 at 12:20:14PM -0600, Jason Kraftcheck wrote:
> 
>>An 'edit' or 'list' command in hook-stop doesn't work because the
>>current sal isn't updated until after hook-stop is run.  The following
>>trivial change moves the invocation of hook-stop later in normal_stop.
>>This won't fix the problem in all cases, as the sal is apparently only
>>updated if print_stack_frame is called.  But it doesn't hurt anything
>>and works more often than without the change.
>>
>>
>>2006-02-23  Jason Kraftcheck  <kraftche@cae.wisc.edu>
>>
>>	* infrun.c (normal_stop): call hook-stop handler later, after
>>	  current sal has been set.
> 
> 
>>From the manual:
> 
>    In addition, a pseudo-command, `stop' exists.  Defining
> (`hook-stop') makes the associated commands execute every time
> execution stops in your program: before breakpoint commands are run,
> displays are printed, or the stack frame is printed.
> 
> Your patch would change that; a stop hook which conditionally continued
> would now be noisy instead of silent, so I don't think this is a good
> change.
> 
> Can you just update the sal explicitly, instead of moving things around?
> 
> 


Is this OK?


2006-02-23  Jason Kraftcheck  <kraftche@cae.wisc.edu>

	* infrun.c (normal_stop): Set current SAL before calling
          hook-stop handler so edit and list commands work.
	* frame.h: Add delcaration of set_current_sal_from_frame
	* stack.c: Make set_current_sal_from_frame extern


diff -urp gdb-6.4/gdb/frame.h mod/gdb/frame.h
--- gdb-6.4/gdb/frame.h	2005-05-22 09:53:34.000000000 -0500
+++ mod/gdb/frame.h	2006-02-23 15:33:11.861630699 -0600
@@ -300,6 +300,14 @@ 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'.  */
+extern void set_current_sal_from_frame (struct frame_info * frame,
+                                        int center);
+
+
 /* Return the frame base (what ever that is) (DEPRECATED).

    Old code was trying to use this single method for two conflicting
Only in mod/gdb: gdb-6.4.patch.4
diff -urp gdb-6.4/gdb/infrun.c mod/gdb/infrun.c
--- gdb-6.4/gdb/infrun.c	2005-11-14 09:35:16.000000000 -0600
+++ mod/gdb/infrun.c	2006-02-23 15:28:44.485723627 -0600
@@ -3041,8 +3041,12 @@ Further execution is probably impossible
   /* Look up the hook_stop and run it (CLI internally handles problem
      of stop_command's pre-hook not existing).  */
   if (stop_command)
-    catch_errors (hook_stop_stub, stop_command,
-		  "Error while running hook_stop:\n", RETURN_MASK_ALL);
+    {
+      if (target_has_stack)
+        set_current_sal_from_frame (get_current_frame (), 1);
+      catch_errors (hook_stop_stub, stop_command,
+		    "Error while running hook_stop:\n", RETURN_MASK_ALL);
+    }

   if (!target_has_stack)
     {
diff -urp gdb-6.4/gdb/stack.c mod/gdb/stack.c
--- gdb-6.4/gdb/stack.c	2005-08-18 08:26:41.000000000 -0500
+++ mod/gdb/stack.c	2006-02-23 15:36:40.575237163 -0600
@@ -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;


  reply	other threads:[~2006-02-23 22:13 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 [this message]
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
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=43FE336D.1010502@cae.wisc.edu \
    --to=kraftche@cae.wisc.edu \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    /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