This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v3 1/5] gdb: xtensa: clean up xtensa_default_isa initialization
- From: Max Filippov <jcmvbkbc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Cc: Maxim Grigoriev <maxim2405 at gmail dot com>, Woody LaRue <larue at cadence dot com>, Marc Gauthier <marc at cadence dot com>, Luis Machado <lgustavo at codesourcery dot com>, Max Filippov <jcmvbkbc at gmail dot com>
- Date: Wed, 22 Feb 2017 10:31:29 -0800
- Subject: [PATCH v3 1/5] gdb: xtensa: clean up xtensa_default_isa initialization
- Authentication-results: sourceware.org; auth=none
- References: <1487788293-25987-1-git-send-email-jcmvbkbc@gmail.com>
This fixes segfault in native gdb because isa is not initialized at the
point of call to xtensa_isa_maxlength.
gdb/
2017-02-21 Max Filippov <jcmvbkbc@gmail.com>
* xtensa-tdep.c (xtensa_scan_prologue, call0_analyze_prologue):
Drop xtensa_default_isa initialization.
(xtensa_gdbarch_init): Initialize xtensa_default_isa.
---
Changes v1->v2:
- clean up xtensa_default_isa initialization;
- move directory name up in the commit message.
gdb/xtensa-tdep.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 376f4c7..efbd5ab 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -1151,8 +1151,6 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
if (start_addr == 0)
return fp_regnum;
- if (!xtensa_default_isa)
- xtensa_default_isa = xtensa_isa_init (0, 0);
isa = xtensa_default_isa;
gdb_assert (XTENSA_ISA_BSZ >= xtensa_isa_maxlength (isa));
ins = xtensa_insnbuf_alloc (isa);
@@ -2427,8 +2425,6 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
cache->call0 = 1;
rtmp = (xtensa_c0reg_t*) alloca(nregs * sizeof(xtensa_c0reg_t));
- if (!xtensa_default_isa)
- xtensa_default_isa = xtensa_isa_init (0, 0);
isa = xtensa_default_isa;
gdb_assert (XTENSA_ISA_BSZ >= xtensa_isa_maxlength (isa));
ins = xtensa_insnbuf_alloc (isa);
@@ -3186,6 +3182,9 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
DEBUGTRACE ("gdbarch_init()\n");
+ if (!xtensa_default_isa)
+ xtensa_default_isa = xtensa_isa_init (0, 0);
+
/* We have to set the byte order before we call gdbarch_alloc. */
info.byte_order = XCHAL_HAVE_BE ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
--
2.1.4