Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: dgutson@codesourcery.com, gdb@sourceware.org, binutils@sourceware.org
Subject: gdb segv in arm disassembler
Date: Tue, 26 Jan 2010 02:23:00 -0000	[thread overview]
Message-ID: <20100126022255.344B284414@ruffy.mtv.corp.google.com> (raw)

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;


             reply	other threads:[~2010-01-26  2:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26  2:23 Doug Evans [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100126022255.344B284414@ruffy.mtv.corp.google.com \
    --to=dje@google.com \
    --cc=binutils@sourceware.org \
    --cc=dgutson@codesourcery.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox