barmd
barmd

Reputation: 11

error reading variable: Could not find the frame base

I am using Clion IDe, with gcc/g++ & gdb for debugger.

In the CMakeList.txt, I have the following compiler options set. set(CMAKE_CXX_FLAGS -std=c++11 -fopenmp -fPIC -O0 -gdwarf-2 -finline-functions)

I can view the variable values in main() but not any other classes. It shows the error for all methods called from the main directly or nested :

<error reading variable: Could not find the frame base for xxxxclass::xxxMethod> Any pointer would be helpful.

Upvotes: 0

Views: 1661

Answers (1)

Julio Guerra
Julio Guerra

Reputation: 5661

Several problems I see:

  1. Do not limit yourself to dwarf v2 (-gdwarf-2) unless your debugger cannot handle newer dwarf revisions.
  2. Try, as much as possible, to disable optimizations (-O0 should correctly disable -finline-functions though). But note that newer dwarf revisions better handle and track optimizations.
  3. Try, as much as possible, to make your debug informations verbose. The option -g takes an optional argument which is 2 by default, but whose maximum value can be 3. It will then unlock some debugger features like debugging CPP macros.
  4. Enable GDB debug information extensions with -ggdb.
  5. If it's still complaining, you may still have to explicitly use extra gcc's debugging options. But it is usually only required when debugging an optimized program.

So, try again with: set(CMAKE_CXX_FLAGS -std=c++11 -fopenmp -fPIC -O0 -g3 -ggdb)

Upvotes: 1

Related Questions