[Lldb-commits] [PATCH] D22294: Add functionality for rewriting symbols

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 13 14:10:32 PDT 2016


clayborg added a comment.

> I think some understanding of the rewrites from the debugger is still required because the user will still enter commands like `call putchar('a')` and expect the `putchar()` they wrote to be called. That `putchar()` they expect is now called `_my_putchar()` and unless we rewrite the symbol they typed, they'll end up calling the non-rewritten `putchar()`.


No, the function lookup will find both "putchar" and "_my_putchar" will be found in your debug info and map to an address that matches the symbol for "_my_putchar". So no rewrite stuff will be needed.

> One thing to note is that adding the `DW_AT_linkage_name` entry to `DW_TAG_subprogram` will fix the bug that we are working around in the unit tests with `-g0`, so that is required regardless.


So the way LLDB resolves functions is the function lookup happens for "putchar". If multiple results are found, then we prefer the one from the current executable, which means we will use the local "putchar". If we find multiple and none are in the current shared library we will note that there are duplicates and the expression will fail.

So I vote we fix the DWARF and be done.


http://reviews.llvm.org/D22294





More information about the lldb-commits mailing list