I want to execute the very simple command
print var1, var2, var3, var4
in gdb to examine the values of the vars from time to time.
I don't want to use display because it clutters up my view.
How can I do this? Right now all I can do is:
p var1 p var2 p var3 p var4
The usual way to examine data in your program is with the print command (abbreviated p ), or its synonym inspect . It evaluates and prints the value of an expression of the language your program is written in (see section Using GDB with Different Languages).
If a standalone variable is found as a statement, bc command prints the value of the variable.
The frame command allows you to move from one stack frame to another, and to print the stack frame you select. args may be either the address of the frame or the stack frame number. Without an argument, frame prints the current stack frame.
The ptype [ARG] command will print the type. Show activity on this post. This question may be related: vtable in polymorphic class of C++ using gdb: (gdb) help set print object Set printing of object's derived type based on vtable info.
You can simply do this
print {var1,var2,var3,var4}
This will do the job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With