Re: gdb segv in arm disassembler

Nick Clifton
2010-01-28T12:48:28Z

Hi Daniel,

>> On Mon, Jan 25, 2010 at 06:22:55PM -0800, Doug Evans wrote:
>> I'm getting a segv in the arm disassembler when invoked from gdb,

> Yes. Sorry - I have a patch for this but I have got stuck travelling
> instead of finishing the patch series it's part of.
>
> I think this is the appropriate fix:
> - int is_data = (bfd_asymbol_flavour (*info->symtab)
> - == bfd_target_elf_flavour) ? TRUE : FALSE;
> + int is_data = FALSE;

Unfortunately this introduces a new failure into the GAS testsuite.

How about this version instead ?

Cheers
Nick

Index: opcodes/arm-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arm-dis.c,v
retrieving revision 1.122
diff -c -3 -p -r1.122 arm-dis.c
*** opcodes/arm-dis.c 20 Jan 2010 10:54:03 -0000 1.122
--- opcodes/arm-dis.c 28 Jan 2010 12:46:17 -0000
*************** print_insn (bfd_vma pc, struct disassemb
*** 4355,4367 ****
long given;
int status;
int is_thumb = FALSE;
! int is_data = (bfd_asymbol_flavour (*info->symtab)
! == bfd_target_elf_flavour) ? TRUE : FALSE;
int little_code;
unsigned int size = 4;
void (*printer) (bfd_vma, struct disassemble_info *, long);
bfd_boolean found = FALSE;

if (info->disassembler_options)
{
parse_disassembler_options (info->disassembler_options);
--- 4355,4373 ----
long given;
int status;
int is_thumb = FALSE;
! int is_data = FALSE;
int little_code;
unsigned int size = 4;
void (*printer) (bfd_vma, struct disassemble_info *, long);
bfd_boolean found = FALSE;

+ /* On ELF based systems we use special mapping symbols to tell us
+ where regions of code occur, so in the absence of such symbols
+ we default to treating the words as data. */
+ if (info->symtab != NULL
+ && bfd_asymbol_flavour (*info->symtab) == bfd_target_elf_flavour)
+ is_data = TRUE;
+
if (info->disassembler_options)
{
parse_disassembler_options (info->disassembler_options);