[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Follow DW_AT_decl_file when setting breakpoint
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 29 02:39:28 PDT 2020
labath added a comment.
In D74136#2118983 <https://reviews.llvm.org/D74136#2118983>, @jankratochvil wrote:
> The filename should not be checked from `SymbolContext::function` but rather from `SymbolContext::line_entry`. As that is cheaper. And when one asks for breakpoint at `1a.h:1` then it is enough to check `.debug_line` (which needs to be checked anyway) and why to look into `.debug_info` for the function name etc. at all?
> I think there is even a bug due to the Function being involved and not just line_entry:
>
> tail -n99 1b.c 1b.h;clang -o 1b 1b.c -Wall -g;~/redhat/llvm-monorepo2-clangassert/bin/lldb -batch ./1a -o 'breakpoint set -f 1b.h -l 1'
> ==> 1b.c <==
> static void func(void) {}
> int main(void) {
> #include "1b.h"
> return 0;
> }
> ==> 1b.h <==
> func();
> (lldb) target create "./1a"
> Current executable set to '/home/jkratoch/t/1a' (x86_64).
> (lldb) breakpoint set -f 1b.h -l 1
> Breakpoint 1: no locations (pending).
> WARNING: Unable to resolve breakpoint to any actual locations.
>
When setting a breakpoint by file+line I would definitely expect this to work as you describe.
However, when setting a breakpoint by name+file I think that a more natural behavior would be to check the file that the function was defined in. I.e. in your example "--name main --file 1b.h" should fail, but "--name main --file 1b.c" should succeed.
I guess this all goes back to what Jim said earlier about the "--file" argument in set-by-name and set-by-line behaving differently even though that's not obvious from how the command is structured.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74136/new/
https://reviews.llvm.org/D74136
More information about the lldb-commits
mailing list