[all-commits] [llvm/llvm-project] bca507: [lldb][FrameRecognizer] Display the first non-std ...

Michael Buch via All-commits all-commits at lists.llvm.org
Thu Sep 19 02:06:49 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bca507387ae1945137214ec7fb80b709927ee6e8
      https://github.com/llvm/llvm-project/commit/bca507387ae1945137214ec7fb80b709927ee6e8
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2024-09-19 (Thu, 19 Sep 2024)

  Changed paths:
    M lldb/source/Target/VerboseTrapFrameRecognizer.cpp
    A lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl-callback-user-leaf.cpp
    A lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl-callback.cpp
    A lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl-max-depth.cpp
    A lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl-nested.cpp
    A lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl.cpp
    A lldb/test/Shell/Recognizer/verbose_trap-in-stl-callback-user-leaf.test
    A lldb/test/Shell/Recognizer/verbose_trap-in-stl-callback.test
    A lldb/test/Shell/Recognizer/verbose_trap-in-stl-max-depth.test
    A lldb/test/Shell/Recognizer/verbose_trap-in-stl-nested.test
    A lldb/test/Shell/Recognizer/verbose_trap-in-stl.test

  Log Message:
  -----------
  [lldb][FrameRecognizer] Display the first non-std frame on verbose_trap (#108825)

This attempts to improve user-experience when LLDB stops on a
verbose_trap. Currently if a `__builtin_verbose_trap` triggers, we
display the first frame above the call to the verbose_trap. So in the
newly added test case, we would've previously stopped here:
```
(lldb) run
Process 28095 launched: '/Users/michaelbuch/a.out' (arm64)
Process 28095 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = Bounds error: out-of-bounds access
    frame #1: 0x0000000100003f5c a.out`std::__1::vector<int>::operator[](this=0x000000016fdfebef size=0, (null)=10) at verbose_trap.cpp:6:9
   3    template <typename T>
   4    struct vector {
   5        void operator[](unsigned) {
-> 6            __builtin_verbose_trap("Bounds error", "out-of-bounds access");
   7        }
   8    };
```

After this patch, we would stop in the first non-`std` frame:
```
(lldb) run
Process 27843 launched: '/Users/michaelbuch/a.out' (arm64)
Process 27843 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = Bounds error: out-of-bounds access
    frame #2: 0x0000000100003f44 a.out`g() at verbose_trap.cpp:14:5
   11  
   12   void g() {
   13       std::vector<int> v;
-> 14       v[10];
   15   }
   16  
```

rdar://134490328



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list