Reputation: 13
I would like to assign the "info sharedlibrary" value to a variable in user define function.
Such as,
define customFunction
set $i = info sharedlibrary
end
But it seems impossible in gdb And also i cannot use python script too...
Is there any way to do this??
Thank you
ps. I trying to do this because i want to print only selected library's instructions.
Upvotes: 0
Views: 540
Reputation: 22519
You don't mention why you can't use a Python function. That's by far the simplest way to program gdb.
However, if you really must do it, and really must avoid Python, there is a way. It's gross! But it does work. It's like this:
set logging
commands to redirect output to a temporary file.set logging
again to disable logging.shell
command to run sed
or perl
or what-have-you on this temporary file to turn it into a sequence of gdb commands, say commands to set a variable, or commands to print exactly the output you want.source
the resulting fileUpvotes: 1