List Info

Thread: user-defined commands and function bounds




user-defined commands and function bounds
user name
2006-06-15 08:02:15
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?

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?


Cheers,

Greg
user-defined commands and function bounds
user name
2006-06-15 13:58:57
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
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )