[Lldb-commits] [lldb] r116139 - in /lldb/trunk/source: Commands/CommandObjectProcess.cpp Interpreter/CommandObject.cpp Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Target/UnixSignals.cpp

Greg Clayton gclayton at apple.com
Fri Oct 8 18:40:57 PDT 2010


Author: gclayton
Date: Fri Oct  8 20:40:57 2010
New Revision: 116139

URL: http://llvm.org/viewvc/llvm-project?rev=116139&view=rev
Log:
Fixed process.gdb-remote to be able to properly propagate the signals and
obey the UnixSignals table that we have in the process.


Modified:
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Interpreter/CommandObject.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
    lldb/trunk/source/Target/UnixSignals.cpp

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=116139&r1=116138&r2=116139&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Fri Oct  8 20:40:57 2010
@@ -846,8 +846,15 @@
 
         if (command.GetArgumentCount() == 1)
         {
-            int signo = Args::StringToSInt32(command.GetArgumentAtIndex(0), -1, 0);
-            if (signo == -1)
+            int signo = LLDB_INVALID_SIGNAL_NUMBER;
+            
+            const char *signal_name = command.GetArgumentAtIndex(0);
+            if (::isxdigit (signal_name[0]))
+                signo = Args::StringToSInt32(signal_name, LLDB_INVALID_SIGNAL_NUMBER, 0);
+            else
+                signo = process->GetUnixSignals().GetSignalNumberFromName (signal_name);
+            
+            if (signo == LLDB_INVALID_SIGNAL_NUMBER)
             {
                 result.AppendErrorWithFormat ("Invalid signal argument '%s'.\n", command.GetArgumentAtIndex(0));
                 result.SetStatus (eReturnStatusFailed);

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=116139&r1=116138&r2=116139&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Fri Oct  8 20:40:57 2010
@@ -633,7 +633,7 @@
 {
     { eArgTypeAddress, "address", CommandCompletions::eNoCompletion, NULL, "A valid address in the target program's execution space." },
     { eArgTypeAliasName, "alias-name", CommandCompletions::eNoCompletion, NULL, "The name of an abbreviation (alias) for a debugger command." },
-   { eArgTypeAliasOptions, "options-for-aliased-command", CommandCompletions::eNoCompletion, NULL, "Command options to be used as part of an alias (abbreviation) definition.  (See 'help commands alias' for more information.)" },
+    { eArgTypeAliasOptions, "options-for-aliased-command", CommandCompletions::eNoCompletion, NULL, "Command options to be used as part of an alias (abbreviation) definition.  (See 'help commands alias' for more information.)" },
     { eArgTypeArchitecture, "arch", CommandCompletions::eNoCompletion, NULL, "The architecture name, e.g. i386 or x86_64." },
     { eArgTypeBoolean, "boolean", CommandCompletions::eNoCompletion, NULL, "A Boolean value: 'true' or 'false'" },
     { eArgTypeBreakpointID, "breakpt-id", CommandCompletions::eNoCompletion, BreakpointIDHelpTextCallback, NULL },
@@ -678,7 +678,7 @@
     { eArgTypeSettingVariableName, "setting-variable-name", CommandCompletions::eNoCompletion, NULL, "The name of a settable internal debugger variable.  Type 'settings list' to see a complete list of such variables." },
     { eArgTypeShlibName, "shlib-name", CommandCompletions::eNoCompletion, NULL, "The name of a shared library." },
     { eArgTypeSourceFile, "source-file", CommandCompletions::eNoCompletion, NULL, "The name of a source file.." },
-    { eArgTypeSortOrder, "sort-order", CommandCompletions::eNoCompletion, NULL, "The sort order when dumping the symbol table." },
+    { eArgTypeSortOrder, "sort-order", CommandCompletions::eNoCompletion, NULL, "Specify a sort order when dumping lists." },
     { eArgTypeStartAddress, "start-address", CommandCompletions::eNoCompletion, NULL, "Help text goes here." },
     { eArgTypeSymbol, "symbol", CommandCompletions::eNoCompletion, NULL, "Any symbol name (function name, variable, argument, etc.)" },
     { eArgTypeThreadID, "thread-id", CommandCompletions::eNoCompletion, NULL, "Thread ID number." },

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=116139&r1=116138&r2=116139&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Fri Oct  8 20:40:57 2010
@@ -78,8 +78,12 @@
 bool
 ThreadGDBRemote::WillResume (StateType resume_state)
 {
-    // TODO: cache for next time in case we can match things up??
     ClearStackFrames();
+    // Call the Thread::WillResume first. If we stop at a signal, the stop info
+    // class for signal will set the resume signal that we need below. The signal
+    // stuff obeys the Process::UnixSignal defaults. 
+    Thread::WillResume(resume_state);
+
     int signo = GetResumeSignal();
 
     switch (resume_state)
@@ -106,7 +110,6 @@
     default:
         break;
     }
-    Thread::WillResume(resume_state);
     return true;
 }
 

Modified: lldb/trunk/source/Target/UnixSignals.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/UnixSignals.cpp?rev=116139&r1=116138&r2=116139&view=diff
==============================================================================
--- lldb/trunk/source/Target/UnixSignals.cpp (original)
+++ lldb/trunk/source/Target/UnixSignals.cpp Fri Oct  8 20:40:57 2010
@@ -47,39 +47,41 @@
     // order, you can either subclass this class, and use Add & Remove to change them
     // or you can subclass and build them afresh in your constructor;
     m_signals.clear();
-
-    AddSignal(1, "SIGHUP",     false, true,  true );    // 1    hangup
-    AddSignal(2, "SIGINT",     true,  true,  true );    // 2    interrupt
-    AddSignal(3, "SIGQUIT",    false, true,  true );    // 3    quit
-    AddSignal(4, "SIGILL",     false, true,  true );    // 4    illegal instruction (not reset when caught)
-    AddSignal(5, "SIGTRAP",    true,  true,  true );    // 5    trace trap (not reset when caught)
-    AddSignal(6, "SIGABRT",    false, true,  true );    // 6    abort()
-    AddSignal(7, "SIGEMT",     false, true,  true );    // 7    pollable event ([XSR] generated, not supported)
-    AddSignal(8, "SIGFPE",     false, true,  true );    // 8    floating point exception
-    AddSignal(9, "SIGKILL",    false, true,  true );    // 9    kill (cannot be caught or ignored)
-    AddSignal(10, "SIGBUS",    false, true,  true );    // 10    bus error
-    AddSignal(11, "SIGSEGV",   false, true,  true );    // 11    segmentation violation
-    AddSignal(12, "SIGSYS",    false, true,  true );    // 12    bad argument to system call
-    AddSignal(13, "SIGPIPE",   false, true,  true );    // 13    write on a pipe with no one to read it
-    AddSignal(14, "SIGALRM",   false, false, true );    // 14    alarm clock
-    AddSignal(15, "SIGTERM",   false, true,  true );    // 15    software termination signal from kill
-    AddSignal(16, "SIGURG",    false, false, false);    // 16    urgent condition on IO channel
-    AddSignal(17, "SIGSTOP",   false, true,  true );    // 17    sendable stop signal not from tty
-    AddSignal(18, "SIGTSTP",   false, true,  true );    // 18    stop signal from tty
-    AddSignal(19, "SIGCONT",   false, true,  true );    // 19    continue a stopped process
-    AddSignal(20, "SIGCHLD",   false, false, true );    // 20    to parent on child stop or exit
-    AddSignal(21, "SIGTTIN",   false, true,  true );    // 21    to readers pgrp upon background tty read
-    AddSignal(22, "SIGTTOU",   false, true,  true );    // 22    like TTIN for output if (tp->t_local&LTOSTOP)
-    AddSignal(23, "SIGIO",     false, false, false);    // 23    input/output possible signal
-    AddSignal(24, "SIGXCPU",   false, true,  true );    // 24    exceeded CPU time limit
-    AddSignal(25, "SIGXFSZ",   false, true,  true );    // 25    exceeded file size limit
-    AddSignal(26, "SIGVTALRM", false, false, false);    // 26    virtual time alarm
-    AddSignal(27, "SIGPROF",   false, false, false);    // 27    profiling time alarm
-    AddSignal(28, "SIGWINCH",  false, false, false);    // 28    window size changes
-    AddSignal(29, "SIGINFO",   false, true,  true );    // 29    information request
-    AddSignal(30, "SIGUSR1",   false, true,  true );    // 30    user defined signal 1
-    AddSignal(31, "SIGUSR2",   false, true,  true );    // 31    user defined signal 2
+    //        SIGNO NAME         SUPPRESS   STOP   NOTIFY
+    //        ===== ============ =========  ====== ======
+    AddSignal(1,    "SIGHUP",    false,     true,  true );    // 1     hangup
+    AddSignal(2,    "SIGINT",    true,      true,  true );    // 2     interrupt
+    AddSignal(3,    "SIGQUIT",   false,     true,  true );    // 3     quit
+    AddSignal(4,    "SIGILL",    false,     true,  true );    // 4     illegal instruction (not reset when caught)
+    AddSignal(5,    "SIGTRAP",   true,      true,  true );    // 5     trace trap (not reset when caught)
+    AddSignal(6,    "SIGABRT",   false,     true,  true );    // 6     abort()
+    AddSignal(7,    "SIGEMT",    false,     true,  true );    // 7     pollable event ([XSR] generated, not supported)
+    AddSignal(8,    "SIGFPE",    false,     true,  true );    // 8     floating point exception
+    AddSignal(9,    "SIGKILL",   false,     true,  true );    // 9     kill (cannot be caught or ignored)
+    AddSignal(10,   "SIGBUS",    false,     true,  true );    // 10    bus error
+    AddSignal(11,   "SIGSEGV",   false,     true,  true );    // 11    segmentation violation
+    AddSignal(12,   "SIGSYS",    false,     true,  true );    // 12    bad argument to system call
+    AddSignal(13,   "SIGPIPE",   false,     true,  true );    // 13    write on a pipe with no one to read it
+    AddSignal(14,   "SIGALRM",   false,     false, true );    // 14    alarm clock
+    AddSignal(15,   "SIGTERM",   false,     true,  true );    // 15    software termination signal from kill
+    AddSignal(16,   "SIGURG",    false,     false, false);    // 16    urgent condition on IO channel
+    AddSignal(17,   "SIGSTOP",   false,     true,  true );    // 17    sendable stop signal not from tty
+    AddSignal(18,   "SIGTSTP",   false,     true,  true );    // 18    stop signal from tty
+    AddSignal(19,   "SIGCONT",   false,     true,  true );    // 19    continue a stopped process
+    AddSignal(20,   "SIGCHLD",   false,     false, true );    // 20    to parent on child stop or exit
+    AddSignal(21,   "SIGTTIN",   false,     true,  true );    // 21    to readers pgrp upon background tty read
+    AddSignal(22,   "SIGTTOU",   false,     true,  true );    // 22    like TTIN for output if (tp->t_local&LTOSTOP)
+    AddSignal(23,   "SIGIO",     false,     false, false);    // 23    input/output possible signal
+    AddSignal(24,   "SIGXCPU",   false,     true,  true );    // 24    exceeded CPU time limit
+    AddSignal(25,   "SIGXFSZ",   false,     true,  true );    // 25    exceeded file size limit
+    AddSignal(26,   "SIGVTALRM", false,     false, false);    // 26    virtual time alarm
+    AddSignal(27,   "SIGPROF",   false,     false, false);    // 27    profiling time alarm
+    AddSignal(28,   "SIGWINCH",  false,     false, false);    // 28    window size changes
+    AddSignal(29,   "SIGINFO",   false,     true,  true );    // 29    information request
+    AddSignal(30,   "SIGUSR1",   false,     true,  true );    // 30    user defined signal 1
+    AddSignal(31,   "SIGUSR2",   false,     true,  true );    // 31    user defined signal 2
 }
+
 void
 UnixSignals::AddSignal (int signo, const char *name, bool default_suppress, bool default_stop, bool default_notify)
 {





More information about the lldb-commits mailing list