wisdom

Building an executable

Building foo (executable or library) from the C++ source code involves three steps: preprocessing, compilation and linking.

Preprocessing

Compilation

Linking

Execution

If foo depends on a shared library bar, whenever we execute foo, we must be able to locate and load bar too.

Resources

Get symbols of an object file

Use gnu nm to examine the object (*.o, library, etc.):

nm libgin.a

Output:

A workflow for LLDB

Being inexpert in LLDB, this is the workflow I follow to debug my R packages after they crash.

  1. Run the command that causes the crash, and stop there.
  2. Do a backtrace with bt to find out where are we in the code.
  3. Go to the frame in the stack that you want to examine. For example, for frame #14, frame select 14.
  4. Examine variables with po VARIABLENAME.
  5. ????
  6. PROFIT!!!

Sources