[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Follow DW_AT_decl_file when setting breakpoint

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Jun 28 13:59:16 PDT 2020


jankratochvil added a comment.

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.

For a practical use case the `1b.h` should be rather called `1b.def`, there are such files found in many GNU projects - although usually the `*.def` files are included into data `struct`s and not into function code. But still. This reproducer should be even a part of the testcase for your patch.


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