Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* gdb segv in arm disassembler
@ 2010-01-26  2:23 Doug Evans
  2010-01-26  2:37 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Doug Evans @ 2010-01-26  2:23 UTC (permalink / raw)
  To: dgutson, gdb, binutils

Hi.

I'm getting a segv in the arm disassembler when invoked from gdb,
I think due to this patch.
When invoked from gdb, info->symtab can be NULL.

I'm not sure whether the fix belongs in gdb or libopcodes.

2010-01-06  Daniel Gutson  <dgutson@codesourcery.com>

	* arm-dis.c (print_insn): Fixed search for next symbol and data
	dumping condition, and the initial mapping symbol state.

Index: arm-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arm-dis.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -p -u -p -r1.120 -r1.121
--- arm-dis.c	4 Jan 2010 10:18:32 -0000	1.120
+++ arm-dis.c	6 Jan 2010 15:02:44 -0000	1.121
@@ -4355,7 +4355,8 @@ print_insn (bfd_vma pc, struct disassemb
   long		given;
   int           status;
   int           is_thumb = FALSE;
-  int           is_data = 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);
@@ -4415,7 +4416,7 @@ print_insn (bfd_vma pc, struct disassemb
       bfd_vma addr;
       int n;
       int last_sym = -1;
-      enum map_type type = MAP_ARM;
+      enum map_type type = MAP_DATA;
 
       if (pc <= last_mapping_addr)
 	last_mapping_sym = -1;
@@ -4478,7 +4479,9 @@ print_insn (bfd_vma pc, struct disassemb
 	  for (n = last_sym + 1; n < info->symtab_size; n++)
 	    {
 	      addr = bfd_asymbol_value (info->symtab[n]);
-	      if (addr > pc)
+	      if (addr > pc
+		  && (info->section == NULL
+		      || info->section == info->symtab[n]->section))
 		{
 		  if (addr - pc < size)
 		    size = addr - pc;


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-02-23 12:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-26  2:23 gdb segv in arm disassembler Doug Evans
2010-01-26  2:37 ` Daniel Jacobowitz
2010-01-28 12:48   ` Nick Clifton
2010-01-28 18:27     ` Daniel Jacobowitz
2010-01-28 19:30       ` Daniel Jacobowitz
2010-01-29 10:21         ` Nick Clifton
2010-02-23 12:14       ` Paul Brook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox