Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Make the prec support signal better[1/4] -- gdbarch
@ 2009-09-09 13:29 Hui Zhu
  2009-09-09 20:36 ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Hui Zhu @ 2009-09-09 13:29 UTC (permalink / raw)
  To: gdb-patches ml; +Cc: Michael Snyder

[-- Attachment #1: Type: text/plain, Size: 4984 bytes --]

This patch add a arch interface "process_record_signal".  When
inferior get a signal, record will call it to let arch record this
sig.

2009-09-09  Michael Snyder  <msnyder@vmware.com>
	    Hui Zhu  <teawater@gmail.com>

	* gdbarch.sh (process_record_signal): New interface.

---
 gdbarch.c  |   33 +++++++++++++++++++++++++++++++++
 gdbarch.h  |    9 +++++++++
 gdbarch.sh |    4 ++++
 3 files changed, 46 insertions(+)

--- a/gdbarch.c
+++ b/gdbarch.c
@@ -240,6 +240,7 @@ struct gdbarch
   gdbarch_static_transform_name_ftype *static_transform_name;
   int sofun_address_maybe_missing;
   gdbarch_process_record_ftype *process_record;
+  gdbarch_process_record_signal_ftype *process_record_signal;
   gdbarch_target_signal_from_host_ftype *target_signal_from_host;
   gdbarch_target_signal_to_host_ftype *target_signal_to_host;
   gdbarch_get_siginfo_type_ftype *get_siginfo_type;
@@ -377,6 +378,7 @@ struct gdbarch startup_gdbarch =
   0,  /* static_transform_name */
   0,  /* sofun_address_maybe_missing */
   0,  /* process_record */
+  0,  /* process_record_signal */
   default_target_signal_from_host,  /* target_signal_from_host */
   default_target_signal_to_host,  /* target_signal_to_host */
   0,  /* get_siginfo_type */
@@ -633,6 +635,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of static_transform_name, has predicate */
   /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
   /* Skip verify of process_record, has predicate */
+  /* Skip verify of process_record_signal, has predicate */
   /* Skip verify of target_signal_from_host, invalid_p == 0 */
   /* Skip verify of target_signal_to_host, invalid_p == 0 */
   /* Skip verify of get_siginfo_type, has predicate */
@@ -962,6 +965,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: process_record = <%s>\n",
                       host_address_to_string (gdbarch->process_record));
   fprintf_unfiltered (file,
+                      "gdbarch_dump: gdbarch_process_record_signal_p() = %d\n",
+                      gdbarch_process_record_signal_p (gdbarch));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: process_record_signal = <%s>\n",
+                      host_address_to_string (gdbarch->process_record_signal));
+  fprintf_unfiltered (file,
                       "gdbarch_dump: ps_regnum = %s\n",
                       plongest (gdbarch->ps_regnum));
   fprintf_unfiltered (file,
@@ -3298,6 +3307,30 @@ set_gdbarch_process_record (struct gdbar
   gdbarch->process_record = process_record;
 }

+int
+gdbarch_process_record_signal_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->process_record_signal != NULL;
+}
+
+int
+gdbarch_process_record_signal (struct gdbarch *gdbarch, struct
regcache *regcache, enum target_signal signal)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->process_record_signal != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record_signal called\n");
+  return gdbarch->process_record_signal (gdbarch, regcache, signal);
+}
+
+void
+set_gdbarch_process_record_signal (struct gdbarch *gdbarch,
+
gdbarch_process_record_signal_ftype process_record_signal)
+{
+  gdbarch->process_record_signal = process_record_signal;
+}
+
 enum target_signal
 gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo)
 {
--- a/gdbarch.h
+++ b/gdbarch.h
@@ -821,6 +821,15 @@ typedef int (gdbarch_process_record_ftyp
 extern int gdbarch_process_record (struct gdbarch *gdbarch, struct
regcache *regcache, CORE_ADDR addr);
 extern void set_gdbarch_process_record (struct gdbarch *gdbarch,
gdbarch_process_record_ftype *process_record);

+/* Save process state after a signal.
+   Return -1 if something goes wrong, 0 otherwise. */
+
+extern int gdbarch_process_record_signal_p (struct gdbarch *gdbarch);
+
+typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch
*gdbarch, struct regcache *regcache, enum target_signal signal);
+extern int gdbarch_process_record_signal (struct gdbarch *gdbarch,
struct regcache *regcache, enum target_signal signal);
+extern void set_gdbarch_process_record_signal (struct gdbarch
*gdbarch, gdbarch_process_record_signal_ftype *process_record_signal);
+
 /* Signal translation: translate inferior's signal (host's) number into
    GDB's representation. */

--- a/gdbarch.sh
+++ b/gdbarch.sh
@@ -709,6 +709,10 @@ v:int:sofun_address_maybe_missing:::0:0:
 # Return -1 if something goes wrong, 0 otherwise.
 M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr

+# Save process state after a signal.
+# Return -1 if something goes wrong, 0 otherwise.
+M:int:process_record_signal:struct regcache *regcache, enum
target_signal signal:regcache, signal
+
 # Signal translation: translate inferior's signal (host's) number into
 # GDB's representation.
 m:enum target_signal:target_signal_from_host:int
signo:signo::default_target_signal_from_host::0

[-- Attachment #2: prec-support-signal-gdbarch.txt --]
[-- Type: text/plain, Size: 4746 bytes --]

---
 gdbarch.c  |   33 +++++++++++++++++++++++++++++++++
 gdbarch.h  |    9 +++++++++
 gdbarch.sh |    4 ++++
 3 files changed, 46 insertions(+)

--- a/gdbarch.c
+++ b/gdbarch.c
@@ -240,6 +240,7 @@ struct gdbarch
   gdbarch_static_transform_name_ftype *static_transform_name;
   int sofun_address_maybe_missing;
   gdbarch_process_record_ftype *process_record;
+  gdbarch_process_record_signal_ftype *process_record_signal;
   gdbarch_target_signal_from_host_ftype *target_signal_from_host;
   gdbarch_target_signal_to_host_ftype *target_signal_to_host;
   gdbarch_get_siginfo_type_ftype *get_siginfo_type;
@@ -377,6 +378,7 @@ struct gdbarch startup_gdbarch =
   0,  /* static_transform_name */
   0,  /* sofun_address_maybe_missing */
   0,  /* process_record */
+  0,  /* process_record_signal */
   default_target_signal_from_host,  /* target_signal_from_host */
   default_target_signal_to_host,  /* target_signal_to_host */
   0,  /* get_siginfo_type */
@@ -633,6 +635,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of static_transform_name, has predicate */
   /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
   /* Skip verify of process_record, has predicate */
+  /* Skip verify of process_record_signal, has predicate */
   /* Skip verify of target_signal_from_host, invalid_p == 0 */
   /* Skip verify of target_signal_to_host, invalid_p == 0 */
   /* Skip verify of get_siginfo_type, has predicate */
@@ -962,6 +965,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: process_record = <%s>\n",
                       host_address_to_string (gdbarch->process_record));
   fprintf_unfiltered (file,
+                      "gdbarch_dump: gdbarch_process_record_signal_p() = %d\n",
+                      gdbarch_process_record_signal_p (gdbarch));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: process_record_signal = <%s>\n",
+                      host_address_to_string (gdbarch->process_record_signal));
+  fprintf_unfiltered (file,
                       "gdbarch_dump: ps_regnum = %s\n",
                       plongest (gdbarch->ps_regnum));
   fprintf_unfiltered (file,
@@ -3298,6 +3307,30 @@ set_gdbarch_process_record (struct gdbar
   gdbarch->process_record = process_record;
 }
 
+int
+gdbarch_process_record_signal_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->process_record_signal != NULL;
+}
+
+int
+gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal)
+{
+  gdb_assert (gdbarch != NULL);
+  gdb_assert (gdbarch->process_record_signal != NULL);
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record_signal called\n");
+  return gdbarch->process_record_signal (gdbarch, regcache, signal);
+}
+
+void
+set_gdbarch_process_record_signal (struct gdbarch *gdbarch,
+                                   gdbarch_process_record_signal_ftype process_record_signal)
+{
+  gdbarch->process_record_signal = process_record_signal;
+}
+
 enum target_signal
 gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo)
 {
--- a/gdbarch.h
+++ b/gdbarch.h
@@ -821,6 +821,15 @@ typedef int (gdbarch_process_record_ftyp
 extern int gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
 extern void set_gdbarch_process_record (struct gdbarch *gdbarch, gdbarch_process_record_ftype *process_record);
 
+/* Save process state after a signal.
+   Return -1 if something goes wrong, 0 otherwise. */
+
+extern int gdbarch_process_record_signal_p (struct gdbarch *gdbarch);
+
+typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal);
+extern int gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal);
+extern void set_gdbarch_process_record_signal (struct gdbarch *gdbarch, gdbarch_process_record_signal_ftype *process_record_signal);
+
 /* Signal translation: translate inferior's signal (host's) number into
    GDB's representation. */
 
