2

I have a huge code basis which several namespaces are scoped and unfortunately I miss which namespace my method is.

Does GDB helps me with that task if I just have a method name? Can it search through the namespaces to find my method?

e.g:

    (gdb) b getTranslation
    Function "getTranslation" not defined.
    Make breakpoint pending on future shared library load? (y or [n]) n
    (gdb) b HPHP::jit::getTranslation
    Function "HPHP::jit::getTranslation" not defined.
    Make breakpoint pending on future shared library load? (y or [n]) n
    (gdb) b HPHP::jit::MCGenerator::getTranslation
    Breakpoint 1 at 0x16a1a058: file hhvm/hphp/runtime/vm/jit/mc-generator.cpp, line 308.
    (gdb) # Ahhh, finally!

Normally I run through code and start collecting the namespaces, but sometimes they are tricky as a new namespace is defined in the middle of the header...

gut
  • 424
  • 2
  • 15

1 Answers1

3

Using this question and its answers as hints, you might use e.g. info functions getTranslation, and it should list all functions named getTranslation complete with the classes/namespaces.

Community
  • 1
  • 1
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621