<div dir="ltr">Hey Jim or Greg,<div><br></div><div>When I did the initial llgs work, I parroted what debugserver was doing with regards to translating some signals into some GDB-compatibility constants for SIGSEGV, SIGILL and SIGFPE.  (These translated from local signal numbers to some fixed signal numbers in the 0x90-0x9f range).</div>
<div><br></div><div>Linux wasn't handling these translations back on the lldb side - i.e. the UnixSignals that we use on Linux (LinuxSignals) were not translating these into anything meaningful.</div><div><br></div><div>
Since UnixSignals essentially handles both the remote and client side, and since it is a non-goal for us to support llgs with gdb (i.e. gdb client <=> llgs), I'm not aware of why I would need to do this translation on the Linux side.</div>
<div><br></div><div>Am I missing anything?</div><div><br></div><div>The alternative to the fix I did above would be to add those non-standard signal numbers (the 0x90-0x9f) to LinuxSignals and set them up correctly.  I'm just thinking that is confusing if there isn't a good reason for it.  I figure the debugserver code may have evolved from some mixed-software backwards compatibility reasons, perhaps.</div>
<div><br></div><div>Thanks for any insight!  Ultimately I'm looking for validation or refutation of the approach I took.</div><div><br></div><div>-Todd</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Aug 27, 2014 at 10:11 AM, Todd Fiala <span dir="ltr"><<a href="mailto:todd.fiala@gmail.com" target="_blank">todd.fiala@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: tfiala<br>
Date: Wed Aug 27 12:11:56 2014<br>
New Revision: 216564<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=216564&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=216564&view=rev</a><br>
Log:<br>
NativeThreadLinux: remove translation of some Linux signals to gdb signals.<br>
<br>
I copied this originally based on what debugserver was doing.  This appears to<br>
be incorrect and unncessary for Linux.  The LinuxSignals on the lldb side<br>
don't look for these and therefore they get handled incorrectly.<br>
<br>
Leaving the hook in place since I think darwin will continue to need to<br>
translate those signal numbers.<br>
<br>
Modified:<br>
    lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=216564&r1=216563&r2=216564&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=216564&r1=216563&r2=216564&view=diff</a><br>

==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp Wed Aug 27 12:11:56 2014<br>
@@ -96,7 +96,6 @@ NativeThreadLinux::GetStopReason (Thread<br>
     case eStateRunning:<br>
     case eStateStepping:<br>
     case eStateDetached:<br>
-    default:<br>
         if (log)<br>
         {<br>
             log->Printf ("NativeThreadLinux::%s tid %" PRIu64 " in state %s cannot answer stop reason",<br>
@@ -324,39 +323,28 @@ NativeThreadLinux::MaybeLogStateChange (<br>
     log->Printf ("NativeThreadLinux: thread (pid=%" PRIu64 ", tid=%" PRIu64 ") changing from state %s to %s", pid, GetID (), StateAsCString (old_state), StateAsCString (new_state));<br>
 }<br>
<br>
-static<br>
-uint32_t MaybeTranslateHostSignoToGdbSigno (uint32_t host_signo)<br>
-{<br>
-    switch (host_signo)<br>
-    {<br>
-        case SIGSEGV: return eGdbSignalBadAccess;<br>
-        case SIGILL:  return eGdbSignalBadInstruction;<br>
-        case SIGFPE:  return eGdbSignalArithmetic;<br>
-        // NOTE: debugserver sends SIGTRAP through unmodified.  Do the same here.<br>
-        // case SIGTRAP: return eGdbSignalBreakpoint;<br>
-<br>
-        // Nothing for eGdbSignalSoftware (0x95).<br>
-        // Nothing for eGdbSignalEmulation (0x94).<br>
-<br>
-        default:<br>
-            // No translations.<br>
-            return host_signo;<br>
-    }<br>
-}<br>
-<br>
 uint32_t<br>
 NativeThreadLinux::TranslateStopInfoToGdbSignal (const ThreadStopInfo &stop_info) const<br>
 {<br>
     switch (stop_info.reason)<br>
     {<br>
         case eStopReasonSignal:<br>
-            return MaybeTranslateHostSignoToGdbSigno (stop_info.details.signal.signo);<br>
-            break;<br>
+            // No translation.<br>
+            return stop_info.details.signal.signo;<br>
<br>
         case eStopReasonException:<br>
-            // FIXME verify how we handle exception type.<br>
-            return MaybeTranslateHostSignoToGdbSigno (static_cast<uint32_t> (stop_info.details.exception.type));<br>
-            break;<br>
+            {<br>
+                Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));<br>
+                // FIXME I think the eStopReasonException is a xnu/Mach exception, which we<br>
+                // shouldn't see on Linux.<br>
+                // No translation.<br>
+                if (log)<br>
+                    log->Printf ("NativeThreadLinux::%s saw an exception stop type (signo %"<br>
+                                 PRIu64 "), not expecting to see exceptions on Linux",<br>
+                                 __FUNCTION__,<br>
+                                 stop_info.details.exception.type);<br>
+                return static_cast<uint32_t> (stop_info.details.exception.type);<br>
+            }<br>
<br>
         default:<br>
             assert (0 && "unexpected stop_info.reason found");<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>