[Lldb-commits] [lldb] [lldb] Support DW_OP_WASM_location in DWARFExpression (PR #151010)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 30 02:14:51 PDT 2025
================
@@ -18,27 +21,114 @@
#include "lldb/Core/dwarf.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/StreamString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
-using namespace lldb_private;
using namespace lldb_private::plugin::dwarf;
+using namespace lldb_private::wasm;
+using namespace lldb_private;
using namespace llvm::dwarf;
+namespace {
+struct MockProcess : Process {
+ MockProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
+ : Process(target_sp, listener_sp) {}
+
+ llvm::StringRef GetPluginName() override { return "mock process"; }
+ bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name) override {
+ return false;
+ };
+ Status DoDestroy() override { return {}; }
+ void RefreshStateAfterStop() override {}
+ bool DoUpdateThreadList(ThreadList &old_thread_list,
+ ThreadList &new_thread_list) override {
+ return false;
+ };
+ size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
+ Status &error) override {
+ for (size_t i = 0; i < size; ++i)
+ ((char *)buf)[i] = (vm_addr + i) & 0xff;
+ error.Clear();
----------------
DavidSpickett wrote:
When you return an error "by ref" (or by global in errno's case), there's two contracts you can have:
* callers must reset the error before calling the function
* callers can expect the function to set the error to some value no matter what happens
But yeah if you're moving this code it's academic and I'm sure we're a mix of the two contracts anyway.
https://github.com/llvm/llvm-project/pull/151010
More information about the lldb-commits
mailing list