aboutsummaryrefslogtreecommitdiff
path: root/gdb/xtensa-tdep.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2016-11-18 09:39:41 -0800
committerMax Filippov <jcmvbkbc@gmail.com>2017-03-27 12:56:06 -0700
commita43986283d61ffd4d7dc9b20c0ecb73cd345206c (patch)
treeac4568e16eaa155ad4c2be37bba46f407d042ceb /gdb/xtensa-tdep.c
parent8c43009f48a0d4be497cf7c1285784aa70fc5abd (diff)
downloadgdb-a43986283d61ffd4d7dc9b20c0ecb73cd345206c.zip
gdb-a43986283d61ffd4d7dc9b20c0ecb73cd345206c.tar.gz
gdb-a43986283d61ffd4d7dc9b20c0ecb73cd345206c.tar.bz2
gdb: xtensa: clean up xtensa_default_isa initialization
This fixes segfault in native gdb because isa is not initialized at the point of call to xtensa_isa_maxlength. gdb/ 2017-03-27 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.
Diffstat (limited to 'gdb/xtensa-tdep.c')
-rw-r--r--gdb/xtensa-tdep.c7
1 files 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;