<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 - crash for "x86_64-w64-windows-gnu" because of architecture triple mismatch - solution proposition"
href="https://bugs.llvm.org/show_bug.cgi?id=51433">51433</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>crash for "x86_64-w64-windows-gnu" because of architecture triple mismatch - solution proposition
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>rolchg@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The problem concerns the 64bit lldb (12.0.01 and 14.0.0) debugger compiled for
"x86_64-w64-windows-gnu".
The debugger crashes if a variable of type class method pointer is examined.
Debugging of the lldb shown the problem is a result of the architecture
"triple" mismatch, and a difference in the implementation of class method
pointers between "msvc" and "gnu".
The triplet lldb for debugged exe file obtains the by method
"ObjectFilePECOFF::GetModuleSpecifications"
and sets it to "x86_64-pc-windows". Finally the triplet is transformed to
""x86_64-pc-windows.msvc" by Triple::normalize at the clang side.
It seems to be reasonable to resolve the problem at its origin, by replacing
the wrong hard coded triple value, in "ObjectFilePECOFF::
GetModuleSpecifications" to the proper one, by using some additional criteria.
Here is the patch:
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 9eb1c25d2403..61550682a019 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -32,6 +32,7 @@
#include "llvm/Object/COFFImportFile.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/Host.h"
#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
@@ -163,7 +164,10 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
switch (COFFObj->getMachine()) {
case MachineAmd64:
- spec.SetTriple("x86_64-pc-windows");
+ if(llvm::sys::getProcessTriple()=="x86_64-w64-windows-gnu")
+ spec.SetTriple("x86_64-w64-windows-gnu");
+ else
+ spec.SetTriple("x86_64-pc-windows");
specs.Append(module_spec);
break;
case MachineX86:</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>