kpdev42 added a comment.

1. There is a situation where the patch might go wrong. When stepping while 
inside:
  - a signal handler when `SA_NODEFER` flag is set (the same signal can be 
received while it is still being handled), and the signal is received again;
  - a handler that is set on multiple signals and they are not masked, and 
these signals are received one after another;
  - a handler that happens to call the current function

recursion happens and stopping at this specifically set up breakpoint on pc is 
not valid. With this patch this would result in unexpected stops, though this 
situation is very specific. Would it make sense to complicate this logic and 
store current `sp` or `fp` values from `NativeRegisterContext` and compare if 
they are the same?

2. The basic behavior is pretty easy to test by sending a lot of signals, but 
testing specific cases like setting the temporary breakpoint on an address 
where there is already another breakpoint is tough. One test was added for 
this, but it does not actually trigger the situation. This very much depends on 
when the signal is going to be received by the process, and it can't really be 
controlled.

3. This slightly changes 1 line of code in `NativeProcessFreeBSD`, but I don't 
have the means to test if it even compiles, though the logic should be 
equivalent.

4. When I looked at `NativeProcessFreeBSD`, it seems that software single 
stepping isn't even being set up there, just checked for when the process 
stops. As I can see from history, software single stepping with similar code 
was in the "legacy FreeBSD plugin" which was removed here: 
https://reviews.llvm.org/D96555 , and then single stepping with shared code was 
added to the new plugin here: https://reviews.llvm.org/D95802 . Because I 
couldn't find where the `SetupSoftwareSingleStepping` would be called for 
FreeBSD I didn't change that, but this probably should be addressed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144392/new/

https://reviews.llvm.org/D144392

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to