Conditions under which stepping into shared library should work in gdb?

前端 未结 3 954
甜味超标
甜味超标 2021-01-01 22:49

There are many questions related to specific errors why stepping into a shared library with gdb isn\'t working. None of them provide a systematic answer on how to confirm wh

3条回答
  •  庸人自扰
    2021-01-01 23:24

    Some more tests you can do on built shared library:

    1. file libmyshared-ggdb.so should report that library has debug info and not stripped.
    2. nm libmyshared-ggdb.so | grep print_from_lib should find the symbol for print_from_lib function.

    If all above tests passed try to load the library directly in gdb and find the function:

    gdb libmyshared-ggdb.so
    (gdb) info functions print_from_lib
    

    Function print_from_lib name should be printed. If not, something is wrong with gdb or gcc.

提交回复
热议问题