diff options
author | Maciej W. Rozycki <macro@imgtec.com> | 2016-10-17 16:15:33 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@imgtec.com> | 2016-10-18 04:42:23 +0100 |
commit | ae71e7b59836219c617193a263b17041d765a031 (patch) | |
tree | 52cc5e5a7f1bc71565472cc35376da2d95049d61 /gdb | |
parent | b348d11b70068e7eabba6d8f99d4ad371c3f6253 (diff) | |
download | gdb-ae71e7b59836219c617193a263b17041d765a031.zip gdb-ae71e7b59836219c617193a263b17041d765a031.tar.gz gdb-ae71e7b59836219c617193a263b17041d765a031.tar.bz2 |
i386-tdep: Verify architecture before proceeding with `set/show mpx'
Make sure the architecture is `bfd_arch_i386' before handling the `set
mpx' and `show mpx' commands, avoiding the issue with `i386_mpx_enabled'
interpreting `gdbarch->tdep' according to the `struct gdbarch_tdep'
definition in i386-tdep.h while indeed in a multi-target configuration
it may have a different layout and cause GDB to crash or at least
misbehave.
gdb/
* i386-tdep.c (i386_mpx_info_bounds): Make sure the architecture
is `bfd_arch_i386' before proceeding.
(i386_mpx_set_bounds): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6bc9805..4b642b8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2016-10-18 Maciej W. Rozycki <macro@imgtec.com> + * i386-tdep.c (i386_mpx_info_bounds): Make sure the architecture + is `bfd_arch_i386' before proceeding. + (i386_mpx_set_bounds): Likewise. + +2016-10-18 Maciej W. Rozycki <macro@imgtec.com> + * tilegx-tdep.c (tilegx_analyze_prologue): Use the `long long' type for `operands'. diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index ccdfec0..da8ff8e 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -8857,7 +8857,8 @@ i386_mpx_info_bounds (char *args, int from_tty) struct gdbarch *gdbarch = get_current_arch (); struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr; - if (!i386_mpx_enabled ()) + if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_i386 + || !i386_mpx_enabled ()) { printf_unfiltered (_("Intel Memory Protection Extensions not " "supported on this target.\n")); @@ -8900,7 +8901,8 @@ i386_mpx_set_bounds (char *args, int from_tty) enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr; - if (!i386_mpx_enabled ()) + if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_i386 + || !i386_mpx_enabled ()) error (_("Intel Memory Protection Extensions not supported\ on this target.")); |