Reputation: 920
What I want is this :
(gdb) define mynext
Redefine command "mynext"? (y or n) y
Type commands for definition of "mynext".
End with a line saying just "end".
>print "------"
>print Location:
>where
>print "-------------"
>print Code:
>list
>print "---------------------"
>print Next:
>next
>end
This is what outputs is:
$1 = "-----"
....
I expect:
-----
....
I used call printf("opopo") also, but It print the return value of "opopo" which is 5. Just like this:$4 = 5
My question is: how can I print something without this format which is :$[num]=[value].
Upvotes: 0
Views: 73
Reputation: 22549
As you found, print
puts the printed value into the value history. gdb provides two different ways to avoid this.
One is printf
. This works somewhat like the C function, but is a gdb command. Use it like:
(gdb) printf "whatever you like\n"
whatever you like
(gdb)
Another is output
. This is a bit like the print
command, but does not enter the value into the value history.
(gdb) output 5
5(gdb)
You can see from this that output
also doesn't emit a trailing newline. You would have to add that yourself.
Upvotes: 1