From: Max Filippov Date: Fri, 18 Nov 2016 17:39:41 +0000 (-0800) Subject: gdb: xtensa: clean up xtensa_default_isa initialization X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a43986283d61ffd4d7dc9b20c0ecb73cd345206c;p=binutils-gdb.git 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 * xtensa-tdep.c (xtensa_scan_prologue, call0_analyze_prologue): Drop xtensa_default_isa initialization. (xtensa_gdbarch_init): Initialize xtensa_default_isa. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 106388f0483..0490511ed38 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-03-27 Max Filippov + + * xtensa-tdep.c (xtensa_scan_prologue, call0_analyze_prologue): + Drop xtensa_default_isa initialization. + (xtensa_gdbarch_init): Initialize xtensa_default_isa. + 2017-03-27 Pedro Alves * dwarf2read.c (file_entry) : Add comment. diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 376f4c7340c..efbd5ab1b54 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;