--- a/gdbarch.sh
+++ b/gdbarch.sh
@@ -709,6 +709,10 @@ v:int:sofun_address_maybe_missing:::0:0:
 # Return -1 if something goes wrong, 0 otherwise.
 M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr
 
+# Save process state after a signal.
+# Return -1 if something goes wrong, 0 otherwise.
+M:int:process_record_signal:struct regcache *regcache, enum target_signal signal:regcache, signal
+
 # Signal translation: translate inferior's signal (host's) number into
 # GDB's representation.
 m:enum target_signal:target_signal_from_host:int signo:signo::default_target_signal_from_host::0

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

* Re: [RFA] Make the prec support signal better[1/4] -- gdbarch
  2009-09-09 13:29 [RFA] Make the prec support signal better[1/4] -- gdbarch Hui Zhu
@ 2009-09-09 20:36 ` Michael Snyder
  2009-09-10  1:47   ` Hui Zhu
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2009-09-09 20:36 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches ml

Hui Zhu wrote:
> This patch add a arch interface "process_record_signal".  When
> inferior get a signal, record will call it to let arch record this
> sig.
> 
> 2009-09-09  Michael Snyder  <msnyder@vmware.com>
> 	    Hui Zhu  <teawater@gmail.com>


Dude, you need to put your name first!
This is mostly your work -- don't be so modest.   ;-)


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

