[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-17 Thread Pavel Labath via lldb-commits
labath wrote: So, it took some effort, but I managed to reproduce the problem and figure out what's going on. You can find my analysis on https://github.com/llvm/llvm-project/pull/92503 https://github.com/llvm/llvm-project/pull/91321 ___

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-14 Thread Pavel Labath via lldb-commits
labath wrote: > Ah, so the problem here is that we're missing the eh_frame instructions for > _sigtramp on arm64 with macOS 14. `signal_generating_add` is a frameless > function (a great stress test in this instance), and _sigtramp is called with > enough of a faked-up stack that a stack walk

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-14 Thread Pavel Labath via lldb-commits
labath wrote: > > > LLDB became unresponsive on windows when a `thread backtrace` command was > > > issued after hitting the exception i have temporarily reverted the change > > > to make buildbot green. > > > > > > Could you please give me some more information about the problem? I don't >

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-13 Thread Jason Molenda via lldb-commits
jasonmolenda wrote: (and it turns out the reason we don't have eh_frame is because _sigtramp on arm64 is written in C, and I'm not sure how I'm going to track which callee-saved register the argument is copied into, so this is definitely not something I can get fixed quickly.)

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-13 Thread Omair Javaid via lldb-commits
omjavaid wrote: > > LLDB became unresponsive on windows when a `thread backtrace` command was > > issued after hitting the exception i have temporarily reverted the change > > to make buildbot green. > > Could you please give me some more information about the problem? I don't > have access

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-13 Thread Jason Molenda via lldb-commits
jasonmolenda wrote: Ah, so the problem here is that we're missing the eh_frame instructions for _sigtramp on arm64 with macOS 14. `signal_generating_add` is a frameless function (a great stress test in this instance), and _sigtramp is called with enough of a faked-up stack that a stack walk

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-13 Thread Jason Molenda via lldb-commits
jasonmolenda wrote: > It's not completely correct -- the frame for `signal_generating_add` is > missing. That's what the error message is complaining about. Ah, thanks, I missed that! Let me debug it and comment further https://github.com/llvm/llvm-project/pull/91321

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-13 Thread Pavel Labath via lldb-commits
labath wrote: > LLDB became unresponsive on windows when a `thread backtrace` command was > issued after hitting the exception i have temporarily reverted the change to > make buildbot green. Could you please give me some more information about the problem? I don't have access to a windows

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-13 Thread Omair Javaid via lldb-commits
omjavaid wrote: LLDB became unresponsive on windows when a `thread backtrace` command was issued after hitting the exception i have temporarily reverted the change to make buildbot green. https://github.com/llvm/llvm-project/pull/91321 ___

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-13 Thread Pavel Labath via lldb-commits
labath wrote: > Ah, I misunderstood what the nature of the failure was. I tried running the > shell test, and it's failing for different reasons. I almost never touch > shell tests, I find them really hard to debug so I'm not sure what the > problem is. If I run it by hand, > > ``` > (lldb)

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-13 Thread Omair Javaid via lldb-commits
omjavaid wrote: @labath this seems to have broken lldb-aarch64-windows bot with TestInterruptBacktrace.py failing on num_frames = thread.GetNumFrames() https://github.com/llvm/llvm-project/pull/91321 ___ lldb-commits mailing list

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-10 Thread Jason Molenda via lldb-commits
jasonmolenda wrote: maybe the shell test is building without debug info, I am surprised to see assembly there. If I build it like that and run it by hand, ``` (lldb) settings set platform.plugin.darwin.ignored-exceptions EXC_BAD_INSTRUCTION (lldb) b sigill_handler Breakpoint 1: where =

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-10 Thread Jason Molenda via lldb-commits
jasonmolenda wrote: Ah, I misunderstood what the nature of the failure was. I tried running the shell test, and it's failing for different reasons. I almost never touch shell tests, I find them really hard to debug so I'm not sure what the problem is. If I run it by hand, ``` (lldb)

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-10 Thread Jason Molenda via lldb-commits
jasonmolenda wrote: > I have fixed/worked around the mach exception issue in a [followup > commit](https://github.com/llvm/llvm-project/commit/b903badd73a2467fdd4e363231f2bf9b0704b546) > with a `settings set platform.plugin.darwin.ignored-exceptions > EXC_BAD_INSTRUCTION`. Now the process

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-10 Thread Pavel Labath via lldb-commits
labath wrote: I have fixed/worked around the mach exception issue in a [followup commit](https://github.com/llvm/llvm-project/commit/b903badd73a2467fdd4e363231f2bf9b0704b546) with a `settings set platform.plugin.darwin.ignored-exceptions EXC_BAD_INSTRUCTION`. Now the process gets a SIGILL as

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-09 Thread Jason Molenda via lldb-commits
jasonmolenda wrote: Ah, so the problem is, ``` (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=1, subcode=0xdead) * frame #0: 0x00013f2c b.out`signal_generating_add + 4 at signal-in-leaf-function-aarch64.c:5 frame #1:

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-09 Thread Jason Molenda via lldb-commits
jasonmolenda wrote: Will debug this today. https://github.com/llvm/llvm-project/pull/91321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-09 Thread Adrian Prantl via lldb-commits
adrian-prantl wrote: I think that would be a good start. Also tagging @jasonmolenda for advice. https://github.com/llvm/llvm-project/pull/91321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-09 Thread Pavel Labath via lldb-commits
labath wrote: > This looks good to me, I know there are other codepaths that handle this > correctly, where we can backtrace out of a frameless function that faults > into a trap handler and we have the entire register state available in the > trap handler. > > Looking at this, I'm a little

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-09 Thread Pavel Labath via lldb-commits
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/91321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-07 Thread Greg Clayton via lldb-commits
https://github.com/clayborg commented: LGTM. https://github.com/llvm/llvm-project/pull/91321 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-07 Thread Jason Molenda via lldb-commits
https://github.com/jasonmolenda approved this pull request. This looks good to me, I know there are other codepaths that handle this correctly, where we can backtrace out of a frameless function that faults into a trap handler and we have the entire register state available in the trap

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-07 Thread Pavel Labath via lldb-commits
@@ -1555,12 +1555,12 @@ RegisterContextUnwind::SavedLocationForRegister( } if (unwindplan_regloc.IsSame()) { -if (!IsFrameZero() && +if (!m_all_registers_available && (regnum.GetAsKind(eRegisterKindGeneric) == LLDB_REGNUM_GENERIC_PC ||

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-07 Thread Pavel Labath via lldb-commits
@@ -467,7 +465,7 @@ size_t UnwindAssemblyInstEmulation::WriteMemory( m_pushed_regs[reg_num] = addr; const int32_t offset = addr - m_initial_sp; m_curr_row->SetRegisterLocationToAtCFAPlusOffset(reg_num, offset, -

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-07 Thread via lldb-commits
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Pavel Labath (labath) Changes A leaf function may not store the link register to stack, but we it can still end up being a non-zero frame if it gets interrupted by a signal. Currently, we were unable to unwind past this function because

[Lldb-commits] [lldb] [lldb/aarch64] Fix unwinding when signal interrupts a leaf function (PR #91321)

2024-05-07 Thread Pavel Labath via lldb-commits
https://github.com/labath created https://github.com/llvm/llvm-project/pull/91321 A leaf function may not store the link register to stack, but we it can still end up being a non-zero frame if it gets interrupted by a signal. Currently, we were unable to unwind past this function because we