This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH V2 4/5] Add bound related fields to the siginfo structure.
- From: Walfred Tedeschi <walfred dot tedeschi at intel dot com>
- To: palves at redhat dot com, brobecker at adacore dot com
- Cc: gdb-patches at sourceware dot org, Walfred Tedeschi <walfred dot tedeschi at intel dot com>
- Date: Thu, 17 Dec 2015 17:56:55 +0100
- Subject: [PATCH V2 4/5] Add bound related fields to the siginfo structure.
- Authentication-results: sourceware.org; auth=none
- References: <1450371416-24270-1-git-send-email-walfred dot tedeschi at intel dot com>
New kernel and glibc patches have introduced fields in the
segmentation fault fields. New fields will be conditional and requested
on demand by the customers.
Kernel patch:
http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=ee1b58d36aa1b5a79eaba11f5c3633c88231da83
Glibc patch:
http://repo.or.cz/w/glibc.git/commit/d4358b51c26a634eb885955aea06cad26af6f696
2015-12-08 Walfred Tedeschi <walfred.tedeschi@intel.com>
* linux-tdep.c (linux_get_siginfo_type): Add the _addr_bnd
structure to the siginfo conditionally if extra_fields is
LINUX_SIGINFO_FIELD_ADDR_BND.
---
gdb/linux-tdep.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index e41b6f4..73c70cb 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -251,7 +251,7 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
linux_siginfo_extra_fields extra_fields)
{
struct linux_gdbarch_data *linux_gdbarch_data;
- struct type *int_type, *uint_type, *long_type, *void_ptr_type;
+ struct type *int_type, *uint_type, *long_type, *void_ptr_type, *short_type;
struct type *uid_type, *pid_type;
struct type *sigval_type, *clock_type;
struct type *siginfo_type, *sifields_type;
@@ -267,6 +267,8 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
1, "unsigned int");
long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
0, "long");
+ short_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+ 0, "short");
void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
/* sival_t */
@@ -344,6 +346,18 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
append_composite_type_field (type, "si_addr", void_ptr_type);
append_composite_type_field (sifields_type, "_sigfault", type);
+ if (extra_fields == LINUX_SIGINFO_FIELD_ADDR_BND)
+ {
+ struct type *sigfault_bnd_fields;
+
+ append_composite_type_field (type, "_addr_lsb", short_type);
+ sigfault_bnd_fields = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
+ append_composite_type_field (sigfault_bnd_fields, "_lower", void_ptr_type);
+ append_composite_type_field (sigfault_bnd_fields, "_upper", void_ptr_type);
+ append_composite_type_field (type, "_addr_bnd", sigfault_bnd_fields);
+ append_composite_type_field (sifields_type, "_sigfault", type);
+ }
+
/* _sigpoll */
type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
append_composite_type_field (type, "si_band", long_type);
--
2.1.4