[Lldb-commits] [PATCH] Fix a problem where lldb-mi would not stop the debuggee after -exec-interrupt command.

Greg Clayton clayborg at gmail.com
Fri Feb 20 10:10:26 PST 2015


Yes, no #defines should be used at all, they should be dynamically retrieved by name from the SBUnixSignal object that you can get from the SBProcess.

Also, all signals should really be supported in this switch statement.
> On Feb 20, 2015, at 10:08 AM, Zachary Turner <zturner at google.com> wrote:
> 
> That's fine, I was mostly just concerned that it wouldn't compile.  Windows has only a very small subset of SIG_XXX constants defined in its system headers.  lldb and lldb-mi define a few more for Windows that it needs, I just didn't have code in front of me so I wanted to make sure that the #defines being used here are defined somewhere on Windows so that it would compile.
> 
> On Fri Feb 20 2015 at 10:06:27 AM Greg Clayton <clayborg at gmail.com> wrote:
> It is ok to rely on signals here because CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateStopped() already determined that a signal was reported as the stop reason and windows just can avoid saying it stopped due to a signal, so no work needs to be done to work around this.
> 
> You do need to ask the process about its signals and you can't use hard coded values, you need to look them up by name through the SBUnixSignals object that you can get from a live SBProcess instance. See inlined comments above.
> 
> 
> ================
> Comment at: tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp:839-840
> @@ -838,3 +838,4 @@
>      {
> -        case 2: // Terminal interrupt signal. SIGINT
> +        case SIGINT: // Terminal interrupt signal. SIGINT
> +        case SIGSTOP:
>          {
> ----------------
> You need to ask the process about its unix signal and you can't use hard coded values. You can make some member variables in CMICmnLLDBDebuggerHandleEvents and then initialize them when you have a process. The process must be up and running, you can't ask the process before it is stopped at its first stop. So when you get a eStateStopped event, see if it is the first one and then initialize your ivars with something like:
> 
> 
> ```
> void
> CMICmnLLDBDebuggerHandleEvents::InitializeSignals()
> {
>     SBUnixSignals unix_signals = sbProcess.GetUnixSignals();
>     m_SIGINT = unix_signals.GetSignalNumberFromName("SIGINT");
>     m_SIGSTOP = unix_signals.GetSignalNumberFromName("SIGSTOP");
>     m_SIGSEGV = unix_signals.GetSignalNumberFromName("SIGSEGV");
>     m_SIGTRAP = unix_signals.GetSignalNumberFromName("SIGTRAP");
> }
> 
> ```
> 
> http://reviews.llvm.org/D7783
> 
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
> 
> 





More information about the lldb-commits mailing list