I'm debugging a C++ program with GDB on Linux, and I need to see the value of a member variable while the program is running. The member variable, unfortunately, is named list
, which happens to be a GDB keyword. So when I try:
print m_operations.m_data[10].m_data.list
I get...
A syntax error in expression, near list'.
I tried all sorts of things to indicate to GDB that I'm entering a literal expression, like putting double or single quotes around the variable name, but it just results in more syntax errors. I've looked in the GDB manual and can't find anything to resolve this. I can't rename the member variable because I'm not authorized to modify that class. Furthermore, list
is a C++ object, not a regular integer or POD, so I can't simply use the x
keyword to examine the memory there...at least not without spending some serious time deciphering what the raw binary represents.
So, any suggestions to resolve this?