public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] record.c: Add signal handler to record_wait record part
@ 2010-06-04  5:44 Hui Zhu
  2010-06-08  2:31 ` Hui Zhu
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Zhu @ 2010-06-04  5:44 UTC (permalink / raw)
  To: gdb-patches ml

Hi,

I got some error with prec:

(top-gdb) start
Temporary breakpoint 3 at 0x8053bf8: file ../../src/gdb/gdb.c, line 29.
Starting program: /home/teawater/gdb/bgdbno/gdb/gdb
[Thread debugging using libthread_db enabled]

Temporary breakpoint 3, main (argc=
During symbol reading, incomplete CFI data; unspecified registers
(e.g., eax) at 0x8053bf3.
1, argv=0xbffff594) at ../../src/gdb/gdb.c:29
29	  memset (&args, 0, sizeof args);
(top-gdb) record
(top-gdb) c
Continuing.
warning: Process record ignores the memory change of instruction at
address 0xb7c0b2e0 because it can't get the value of the segment
register.
Quit
(top-gdb) si
Cannot execute this command while the selected thread is running.


This is because after gdb output, the signal handler switch to gdb
part.  So this ctrl-c make inferior stop not right.

So I make a patch that move the replay patch out of check to handle record too.

Thanks,
Hui

2010-06-04  Hui Zhu  <teawater@gmail.com>

	* record.c (record_wait): Move signal out of replay code.


---
 record.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/record.c
+++ b/record.c
@@ -1069,6 +1069,9 @@ record_wait (struct target_ops *ops,
 			"record_resume_step = %d\n",
 			record_resume_step);

+  record_get_sig = 0;
+  signal (SIGINT, record_sig_handler);
+
   if (!RECORD_IS_REPLAY && ops != &record_core_ops)
     {
       if (record_resume_step)
@@ -1088,6 +1091,9 @@ record_wait (struct target_ops *ops,
 	      ret = record_beneath_to_wait (record_beneath_to_wait_ops,
 					    ptid, status, options);

+	      if (record_resume_step)
+	        return ret;
+
 	      /* Is this a SIGTRAP?  */
 	      if (status->kind == TARGET_WAITKIND_STOPPED
 		  && status->value.sig == TARGET_SIGNAL_TRAP)
@@ -1183,8 +1189,6 @@ record_wait (struct target_ops *ops,
 	    }
 	}

-      record_get_sig = 0;
-      signal (SIGINT, record_sig_handler);
       /* If GDB is in terminal_inferior mode, it will not get the signal.
          And in GDB replay mode, GDB doesn't need to be in terminal_inferior
          mode, because inferior will not executed.
@@ -1298,8 +1302,6 @@ Process record: hit hw watchpoint.\n");
 	}
       while (continue_flag);

-      signal (SIGINT, handle_sigint);
-
 replay_out:
       if (record_get_sig)
 	status->value.sig = TARGET_SIGNAL_INT;
@@ -1312,6 +1314,8 @@ replay_out:
       discard_cleanups (old_cleanups);
     }

+  signal (SIGINT, handle_sigint);
+
   do_cleanups (set_cleanups);
   return inferior_ptid;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] record.c: Add signal handler to record_wait record part
  2010-06-04  5:44 [PATCH] record.c: Add signal handler to record_wait record part Hui Zhu
@ 2010-06-08  2:31 ` Hui Zhu
  0 siblings, 0 replies; 2+ messages in thread
From: Hui Zhu @ 2010-06-08  2:31 UTC (permalink / raw)
  To: gdb-patches ml

Checked in.

On Fri, Jun 4, 2010 at 13:44, Hui Zhu <teawater@gmail.com> wrote:
> Hi,
>
> I got some error with prec:
>
> (top-gdb) start
> Temporary breakpoint 3 at 0x8053bf8: file ../../src/gdb/gdb.c, line 29.
> Starting program: /home/teawater/gdb/bgdbno/gdb/gdb
> [Thread debugging using libthread_db enabled]
>
> Temporary breakpoint 3, main (argc=
> During symbol reading, incomplete CFI data; unspecified registers
> (e.g., eax) at 0x8053bf3.
> 1, argv=0xbffff594) at ../../src/gdb/gdb.c:29
> 29        memset (&args, 0, sizeof args);
> (top-gdb) record
> (top-gdb) c
> Continuing.
> warning: Process record ignores the memory change of instruction at
> address 0xb7c0b2e0 because it can't get the value of the segment
> register.
> Quit
> (top-gdb) si
> Cannot execute this command while the selected thread is running.
>
>
> This is because after gdb output, the signal handler switch to gdb
> part.  So this ctrl-c make inferior stop not right.
>
> So I make a patch that move the replay patch out of check to handle record too.
>
> Thanks,
> Hui
>
> 2010-06-04  Hui Zhu  <teawater@gmail.com>
>
>        * record.c (record_wait): Move signal out of replay code.
>
>
> ---
>  record.c |   12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> --- a/record.c
> +++ b/record.c
> @@ -1069,6 +1069,9 @@ record_wait (struct target_ops *ops,
>                        "record_resume_step = %d\n",
>                        record_resume_step);
>
> +  record_get_sig = 0;
> +  signal (SIGINT, record_sig_handler);
> +
>   if (!RECORD_IS_REPLAY && ops != &record_core_ops)
>     {
>       if (record_resume_step)
> @@ -1088,6 +1091,9 @@ record_wait (struct target_ops *ops,
>              ret = record_beneath_to_wait (record_beneath_to_wait_ops,
>                                            ptid, status, options);
>
> +             if (record_resume_step)
> +               return ret;
> +
>              /* Is this a SIGTRAP?  */
>              if (status->kind == TARGET_WAITKIND_STOPPED
>                  && status->value.sig == TARGET_SIGNAL_TRAP)
> @@ -1183,8 +1189,6 @@ record_wait (struct target_ops *ops,
>            }
>        }
>
> -      record_get_sig = 0;
> -      signal (SIGINT, record_sig_handler);
>       /* If GDB is in terminal_inferior mode, it will not get the signal.
>          And in GDB replay mode, GDB doesn't need to be in terminal_inferior
>          mode, because inferior will not executed.
> @@ -1298,8 +1302,6 @@ Process record: hit hw watchpoint.\n");
>        }
>       while (continue_flag);
>
> -      signal (SIGINT, handle_sigint);
> -
>  replay_out:
>       if (record_get_sig)
>        status->value.sig = TARGET_SIGNAL_INT;
> @@ -1312,6 +1314,8 @@ replay_out:
>       discard_cleanups (old_cleanups);
>     }
>
> +  signal (SIGINT, handle_sigint);
> +
>   do_cleanups (set_cleanups);
>   return inferior_ptid;
>  }
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-08  2:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-04  5:44 [PATCH] record.c: Add signal handler to record_wait record part Hui Zhu
2010-06-08  2:31 ` Hui Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).