From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22837 invoked by alias); 1 Sep 2005 11:28:45 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 22712 invoked by uid 22791); 1 Sep 2005 11:28:29 -0000 Received: from lon-del-01.spheriq.net (HELO lon-del-01.spheriq.net) (195.46.50.97) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 01 Sep 2005 11:28:29 +0000 Received: from lon-out-03.spheriq.net ([195.46.50.131]) by lon-del-01.spheriq.net with ESMTP id j81BS8kE020296 for ; Thu, 1 Sep 2005 11:28:14 GMT Received: from lon-cus-02.spheriq.net (lon-cus-02.spheriq.net [195.46.50.38]) by lon-out-03.spheriq.net with ESMTP id j81BS7RD001736 for ; Thu, 1 Sep 2005 11:28:08 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-02.spheriq.net with ESMTP id j81BS6Zj029794 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Thu, 1 Sep 2005 11:28:07 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 35ADDDA49 for ; Thu, 1 Sep 2005 11:28:02 +0000 (GMT) Received: by zeta.dmz-eu.st.com (STMicroelectronics, from userid 60012) id A5D6D473E6; Thu, 1 Sep 2005 11:30:25 +0000 (GMT) Received: from zeta.dmz-eu.st.com (localhost [127.0.0.1]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 55FBD759B0 for ; Thu, 1 Sep 2005 11:30:25 +0000 (UTC) Received: from mail1.cro.st.com (mail1.cro.st.com [164.129.40.131]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D60AA473F6 for ; Thu, 1 Sep 2005 11:30:24 +0000 (GMT) Received: from crx549.cro.st.com (crx549.cro.st.com [164.129.44.49]) by mail1.cro.st.com (MOS 3.4.4-GR) with ESMTP id BUO00135 (AUTH "frederic riss"); Thu, 1 Sep 2005 13:28:00 +0200 (CEST) Subject: MI mixed disassembly address range issue From: Frederic RISS To: gdb@sources.redhat.com Content-Type: text/plain Date: Thu, 01 Sep 2005 11:28:00 -0000 Message-Id: <1125574080.9016.86.camel@crx549.cro.st.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 2.3.0 X-SW-Source: 2005-09/txt/msg00001.txt.bz2 Hello, when using the -data-disassemble MI command with the -s and -e options to specify the address range to disassemble, it's quit easy to break the following assumption in disasm.c : /* Assume symtab is valid for whole PC range */ symtab = find_pc_symtab (low); If the low and high address' aren't recorded in the same symtab, we hit this code in do_mixed_source_and_assembly : /* If we're on the last line, and it's part of the function, then we need to get the end pc in a special way. */ if (i == nlines - 1 && le[i].pc < high) { mle[newlines].line = le[i].line; mle[newlines].start_pc = le[i].pc; sal = find_pc_line (le[i].pc, 0); mle[newlines].end_pc = sal.end; newlines++; } I tested this with the Dwarf2 debug format which introduces 'end-of-function' markers (ie lineentries with 0 as line number). When reaching the end of the table, the above code introduces an entry with 0 line number in the 'lines to be dumped' array. The result is like that : -data-disassemble -s 0x804859e -e 0x8048600 -- 1 ^done,asm_insns=[src_and_asm_line={line="0",file="main.c",line_asm_insn=[]}, src_and_asm_line={line="1",file="main.c",line_asm_insn=[]}, [repeated for 0 <= x <= 109] src_and_asm_line={line="108",file="main.c",line_asm_insn=[]}, src_and_asm_line={line="109",file="main.c",line_asm_insn=[{address="0x0804859e", func-name="main",offset="375",inst="movl $0x4,0xfffffff4(%ebp)"}, [ ... stripped correct output ] As you see the lines 0- are output empty, which seems like a bug. One obvious fix for this is to patch do_mixed_source_and_assembly along the lines of : --- disasm.c.old 2005-08-31 15:16:13.000000000 +0200 +++ disasm.c 2005-08-31 15:32:40.000000000 +0200 @@ -200,7 +200,7 @@ /* If we're on the last line, and it's part of the function, then we need to get the end pc in a special way. */ - if (i == nlines - 1 && le[i].pc < high) + if (i == nlines - 1 && le[i].pc < high && le[i].line != 0) { mle[newlines].line = le[i].line; mle[newlines].start_pc = le[i].pc; I don't know if all debug formats (or even Dwarf in all cases) will output an end-marker at the end of the linetable, but if it's the case, the offending code could be totally removed as we'll always have le[nlines-1].line == 0. Kind regards, Fred.