<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Aarch64 - FreeBSD 12 : Expression evaluation causes segfault"
   href="https://bugs.llvm.org/show_bug.cgi?id=42153">42153</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Aarch64 - FreeBSD 12 : Expression evaluation causes segfault
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>itzurabhi@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22075" name="attach_22075" title="Backtrace & Thread List">attachment 22075</a> <a href="attachment.cgi?id=22075&action=edit" title="Backtrace & Thread List">[details]</a></span>
Backtrace & Thread List

built the master branch(llvm,lldb,clang) from the git on 4th July 2019 on a
AARCH64 FreeBSD12.0 VM (qemu)

while running sample program with following commands : 
// sample
int main(int argc,const char ** argv){
        int z = argc + 10;
        return z;
}

/////

(LLDB)b main
(LLDB)r
(LLDB)n
(LLDB)p argc

(SEGFAULT)


=============

I faced the same issue on 7.1 release branch also, same segfault/back trace was
generated.So tested latest git in order to see if it was fixed after that.


>From my analysis , this line causes:

(data_sp && ReadGPR() && ReadFPR())

<a href="https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp#L167">https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp#L167</a>

m_register_info_up - point to a zero address.only the constructor of the class
calls .reset on this smart pointer.


I have done some debugging and suspect 

(RegisterContextPOSIXProcessMonitor_arm64::ReadGPR())
<a href="https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp#L35">https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp#L35</a>

or

(RegisterContextPOSIXProcessMonitor_arm64::ReadFPR())
<a href="https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp#L40">https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp#L40</a>

might be causing the overwrite. please advise on where to look further, I am
ready to work on a fix.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>