Closed JakeHillion closed 8 months ago
This is a little bit weird. I'm getting the debug information show up on an internal BUCK build, but not an external hand driven one.
Internal object:
$ llvm-dwarfdump .../VectorOfStrings-GetSize.cpp.o | grep 'getObjectSizeImpl' -B 20 -A 20
...
0x00004a90: DW_TAG_subprogram
DW_AT_linkage_name ("_ZN19ObjectIntrospection17getObjectSizeImplIN8facebook6detail15VectorOfStringsEEEiRKT_Rm")
DW_AT_name ("getObjectSizeImpl<facebook::detail::VectorOfStrings>")
DW_AT_decl_file ("ObjectIntrospection.h")
DW_AT_decl_line (243)
DW_AT_type (0x000049ef "int")
DW_AT_declaration (true)
DW_AT_external (true)
...
External build (with -fstandalone-debug -fno-debug-types-section -gno-split-dwarf -g
):
$ llvm-dwarfdump OilVectorOfStrings.o | grep 'getObjectSizeImpl' -B 20 -A 20
These are the only explicit flags added when compiling internally, so there must be something else somewhere. Will come back to this in the future as the two symbol approach works fine for now.
This is no longer relevant with the Clang AST based approach that Oilgen now uses.
Currently
OIGenerator.cpp
forms a relationship betweenObjectIntrospection::getObjectSize<T>(...)
andObjectIntrospection::getObjectSizeImpl<T>(...)
by symbol name because theImpl
isn't in the debug due to being a weak symbol with no body.By passing the
-fstandalone-debug
to the compiler we cause the function to appear in the DWARF, as well as ensuring all the necessary type information is available even through pointers. This removes the need for the quite fragile symbol matching.