This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: user-defined commands and function bounds
- From: Daniel Jacobowitz <drow at false dot org>
- To: Greg Law <greg at greglaw dot net>
- Cc: gdb at sourceware dot org
- Date: Thu, 15 Jun 2006 09:58:57 -0400
- Subject: Re: user-defined commands and function bounds
- References: <44911407.9020109@greglaw.net>
On Thu, Jun 15, 2006 at 09:02:15AM +0100, Greg Law wrote:
> Hi list,
>
> I've a couple of questions:
>
> 1. Is there any way to get the start and end addresses of a function?
> The only way I've found to do it is using the disassemble command, but I
> really just want to know where the current function starts and stops?
Not from the current CLI or MI. I don't even see an unimplemented MI
command for it.
Why do you want this? There isn't always going to be a simple answer;
functions can actually be discontiguous. But for your purposes I'll
guess that it's not a problem.
> 2. If I have a user-defined command, and one of the commands it executes
> fails, it seems that sometimes the command does not complete. e.g.
>
> (gdb) define foo
> Type commands for definition of "foo".
> End with a line saying just "end".
>
> > echo foo starts\n
> > disas
> > echo foo ends\n
> > end
>
> (gdb) foo
> foo starts
> No frame selected.
>
> (gdb)
>
> i.e. I don't see the "foo ends" message, because the 'disas' command
> failed. Is this intended behaviour, or is it a bug? Is there any way
> round it?
It's the intended behavior, or was at least - it calls error()
internally, which jumps out of the user defined command handling.
I think someone once proposed a try.
Having a real scripting language attached would do this too. I'm
thinking I'll pick that project back up real soon now.
--
Daniel Jacobowitz
CodeSourcery