* Re: [RFA] Make the prec support signal better[1/4] -- gdbarch
  2009-09-09 20:36 ` Michael Snyder
@ 2009-09-10  1:47   ` Hui Zhu
  2009-09-10 19:19     ` Michael Snyder
  0 siblings, 1 reply; 5+ messages in thread
From: Hui Zhu @ 2009-09-10  1:47 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches ml

On Thu, Sep 10, 2009 at 04:34, Michael Snyder<msnyder@vmware.com> wrote:
> Hui Zhu wrote:
>>
>> This patch add a arch interface "process_record_signal".  When
>> inferior get a signal, record will call it to let arch record this
>> sig.
>>
>> 2009-09-09  Michael Snyder  <msnyder@vmware.com>
>>            Hui Zhu  <teawater@gmail.com>
>
>
> Dude, you need to put your name first!
> This is mostly your work -- don't be so modest.   ;-)
>
>

Hi Michael,

Most of the signal idea is from you.  Record the stack, record the
signal in record_end, add special interface.
Even if in alphabetic, your name is in first.

Thanks,
Hui


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

* Re: [RFA] Make the prec support signal better[1/4] -- gdbarch
  2009-09-10  1:47   ` Hui Zhu
@ 2009-09-10 19:19     ` Michael Snyder
  2009-09-12  0:54       ` Hui Zhu
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2009-09-10 19:19 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches ml

Hui Zhu wrote:
> On Thu, Sep 10, 2009 at 04:34, Michael Snyder<msnyder@vmware.com> wrote:
>> Hui Zhu wrote:
>>> This patch add a arch interface "process_record_signal".  When
>>> inferior get a signal, record will call it to let arch record this
>>> sig.
>>>
>>> 2009-09-09  Michael Snyder  <msnyder@vmware.com>
>>>            Hui Zhu  <teawater@gmail.com>
>>
>> Dude, you need to put your name first!
>> This is mostly your work -- don't be so modest.   ;-)
>>
>>
> 
> Hi Michael,
> 
> Most of the signal idea is from you.  Record the stack, record the
> signal in record_end, add special interface.
> Even if in alphabetic, your name is in first.

Nah, dude -- seriously.  I want to contribute to prec,
but I don't want to take credit away from you.
You did all this work -- you should take credit!


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

* Re: [RFA] Make the prec support signal better[1/4] -- gdbarch
  2009-09-10 19:19     ` Michael Snyder
@ 2009-09-12  0:54       ` Hui Zhu
  0 siblings, 0 replies; 5+ messages in thread
From: Hui Zhu @ 2009-09-12  0:54 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches ml

On Fri, Sep 11, 2009 at 03:17, Michael Snyder <msnyder@vmware.com> wrote:
> Hui Zhu wrote:
>>
>> On Thu, Sep 10, 2009 at 04:34, Michael Snyder<msnyder@vmware.com> wrote:
>>>
>>> Hui Zhu wrote:
>>>>
>>>> This patch add a arch interface "process_record_signal".  When
>>>> inferior get a signal, record will call it to let arch record this
>>>> sig.
>>>>
>>>> 2009-09-09  Michael Snyder  <msnyder@vmware.com>
>>>>           Hui Zhu  <teawater@gmail.com>
>>>
>>> Dude, you need to put your name first!
>>> This is mostly your work -- don't be so modest.   ;-)
>>>
>>>
>>
>> Hi Michael,
>>
>> Most of the signal idea is from you.  Record the stack, record the
>> signal in record_end, add special interface.
>> Even if in alphabetic, your name is in first.
>
> Nah, dude -- seriously.  I want to contribute to prec,
> but I don't want to take credit away from you.
> You did all this work -- you should take credit!
>
>

OK.  I will change them when this patch checked in.

Thanks,
Hui


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

end of thread, other threads:[~2009-09-12  0:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-09 13:29 [RFA] Make the prec support signal better[1/4] -- gdbarch Hui Zhu
2009-09-09 20:36 ` Michael Snyder
2009-09-10  1:47   ` Hui Zhu
2009-09-10 19:19     ` Michael Snyder
2009-09-12  0:54       ` Hui Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox