From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28692 invoked by alias); 8 Dec 2004 07:04:41 -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 28516 invoked from network); 8 Dec 2004 07:04:33 -0000 Received: from unknown (HELO alice.acmet.com) (61.16.238.202) by sourceware.org with SMTP; 8 Dec 2004 07:04:33 -0000 Received: from u8test4 (localhost [127.0.0.1] (may be forged)) by alice.acmet.com (8.11.6/8.11.6) with ESMTP id iB879pB16739; Wed, 8 Dec 2004 12:39:51 +0530 From: "Tarun" To: "'Peter Barada'" Cc: , , , Subject: RE: Query regarding assembly level debugging support Date: Wed, 08 Dec 2004 07:04:00 -0000 Message-ID: <000a01c4dcf3$d9bf19c0$a100a8c0@u8test4> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <20041202141029.D5DDD9842C@baradas.org> X-SW-Source: 2004-12/txt/msg00051.txt.bz2 > -----Original Message----- > From: Peter Barada [mailto:peter@the-baradas.com] > Sent: Thursday, December 02, 2004 7:40 PM > To: tarun@acmet.com > Cc: gdb@sources.redhat.com; acmet@vsnl.net; ranjeeta@acmet.com; > rm_nair@acmet.com > Subject: Re: Query regarding assembly level debugging support > > > > The linked out file is loaded without errors on GDB. When we run > >the respective out file on GDB, the control of debugger moves to label > >main in the assembly code ( Breakpoint 1, 0xa00200ec in main ()). When I > >try to move to next instruction using "nexti", the control moves to next > >address (Displaying: 0xa00200f0 in main ()). This continues till the > >last address is reached. Only the address increments within the assembly > >file are displayed and not the actual assembly source. > > > > When I try to single step using "step", the message prompted is > >"Single stepping until exit from function main, which has no line number > >information". Whereas if I disassemble one of the addresses give above, > >entire assembly code which I am trying to debug is displayed. > > > > Does this mean that GDB does not support debugging of the assembly > >code? > > Peope have been using GDB to debug assembler code for years. A > couple of tricks: > > 1) Use stepi/nexti commands to step or next one *instruction* as > opposed to source line > 2) Use the 'disp/i $pc' to have GDB display the assembler instruction > that will be executed next. > 3) Use 'i reg' to dump the registers, or 'p $reg' where 'reg' is the > register name. > Thanks for the information. But my query still remains "Can we step through assembly code?" I know GDB supports assembly-level debugging but that refers to inline assembly. To make the point clear, please look at snip below. For the sample code segment: /* Print the top of the stack if no index is specified. */ if (which < 0) { which = stack->top - 1; if (which < 0) The inline assembly is (assume) represented as: /* Print the top of the stack if no index is specified. */ if (which < 0) .frame $fp,16,$31 <- .mask 0x40000000,-8 <- .fmask 0x00000000,0 <- subu $sp,$sp,16 <- { which = stack->top - 1; li $2,20 <- sw $2,0($fp) <- if (which < 0) Does GDB refer to stepping through the above code as assembly-level debugging? If yes, then my requirement is little different. I want to debug the assembly code itself keeping it as the source code (and not the C source). To be more specific I want to debug hand written assembly code (and not the one generated by compiler) Regards, Tarun