<div dir="ltr"><div>Looks good to me.</div><div>Please attach patch, so that I can test on my Linux cores.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 5:24 AM, Ed Maste <span dir="ltr"><<a href="mailto:emaste@freebsd.org" target="_blank">emaste@freebsd.org</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><span style="color:rgb(34,34,34)">feynman% readelf -n tdcnt.core</span><br></div>
<br>
Notes at offset 0x00000318 with length 0x00000d5c:<br>
  Owner         Data size       Description<br>
  FreeBSD               0x00000078      NT_PRPSINFO (prpsinfo structure)<br>
  FreeBSD               0x000000e0      NT_PRSTATUS (prstatus structure)<br>
  FreeBSD               0x00000200      NT_FPREGSET (floating point registers)<br>
  FreeBSD               0x00000018      NT_THRMISC (thrmisc structure)<br>
  FreeBSD               0x000000e0      NT_PRSTATUS (prstatus structure)<br>
  FreeBSD               0x00000200      NT_FPREGSET (floating point registers)<br>
  FreeBSD               0x00000018      NT_THRMISC (thrmisc structure)<br>
<br>
The current logic for case (b) finds the type for the first instance<br>
of NT_PRPSINFO or NT_PRSTATUS, and considers each subsequent note of<br>
the same type to be the start of a new thread.  This of course doesn't<br>
work for FreeBSD, because there is no second NT_PRPSINFO.<br>
<br>
What do you think about this approach instead:<br>
<br>
diff --git a/source/Plugins/Process/elf-core/ProcessElfCore.cpp<br>
b/source/Plugins/Process/elf-core/ProcessElfCore.cpp<br>
index 5ff3aaa..d24283a 100644<br>
--- a/source/Plugins/Process/elf-core/ProcessElfCore.cpp<br>
+++ b/source/Plugins/Process/elf-core/ProcessElfCore.cpp<br>
@@ -436,27 +436,27 @@<br>
ProcessElfCore::ParseThreadContextsFromNoteSegment(const<br>
elf::ELFProgramHeader *<br>
<div>     assert(segment_header && segment_header->p_type == llvm::ELF::PT_NOTE);<br>
<br>
</div><div>     lldb::offset_t offset = 0;<br>
-    ThreadData *thread_data = NULL;<br>
</div>+    ThreadData *thread_data = new ThreadData();<br>
+    bool have_prstatus = false;<br>
+    bool have_prpsinfo = false;<br>
<div><br>
     // Loop through the NOTE entires in the segment<br>
</div>     while (offset < segment_header->p_filesz)<br>
<div>     {<br>
-        static unsigned lead_n_type = -1;<br>
</div>         ELFNote note = ELFNote();<br>
         note.Parse(segment_data, &offset);<br>
<div><br>
-        if ((lead_n_type == (unsigned)-1) &&<br>
-           ((note.n_type == NT_PRSTATUS) || (note.n_type == NT_PRPSINFO)))<br>
</div>-            lead_n_type = note.n_type;<br>
-<br>
<div>         // Begining of new thread<br>
-        if (note.n_type == lead_n_type)<br>
</div>+        if ((note.n_type == NT_PRSTATUS && have_prstatus) ||<br>
+            (note.n_type == NT_PRPSINFO && have_prpsinfo))<br>
         {<br>
             if (thread_data)<br>
             {<br>
                 assert(thread_data->prstatus.GetByteSize() > 0);<br>
<div>                 // Add the new thread to thread list<br>
</div>                 m_thread_data.push_back(*thread_data);<br>
+                have_prstatus = false;<br>
+                have_prpsinfo = false;<br>
             }<br>
             thread_data = new ThreadData();<br>
         }<br>
@@ -470,12 +470,14 @@<br>
ProcessElfCore::ParseThreadContextsFromNoteSegment(const<br>
elf::ELFProgramHeader *<br>
         switch (note.n_type)<br>
         {<br>
             case NT_PRSTATUS:<br>
+                have_prstatus = true;<br>
                 thread_data->prstatus = note_data;<br>
                 break;<br>
             case NT_FPREGSET:<br>
                 thread_data->fpregset = note_data;<br>
                 break;<br>
             case NT_PRPSINFO:<br>
+                have_prpsinfo = true;<br>
                 thread_data->prpsinfo = note_data;<br>
                 break;<br>
             case NT_AUXV:<br>
<div><div>_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">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>
</div></div></blockquote></div><br></div></div>