automate gdb convenience var issue

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

automate gdb convenience var issue

Sourceware - gdb list mailing list
Hi all
I'm logging gdb output to files.
i'm after logging addersses output .

i read this log output with shell,grep,awk and i'm trying to get the input to convenience vars with no luck !!

is there any solution for my needs ?

if there is any way to use gdb output with grep awk and such within gdb ,its even preferable .

thanks.
Reply | Threaded
Open this post in threaded view
|

Re: automate gdb convenience var issue

Matthew Malcomson-2
Resending without disclaimer so it gets to the mailing list.


On 26/06/2019 08:00, queency3.yahoo.com via gdb wrote:

> Hi all
> I'm logging gdb output to files.
> i'm after logging addersses output .
>
> i read this log output with shell,grep,awk and i'm trying to get the input to convenience vars with no luck !!
>
> is there any solution for my needs ?
>
> if there is any way to use gdb output with grep awk and such within gdb ,its even preferable .
>
> thanks.
>

Hi there,

I do something similar in my plugin.

I don't know if there's some way to do this directly, but it's pretty
easy with a python function.

The code here generates a gdb.Value for each address written in a file.
https://github.com/hardenedapple/gdb-walkers/blob/9a0e05d4b6925013ad97e10a4125332efb09e835/walker_defs.py#L1063-L1066

That uses a helper function `as_voidptr`, which would be replaced by

<the value>.cast(gdb.lookup_type('void').pointer())

You can assign a gdb.Value to a convenience variable with
`gdb.set_convenience_variable`.


Hopefully that would work for you.
MM