From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2268 invoked by alias); 26 Jan 2010 02:23:18 -0000 Received: (qmail 2252 invoked by uid 22791); 26 Jan 2010 02:23:17 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jan 2010 02:23:02 +0000 Received: from spaceape8.eur.corp.google.com (spaceape8.eur.corp.google.com [172.28.16.142]) by smtp-out.google.com with ESMTP id o0Q2MvfF000903; Tue, 26 Jan 2010 02:22:57 GMT Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.118.116]) by spaceape8.eur.corp.google.com with ESMTP id o0Q2MtkS011351; Mon, 25 Jan 2010 18:22:56 -0800 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id 344B284414; Mon, 25 Jan 2010 18:22:55 -0800 (PST) To: dgutson@codesourcery.com, gdb@sourceware.org, binutils@sourceware.org Subject: gdb segv in arm disassembler Message-Id: <20100126022255.344B284414@ruffy.mtv.corp.google.com> Date: Tue, 26 Jan 2010 02:23:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-01/txt/msg00191.txt.bz2 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 * 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;