[Lldb-commits] [PATCH] D77000: [lldb] [PECOFF] Check that PECallFrameInfo operates on the expected architecture before interpreting RuntimeFunction structs

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Mar 28 16:40:15 PDT 2020


mstorsjo created this revision.
mstorsjo added reviewers: labath, rnk, aleksandr.urakov.
Herald added subscribers: danielkiss, kristof.beyls.
Herald added a project: LLDB.

Not sure how easy it is to make a sensible test for this; it makes a difference when the aarch64 RuntimeFunction struct, when interpreted as an x86_64 RuntimeFunction, happens to falsely match address ranges that the unwinder looks for...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77000

Files:
  lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp


Index: lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp
@@ -4,6 +4,7 @@
 
 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
 #include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/ArchSpec.h"
 #include "llvm/Support/Win64EH.h"
 
 using namespace lldb;
@@ -437,9 +438,11 @@
 PECallFrameInfo::PECallFrameInfo(ObjectFilePECOFF &object_file,
                                  uint32_t exception_dir_rva,
                                  uint32_t exception_dir_size)
-    : m_object_file(object_file),
-      m_exception_dir(object_file.ReadImageDataByRVA(exception_dir_rva,
-                                                      exception_dir_size)) {}
+    : m_object_file(object_file) {
+  if (m_object_file.GetArchitecture().GetMachine() == llvm::Triple::x86_64)
+    m_exception_dir = object_file.ReadImageDataByRVA(exception_dir_rva,
+                                                     exception_dir_size);
+}
 
 bool PECallFrameInfo::GetAddressRange(Address addr, AddressRange &range) {
   range.Clear();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77000.253385.patch
Type: text/x-patch
Size: 1228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200328/4ba708f1/attachment-0001.bin>


More information about the lldb-commits mailing list