diff options
author | Aleksandar Ristovski <aristovski@qnx.com> | 2008-05-01 19:31:52 +0000 |
---|---|---|
committer | Aleksandar Ristovski <aristovski@qnx.com> | 2008-05-01 19:31:52 +0000 |
commit | 1cded358ac11bda3c08ed79b99e304b3d120b301 (patch) | |
tree | b47e91d6b2813a039a923cf8af7b6d0839676ce3 /gdb | |
parent | a0ef42744d050b642351a3974faca030269f5504 (diff) | |
download | gdb-1cded358ac11bda3c08ed79b99e304b3d120b301.zip gdb-1cded358ac11bda3c08ed79b99e304b3d120b301.tar.gz gdb-1cded358ac11bda3c08ed79b99e304b3d120b301.tar.bz2 |
PR gdb/2343
* corelow.c (core_open): Use gdbarch_target_signal_from_host to
translate signal numeric value from the target to GDB's enum
target_signal.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbarch.sh: Added two new functions target_signal_from_host and
target_signal_to_host.
* target.h (default_target_signal_from_host,
default_target_signal_to_host): New functions - declarations.
* signals/signals.c (struct gdbarch): New declaration.
(default_target_signal_to_host, default_target_signal_from_host): New
functions.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 15 | ||||
-rw-r--r-- | gdb/corelow.c | 3 | ||||
-rw-r--r-- | gdb/gdbarch.c | 48 | ||||
-rw-r--r-- | gdb/gdbarch.h | 14 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 7 | ||||
-rw-r--r-- | gdb/signals/signals.c | 14 | ||||
-rw-r--r-- | gdb/target.h | 5 |
7 files changed, 105 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f604794..8ecbe8f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2008-05-01 Aleksandar Riswtovski <aristovski@qnx.com> + + PR gdb/2343 + * corelow.c (core_open): Use gdbarch_target_signal_from_host to + translate signal numeric value from the target to GDB's enum + target_signal. + * gdbarch.c, gdbarch.h: Regenerated. + * gdbarch.sh: Added two new functions target_signal_from_host and + target_signal_to_host. + * target.h (default_target_signal_from_host, + default_target_signal_to_host): New functions - declarations. + * signals/signals.c (struct gdbarch): New declaration. + (default_target_signal_to_host, default_target_signal_from_host): New + functions. + 2008-05-01 Daniel Jacobowitz <dan@codesourcery.com> * arm-linux-tdep.h (ARM_CPSR_REGNUM): Delete definition. diff --git a/gdb/corelow.c b/gdb/corelow.c index 061743b..28b61e5 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -359,7 +359,8 @@ core_open (char *filename, int from_tty) value is called ``target_signal'' and this function got the name ..._from_host(). */ printf_filtered (_("Program terminated with signal %d, %s.\n"), siggy, - target_signal_to_string (target_signal_from_host (siggy))); + target_signal_to_string ( + gdbarch_target_signal_from_host (core_gdbarch, siggy))); /* Build up thread list from BFD sections. */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 7984423..dd13de1 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -230,6 +230,8 @@ struct gdbarch gdbarch_core_read_description_ftype *core_read_description; gdbarch_static_transform_name_ftype *static_transform_name; int sofun_address_maybe_missing; + gdbarch_target_signal_from_host_ftype *target_signal_from_host; + gdbarch_target_signal_to_host_ftype *target_signal_to_host; }; @@ -352,6 +354,8 @@ struct gdbarch startup_gdbarch = 0, /* core_read_description */ 0, /* static_transform_name */ 0, /* sofun_address_maybe_missing */ + default_target_signal_from_host, /* target_signal_from_host */ + default_target_signal_to_host, /* target_signal_to_host */ /* startup_gdbarch() */ }; @@ -431,6 +435,8 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->coff_make_msymbol_special = default_coff_make_msymbol_special; gdbarch->name_of_malloc = "malloc"; gdbarch->register_reggroup_p = default_register_reggroup_p; + gdbarch->target_signal_from_host = default_target_signal_from_host; + gdbarch->target_signal_to_host = default_target_signal_to_host; /* gdbarch_alloc() */ return gdbarch; @@ -590,6 +596,8 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of core_read_description, has predicate */ /* Skip verify of static_transform_name, has predicate */ /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */ + /* Skip verify of target_signal_from_host, invalid_p == 0 */ + /* Skip verify of target_signal_to_host, invalid_p == 0 */ buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -985,6 +993,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: target_desc = %s\n", paddr_d ((long) gdbarch->target_desc)); fprintf_unfiltered (file, + "gdbarch_dump: target_signal_from_host = <0x%lx>\n", + (long) gdbarch->target_signal_from_host); + fprintf_unfiltered (file, + "gdbarch_dump: target_signal_to_host = <0x%lx>\n", + (long) gdbarch->target_signal_to_host); + fprintf_unfiltered (file, "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n", gdbarch_unwind_pc_p (gdbarch)); fprintf_unfiltered (file, @@ -2981,6 +2995,40 @@ set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch, gdbarch->sofun_address_maybe_missing = sofun_address_maybe_missing; } +enum target_signal +gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->target_signal_from_host != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_target_signal_from_host called\n"); + return gdbarch->target_signal_from_host (gdbarch, signo); +} + +void +set_gdbarch_target_signal_from_host (struct gdbarch *gdbarch, + gdbarch_target_signal_from_host_ftype target_signal_from_host) +{ + gdbarch->target_signal_from_host = target_signal_from_host; +} + +int +gdbarch_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->target_signal_to_host != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_target_signal_to_host called\n"); + return gdbarch->target_signal_to_host (gdbarch, ts); +} + +void +set_gdbarch_target_signal_to_host (struct gdbarch *gdbarch, + gdbarch_target_signal_to_host_ftype target_signal_to_host) +{ + gdbarch->target_signal_to_host = target_signal_to_host; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index e568993..baba7c7 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -690,6 +690,20 @@ extern void set_gdbarch_static_transform_name (struct gdbarch *gdbarch, gdbarch_ extern int gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch); extern void set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch, int sofun_address_maybe_missing); +/* Signal translation: translate inferior's signal (host's) number into + GDB's representation. */ + +typedef enum target_signal (gdbarch_target_signal_from_host_ftype) (struct gdbarch *gdbarch, int signo); +extern enum target_signal gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo); +extern void set_gdbarch_target_signal_from_host (struct gdbarch *gdbarch, gdbarch_target_signal_from_host_ftype *target_signal_from_host); + +/* Signal translation: translate GDB's signal number into inferior's host + signal number. */ + +typedef int (gdbarch_target_signal_to_host_ftype) (struct gdbarch *gdbarch, enum target_signal ts); +extern int gdbarch_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts); +extern void set_gdbarch_target_signal_to_host (struct gdbarch *gdbarch, gdbarch_target_signal_to_host_ftype *target_signal_to_host); + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index e3efdc8..9f04f08 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -625,6 +625,13 @@ M:const struct target_desc *:core_read_description:struct target_ops *target, bf F:char *:static_transform_name:char *name:name # Set if the address in N_SO or N_FUN stabs may be zero. v:int:sofun_address_maybe_missing:::0:0::0 + +# 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 +# Signal translation: translate GDB's signal number into inferior's host +# signal number. +m:int:target_signal_to_host:enum target_signal ts:ts::default_target_signal_to_host::0 EOF } diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c index 204b8e2..9f85a98 100644 --- a/gdb/signals/signals.c +++ b/gdb/signals/signals.c @@ -30,6 +30,8 @@ #include <signal.h> #endif +struct gdbarch; + /* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest _available_ realtime signal, not the lowest supported; glibc takes several for its own use. */ @@ -831,3 +833,15 @@ _initialize_signals (void) internal_error (__FILE__, __LINE__, "failed internal consistency check"); } #endif + +int +default_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts) +{ + return target_signal_to_host (ts); +} + +enum target_signal +default_target_signal_from_host (struct gdbarch *gdbarch, int signo) +{ + return target_signal_from_host (signo); +} diff --git a/gdb/target.h b/gdb/target.h index e0341e1..84cd008 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1233,6 +1233,11 @@ extern int target_signal_to_host_p (enum target_signal signo); extern enum target_signal target_signal_from_host (int); extern int target_signal_to_host (enum target_signal); +extern enum target_signal default_target_signal_from_host (struct gdbarch *, + int); +extern int default_target_signal_to_host (struct gdbarch *, + enum target_signal); + /* Convert from a number used in a GDB command to an enum target_signal. */ extern enum target_signal target_signal_from_command (int); |