From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5468 invoked by alias); 22 Jan 2008 07:09:17 -0000 Received: (qmail 5457 invoked by uid 22791); 22 Jan 2008 07:09:15 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 22 Jan 2008 07:08:45 +0000 Received: from kahikatea.snap.net.nz (208.61.255.123.dynamic.snap.net.nz [123.255.61.208]) by viper.snap.net.nz (Postfix) with ESMTP id A84BD3D9E50; Tue, 22 Jan 2008 20:08:42 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id 0639C8FC6D; Tue, 22 Jan 2008 20:08:37 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18325.38516.687823.267603@kahikatea.snap.net.nz> Date: Tue, 22 Jan 2008 07:09:00 -0000 To: wangjiong@sunnorth.com.cn Cc: gdb@sourceware.org Subject: Re: mi_cmd_disassemble bug? In-Reply-To: References: X-Mailer: VM 7.19 under Emacs 23.0.50.34 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: 2008-01/txt/msg00222.txt.bz2 > I have found that when Eclipse call gdb to disassemble the program > from the appointed line in mixed source mode, there is some problem. > > For example, if the program stopped at line 140 in main, then the > user want to see the disassembled codes mixed with C source codes, Eclipse > will > using the following command: > > xxx-data-disassemble -f example.c -l 140 -n 100 -- 1 > > then gdb will call function mi_cmd_disassemble which will always > disassemble from the start address of the function which includes that > line. > > But I think what Eclipse expect gdb to do is disassembling from > where line 140 start instead of the start address of that function. Why do you think Eclipse expects disassembly to start from line 140? Does it not make sense to display some lines/disassembly before the current line as context? > So in GDB6.7 mi/mi-cmd-disas.c, in function mi_cmd_disassemble > > Should the folloing code be modified ? Please post changes as a diff so that they are easier to read. > if (!find_line_pc (s, line_num, &start)) > error (_("mi_cmd_disassemble: Invalid line number")); > if (find_pc_partial_function (start, NULL, &low, &high) == 0) > error (_("mi_cmd_disassemble: No function contains specified > address")); > } > > gdb_disassembly (uiout, > file_string, > line_num, > mixed_source_and_assembly, how_many, low, high); > > Should it be? > > if (!find_line_pc (s, line_num, &start)) > error (_("mi_cmd_disassemble: Invalid line number")); > } > > gdb_disassembly (uiout, > file_string, > line_num, > mixed_source_and_assembly, how_many, start, high); I don't think this change should be made, if only because it does what the manual says: -data-disassemble [ -s START-ADDR -e END-ADDR ] | [ -f FILENAME -l LINENUM [ -n LINES ] ] -- MODE `LINENUM' is the line number to disassemble around -- Nick http://www.inet.net.nz/~nickrob