Date: Sun, 8 Jul 2001 12:49:19 +0930 From: Greg Lehey <grog@FreeBSD.org> To: Steve Price <steve@havk.org> Cc: chat@freebsd.org Subject: Re: gdb debugging tips Message-ID: <20010708124919.G80862@wantadilla.lemis.com> In-Reply-To: <20010706175625.J65832@bsd.havk.org>; from steve@havk.org on Fri, Jul 06, 2001 at 05:56:25PM -0500 References: <20010706175625.J65832@bsd.havk.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, 6 July 2001 at 17:56:25 -0500, Steve Price wrote: > I've been having problems with a software package for which I > only have a binary with no debugging symbols. In talking to > the folks that wrote the software I know what arguments the > routine takes I just need to be able to see them in the debugger. Hmm. I suppose chat@ is a catchall, but I would have thought you could find a better mailing list for this question. I can't think of one at the moment, though, so I'll reply here. > Here's what I've done: > > Fire up the program. Attach to the pid of the running process > with 'gdb lsv 10336'. Hmm. I don't know this syntax. Is that really what you typed to the shell? > I've set the breakpoint at the routine that I'm interested in 'break > LH2P' and I've coerced the program to run to the breakpoint. > > Here's where I'm lost. I'm back in gdb and it is waiting for me to > tell it what to do. I know the function LH2P takes one argument a > 'char *'. How do I view a function's arguments? With debugging > symbols this is as easy as 'where'. I figured 'info args' would be > the ticket but all it says is 'No symbol table info avialable'. Now > I'm betting the information from 'info frame' is the key but how to > decipher it. I have some macros which handle this. You'll find them in /usr/src/sys/modules/vinum/.gdbinit.kernel. I must move them somewhere else, since this file isn't Vinum-specific. The commands you need are: f0 -- Select stack frame 0 and show assembler-level details f1 -- Select stack frame 1 and show assembler-level details f2 -- Select stack frame 2 and show assembler-level details f3 -- Select stack frame 3 and show assembler-level details f4 -- Select stack frame 4 and show assembler-level details f5 -- Select stack frame 5 and show assembler-level details xb -- Show 12 words starting at current BP value in hex xi -- List the next 10 instructions from the current IP value xp -- Show the register contents and the first four parameter xp0 -- Show the first parameter of current stack frame in various formats xp1 -- Show the second parameter of current stack frame in various formats xp2 -- Show the third parameter of current stack frame in various formats xp3 -- Show the fourth parameter of current stack frame in various formats xp4 -- Show the fifth parameter of current stack frame in various formats xs -- Show the last 12 words on stack in hex xxp -- Show the register contents and the first ten parameter y -- User-defined z -- Single step 1 instruction (over calls) and show next instruction zs -- Single step 1 instruction (through calls) and show next instruction You can get a complete list with 'help user'. Let me know if you have any questions. Greg -- See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010708124919.G80862>