This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Some help required with gdb-python scripting
- From: Tom Tromey <tromey at redhat dot com>
- To: Yogesh Mundada <yogesh dot mundada at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Mon, 29 Mar 2010 09:12:01 -0600
- Subject: Re: Some help required with gdb-python scripting
- References: <1957618c1003270459v78686a64wcfe050bd24ff5742@mail.gmail.com>
- Reply-to: tromey at redhat dot com
>>>>> "Yogesh" == Yogesh Mundada <yogesh.mundada@gmail.com> writes:
Yogesh> 1. Is there any way to disable this 'more' type editor feature after
Yogesh> every few lines?
"set pagination off"
Inside gdb you can use the _unfiltered functions to bypass the
pagination. These aren't exposed to Python, however.
In your particular case, you could avoid the use of `call', and not get
things printed out. You could either do this by writing a new command
instead of a convenience function, or by simply having your breakpoint
commands invoke the Python directly using the 'python' command.
Yogesh> 2. How can I examine value of eax register in the function
Yogesh> call_profiler()? I tried - fr.read_var('%eax'),
Yogesh> fr.read_var('$eax') and fr.read_var('eax') - but all of them
Yogesh> give me an error saying that the variable not found.
Try gdb.parse_and_eval('$eax')
Yogesh> 3. Is there any way to stop execution and give control back to the
Yogesh> user if some condition is true?
No. I want to say "not yet" but I am not sure about that.
Yogesh> 4. Is there any way to make this process completely automated without
Yogesh> me ever requiring to set breakpoints or put commands for breakpoints?
I am not sure.
Maybe you could try gdb.execute with an argument containing newlines.
I don't know if that will work or not.
If not, then I don't think there is a very good way at present.
You can make a temporary file and source it -- yuck.
The archer-tromey-python branch has some more direct support for
breakpoints. Maybe you can set the commands directly there; I don't
remember offhand. Phil is in the process of merging this upstream.
Tom