[llvm-branch-commits] [lldb] [lldb] Revise IDE folder structure (PR #89748)

2024-05-21 Thread Med Ismail Bennani via llvm-branch-commits

https://github.com/medismailben approved this pull request.

Nice! LGTM!

https://github.com/llvm/llvm-project/pull/89748
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] 8fc9b6c - [lldb/Commands] Align process launch --plugin with process attach (NFC)

2021-01-20 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2021-01-20T21:01:23+01:00
New Revision: 8fc9b6c2c560fc5945ce2115de345efb1617d59d

URL: 
https://github.com/llvm/llvm-project/commit/8fc9b6c2c560fc5945ce2115de345efb1617d59d
DIFF: 
https://github.com/llvm/llvm-project/commit/8fc9b6c2c560fc5945ce2115de345efb1617d59d.diff

LOG: [lldb/Commands] Align process launch --plugin with process attach (NFC)

Following `7169d3a315f4cdc19c4ab6b8f20c6f91b46ba9b8`, this patch updates
the short option for the plugin command option to (`-p` to `-P`) to
align with the `process attach` command options.

The long option remains the same since there are already the same for both
commands.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Commands/CommandOptionsProcessLaunch.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp 
b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
index e94a89469ca9..4445457ca852 100644
--- a/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
+++ b/lldb/source/Commands/CommandOptionsProcessLaunch.cpp
@@ -61,7 +61,7 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
 break;
   }
 
-  case 'p': // Process plug-in name
+  case 'P': // Process plug-in name
 launch_info.SetProcessPluginName(option_arg);
 break;
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] 7169d3a - [lldb/Commands] Refactor ProcessLaunchCommandOptions to use TableGen (NFC)

2021-01-20 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2021-01-20T18:53:06+01:00
New Revision: 7169d3a315f4cdc19c4ab6b8f20c6f91b46ba9b8

URL: 
https://github.com/llvm/llvm-project/commit/7169d3a315f4cdc19c4ab6b8f20c6f91b46ba9b8
DIFF: 
https://github.com/llvm/llvm-project/commit/7169d3a315f4cdc19c4ab6b8f20c6f91b46ba9b8.diff

LOG: [lldb/Commands] Refactor ProcessLaunchCommandOptions to use TableGen (NFC)

This patch refactors the current implementation of
`ProcessLaunchCommandOptions` to be generated by TableGen.

The patch also renames the class to `CommandOptionsProcessLaunch` to
align better with the rest of the codebase style and moves it to
separate files.

Differential Review: https://reviews.llvm.org/D95059

Signed-off-by: Med Ismail Bennani 

Added: 
lldb/source/Commands/CommandOptionsProcessLaunch.cpp
lldb/source/Commands/CommandOptionsProcessLaunch.h

Modified: 
lldb/include/lldb/Target/Process.h
lldb/source/Commands/CMakeLists.txt
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/Options.td
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index 6f30787f7e5b..5ca5dd28fd8f 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -30,7 +30,6 @@
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/ProcessLaunchInfo.h"
 #include "lldb/Host/ProcessRunLock.h"
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/ExecutionContextScope.h"
 #include "lldb/Target/InstrumentationRuntime.h"
@@ -210,32 +209,6 @@ class ProcessAttachInfo : public ProcessInstanceInfo {
 // call SBProcess::Stop() to cancel attach)
 };
 
-class ProcessLaunchCommandOptions : public Options {
-public:
-  ProcessLaunchCommandOptions() : Options() {
-// Keep default values of all options in one place: OptionParsingStarting
-// ()
-OptionParsingStarting(nullptr);
-  }
-
-  ~ProcessLaunchCommandOptions() override = default;
-
-  Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
-ExecutionContext *execution_context) override;
-
-  void OptionParsingStarting(ExecutionContext *execution_context) override {
-launch_info.Clear();
-disable_aslr = eLazyBoolCalculate;
-  }
-
-  llvm::ArrayRef GetDefinitions() override;
-
-  // Instance variables to hold the values for command options.
-
-  ProcessLaunchInfo launch_info;
-  lldb_private::LazyBool disable_aslr;
-};
-
 // This class tracks the Modification state of the process.  Things that can
 // currently modify the program are running the program (which will up the
 // StopID) and writing memory (which will up the MemoryID.)

diff  --git a/lldb/source/Commands/CMakeLists.txt 
b/lldb/source/Commands/CMakeLists.txt
index 4f10516c2f69..988ff894ea67 100644
--- a/lldb/source/Commands/CMakeLists.txt
+++ b/lldb/source/Commands/CMakeLists.txt
@@ -37,6 +37,7 @@ add_lldb_library(lldbCommands
   CommandObjectVersion.cpp
   CommandObjectWatchpoint.cpp
   CommandObjectWatchpointCommand.cpp
+  CommandOptionsProcessLaunch.cpp
 
   LINK_LIBS
 lldbBase

diff  --git a/lldb/source/Commands/CommandObjectPlatform.cpp 
b/lldb/source/Commands/CommandObjectPlatform.cpp
index 3a5af9f91cf1..f306da3c8543 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "CommandObjectPlatform.h"
+#include "CommandOptionsProcessLaunch.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
@@ -1083,7 +1084,7 @@ class CommandObjectPlatformProcessLaunch : public 
CommandObjectParsed {
 return result.Succeeded();
   }
 
-  ProcessLaunchCommandOptions m_options;
+  CommandOptionsProcessLaunch m_options;
 };
 
 // "platform process list"

diff  --git a/lldb/source/Commands/CommandObjectProcess.cpp 
b/lldb/source/Commands/CommandObjectProcess.cpp
index 1eef2800ce16..35835f638557 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "CommandObjectProcess.h"
+#include "CommandOptionsProcessLaunch.h"
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/BreakpointSite.h"
@@ -251,7 +252,7 @@ class CommandObjectProcessLaunch : public 
CommandObjectProcessLaunchOrAttach {
 return result.Succeeded();
   }
 
-  ProcessLaunchCommandOptions m_options;
+  CommandOptionsProcessLaunch m_options;
 };
 
 #define LLDB_OPTIONS_process_attach

diff  --git 

[llvm-branch-commits] [llvm] 1d37db6 - [llvm/Orc] Fix ExecutionEngine module build breakage

2021-01-19 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2021-01-19T14:39:06+01:00
New Revision: 1d37db6ef53db453534b9edfcc6a58c4f4f5c914

URL: 
https://github.com/llvm/llvm-project/commit/1d37db6ef53db453534b9edfcc6a58c4f4f5c914
DIFF: 
https://github.com/llvm/llvm-project/commit/1d37db6ef53db453534b9edfcc6a58c4f4f5c914.diff

LOG: [llvm/Orc] Fix ExecutionEngine module build breakage

This patch updates the llvm module map to reflect changes made in
`24672ddea3c97fd1eca3e905b23c0116d7759ab8` and fixes the module builds
(`-DLLVM_ENABLE_MODULES=On`).

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
llvm/include/llvm/module.modulemap

Removed: 




diff  --git a/llvm/include/llvm/module.modulemap 
b/llvm/include/llvm/module.modulemap
index 51a4a3d5eb3a..a199f7f2d79a 100644
--- a/llvm/include/llvm/module.modulemap
+++ b/llvm/include/llvm/module.modulemap
@@ -190,7 +190,7 @@ module LLVM_ExecutionEngine {
   exclude header "ExecutionEngine/Orc/RemoteObjectLayer.h"
 
   // Exclude headers from LLVM_OrcSupport.
-  exclude header "ExecutionEngine/Orc/OrcError.h"
+  exclude header "ExecutionEngine/Orc/Shared/OrcError.h"
   exclude header "ExecutionEngine/Orc/RPC/RPCUtils.h"
   exclude header "ExecutionEngine/Orc/RPC/RPCSerialization.h"
   exclude header "ExecutionEngine/Orc/RPC/RawByteChannel.h"
@@ -210,7 +210,7 @@ module LLVM_FileCheck {
 module LLVM_OrcSupport {
   requires cplusplus
 
-  header "ExecutionEngine/Orc/OrcError.h"
+  header "ExecutionEngine/Orc/Shared/OrcError.h"
   header "ExecutionEngine/Orc/Shared/RPCUtils.h"
   header "ExecutionEngine/Orc/Shared/Serialization.h"
   header "ExecutionEngine/Orc/Shared/RawByteChannel.h"



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] 68e6321 - [lldb/Target] Add Scripted Processes (WIP)

2021-01-09 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2021-01-08T21:23:34+01:00
New Revision: 68e63210aeb74d2ef6ef0110da80d1aa78ba4148

URL: 
https://github.com/llvm/llvm-project/commit/68e63210aeb74d2ef6ef0110da80d1aa78ba4148
DIFF: 
https://github.com/llvm/llvm-project/commit/68e63210aeb74d2ef6ef0110da80d1aa78ba4148.diff

LOG: [lldb/Target] Add Scripted Processes (WIP)

Signed-off-by: Med Ismail Bennani 

Added: 
lldb/bindings/python/python-scripted-process.swig
lldb/examples/python/scripted_process.py
lldb/include/lldb/Target/ScriptedProcess.h
lldb/source/Commands/CommandObjectProcessScripted.cpp
lldb/source/Commands/CommandObjectProcessScripted.h
lldb/source/Plugins/Process/Scripted/CMakeLists.txt
lldb/source/Plugins/Process/Scripted/ScriptedProcessOptions.td
lldb/source/Target/ScriptedProcess.cpp

Modified: 
lldb/bindings/python/python.swig
lldb/include/lldb/Host/ProcessLaunchInfo.h
lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
lldb/include/lldb/Interpreter/ScriptInterpreter.h
lldb/include/lldb/Target/Target.h
lldb/include/lldb/lldb-forward.h
lldb/source/Commands/CMakeLists.txt
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/Options.td
lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
lldb/source/Target/CMakeLists.txt
lldb/source/Target/Target.cpp

Removed: 




diff  --git a/lldb/bindings/python/python-scripted-process.swig 
b/lldb/bindings/python/python-scripted-process.swig
new file mode 100644
index ..4b6888f86b77
--- /dev/null
+++ b/lldb/bindings/python/python-scripted-process.swig
@@ -0,0 +1,53 @@
+%pythoncode %{
+from abc import ABC, abstractmethod
+from typing import List
+
+import lldb
+
+class ScriptedProcess(ABC):
+@abstractmethod
+def __init__(self):
+pass
+
+# Optional initializer
+def __init__(self, dictionary: lldb.SBStructuredData):
+pass
+
+### Main funcitonnalities
+@abstractmethod
+def get_num_memory_regions(self) -> int:
+pass
+
+@abstractmethod
+def get_memory_region_at_index(self, idx: int) -> lldb.SBMemoryRegionInfo:
+pass
+
+@abstractmethod
+def get_num_threads(self):
+pass
+
+@abstractmethod
+def get_thread_at_index(self, idx: int) -> lldb.SBThread:
+pass
+
+@abstractmethod
+def get_register_for_thread(self, tid:int):
+pass
+
+@abstractmethod
+def read_memory_at_address(self, addr:int) -> lldb.SBData:
+pass
+
+@abstractmethod
+def get_loaded_images(self) -> List[str]: # -> List[lldb.SBModule]:
+pass
+
+### Process state
+@abstractmethod
+def can_debug(self) -> bool:
+pass
+
+@abstractmethod
+def is_alive(self) -> bool:
+pass
+%}

diff  --git a/lldb/bindings/python/python.swig 
b/lldb/bindings/python/python.swig
index 66a75328d1e7..9459c8c7be2e 100644
--- a/lldb/bindings/python/python.swig
+++ b/lldb/bindings/python/python.swig
@@ -126,6 +126,7 @@ using namespace lldb;
 %include "interfaces.swig"
 %include "python-extensions.swig"
 %include "python-wrapper.swig"
+%include "python-scripted-process.swig"
 
 %pythoncode%{
 _initialize = True

diff  --git a/lldb/examples/python/scripted_process.py 
b/lldb/examples/python/scripted_process.py
new file mode 100644
index ..b7c43b63de32
--- /dev/null
+++ b/lldb/examples/python/scripted_process.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+from lldb import ScriptedProcess
+
+class ScriptedMachCoreProcess(ScriptedProcess):
+def __init__(self, target: lldb.SBTarget):
+self.memory_regions = []
+self.threads = []
+self.loaded_images = []
+self.stops = []
+self.target = target
+
+def __init__(self, dictionary: lldb.SBStructuredData):
+# User-defined
+pass
+
+### Main functionalities
+def get_num_memory_regions(self) -> int:
+return len(self.memory_region)
+def get_memory_region_at_index(self, idx: int) -> lldb.SBMemoryRegionInfos:
+return self.memory_region[idx]
+def get_num_threads(self) -> int:
+return len(self.threads)
+def get_thread_at_index(self, idx: int) -> lldb.SBThread:
+return self.threads[idx]
+def get_register_for_thread(self, tid: int):
+# Follow register data structure used in OS Plugins.
+return reg
+def read_memory_at_address(self, addr: int) -> lldb.SBData:
+# dict[addr:data] ?
+return addr
+def get_loaded_images(self) -> list[str]:
+return self.loaded_images
+
+### Process state
+def can_debug(self) -> bool:
+return True
+def is_alive(self) -> bool:
+return True
+
+example = 

[llvm-branch-commits] [llvm] 854b861 - [llvm/Orc] Fix ExecutionEngine module build breakage

2021-01-04 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2021-01-05T05:33:44+01:00
New Revision: 854b861881a28fda6dd9601cc07b54822ce5d00d

URL: 
https://github.com/llvm/llvm-project/commit/854b861881a28fda6dd9601cc07b54822ce5d00d
DIFF: 
https://github.com/llvm/llvm-project/commit/854b861881a28fda6dd9601cc07b54822ce5d00d.diff

LOG: [llvm/Orc] Fix ExecutionEngine module build breakage

This patch updates the llvm module map to reflect changes made in
`5efc71e119d4eba235209d262e7d171361a0b9be` and fixes the module builds
(`-DLLVM_ENABLE_MODULES=On`).

Differential Revision: https://reviews.llvm.org/D94057

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
llvm/include/llvm/module.modulemap

Removed: 




diff  --git a/llvm/include/llvm/module.modulemap 
b/llvm/include/llvm/module.modulemap
index 0fd63b00fd0d..51a4a3d5eb3a 100644
--- a/llvm/include/llvm/module.modulemap
+++ b/llvm/include/llvm/module.modulemap
@@ -211,9 +211,9 @@ module LLVM_OrcSupport {
   requires cplusplus
 
   header "ExecutionEngine/Orc/OrcError.h"
-  header "ExecutionEngine/Orc/RPC/RPCUtils.h"
-  header "ExecutionEngine/Orc/RPC/RPCSerialization.h"
-  header "ExecutionEngine/Orc/RPC/RawByteChannel.h"
+  header "ExecutionEngine/Orc/Shared/RPCUtils.h"
+  header "ExecutionEngine/Orc/Shared/Serialization.h"
+  header "ExecutionEngine/Orc/Shared/RawByteChannel.h"
 
   export *
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] dc82890 - [lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload

2020-12-14 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2020-12-15T06:18:04+01:00
New Revision: dc82890a77fe894e90103f4465bb4c838617feff

URL: 
https://github.com/llvm/llvm-project/commit/dc82890a77fe894e90103f4465bb4c838617feff
DIFF: 
https://github.com/llvm/llvm-project/commit/dc82890a77fe894e90103f4465bb4c838617feff.diff

LOG: [lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) 
overload

This patch exposes the Target::CreateBreakpoint overload with the
boolean argument to move to the neareast code to the SBAPI.

This is useful when creating column breakpoints to restrict lldb's
resolution to the pointed source location, preventing it to go to the next
line.

rdar://72196842

Differential Revision: https://reviews.llvm.org/D93266

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/bindings/interface/SBTarget.i
lldb/include/lldb/API/SBTarget.h
lldb/source/API/SBTarget.cpp

lldb/test/API/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py

Removed: 




diff  --git a/lldb/bindings/interface/SBTarget.i 
b/lldb/bindings/interface/SBTarget.i
index 57b5ccea6399..41b9be2bf1fb 100644
--- a/lldb/bindings/interface/SBTarget.i
+++ b/lldb/bindings/interface/SBTarget.i
@@ -579,6 +579,12 @@ public:
 uint32_t column, lldb::addr_t offset,
 SBFileSpecList _list);
 
+lldb::SBBreakpoint
+BreakpointCreateByLocation (const lldb::SBFileSpec _spec, uint32_t 
line,
+uint32_t column, lldb::addr_t offset,
+SBFileSpecList _list,
+bool move_to_nearest_code);
+
 lldb::SBBreakpoint
 BreakpointCreateByName (const char *symbol_name, const char *module_name = 
NULL);
 

diff  --git a/lldb/include/lldb/API/SBTarget.h 
b/lldb/include/lldb/API/SBTarget.h
index fad842c9cb1c..30f4005dfc0f 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -560,6 +560,12 @@ class LLDB_API SBTarget {
  uint32_t column, lldb::addr_t offset,
  SBFileSpecList _list);
 
+  lldb::SBBreakpoint
+  BreakpointCreateByLocation(const lldb::SBFileSpec _spec, uint32_t line,
+ uint32_t column, lldb::addr_t offset,
+ SBFileSpecList _list,
+ bool move_to_nearest_code);
+
   lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
 const char *module_name = nullptr);
 

diff  --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 2a305159bbb5..6128c04de32b 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -787,6 +787,38 @@ SBBreakpoint SBTarget::BreakpointCreateByLocation(
   return LLDB_RECORD_RESULT(sb_bp);
 }
 
+SBBreakpoint SBTarget::BreakpointCreateByLocation(
+const SBFileSpec _file_spec, uint32_t line, uint32_t column,
+lldb::addr_t offset, SBFileSpecList _module_list,
+bool move_to_nearest_code) {
+  LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByLocation,
+ (const lldb::SBFileSpec &, uint32_t, uint32_t,
+  lldb::addr_t, lldb::SBFileSpecList &, bool),
+ sb_file_spec, line, column, offset, sb_module_list,
+ move_to_nearest_code);
+
+  SBBreakpoint sb_bp;
+  TargetSP target_sp(GetSP());
+  if (target_sp && line != 0) {
+std::lock_guard guard(target_sp->GetAPIMutex());
+
+const LazyBool check_inlines = eLazyBoolCalculate;
+const LazyBool skip_prologue = eLazyBoolCalculate;
+const bool internal = false;
+const bool hardware = false;
+const FileSpecList *module_list = nullptr;
+if (sb_module_list.GetSize() > 0) {
+  module_list = sb_module_list.get();
+}
+sb_bp = target_sp->CreateBreakpoint(
+module_list, *sb_file_spec, line, column, offset, check_inlines,
+skip_prologue, internal, hardware,
+move_to_nearest_code ? eLazyBoolYes : eLazyBoolNo);
+  }
+
+  return LLDB_RECORD_RESULT(sb_bp);
+}
+
 SBBreakpoint SBTarget::BreakpointCreateByName(const char *symbol_name,
   const char *module_name) {
   LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByName,
@@ -2489,6 +2521,9 @@ void RegisterMethods(Registry ) {
BreakpointCreateByLocation,
(const lldb::SBFileSpec &, uint32_t, uint32_t,
 lldb::addr_t, lldb::SBFileSpecList &));
+  LLDB_REGISTER_METHOD(lldb::SBBreakpoint, SBTarget, 
BreakpointCreateByLocation,
+   (const lldb::SBFileSpec &, uint32_t, uint32_t,
+lldb::addr_t, lldb::SBFileSpecList &, bool));
   

[llvm-branch-commits] [lldb] 1d3f1eb - Revert "[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload"

2020-12-14 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2020-12-15T06:18:04+01:00
New Revision: 1d3f1eb855fcfb03b6ddb92543c02694115b5739

URL: 
https://github.com/llvm/llvm-project/commit/1d3f1eb855fcfb03b6ddb92543c02694115b5739
DIFF: 
https://github.com/llvm/llvm-project/commit/1d3f1eb855fcfb03b6ddb92543c02694115b5739.diff

LOG: Revert "[lldb/API] Expose Target::CreateBreakpoint(..., 
move_to_nearest_code) overload"

This reverts commit 04696ff002e7d311887b7b7e6e171340a0623dd9.

Exposing the LazyBool private type in SBTarget.h breaks some tests.

Added: 


Modified: 
lldb/bindings/interface/SBTarget.i
lldb/include/lldb/API/SBTarget.h
lldb/source/API/SBTarget.cpp

lldb/test/API/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py

Removed: 




diff  --git a/lldb/bindings/interface/SBTarget.i 
b/lldb/bindings/interface/SBTarget.i
index 41b9be2bf1fb..57b5ccea6399 100644
--- a/lldb/bindings/interface/SBTarget.i
+++ b/lldb/bindings/interface/SBTarget.i
@@ -579,12 +579,6 @@ public:
 uint32_t column, lldb::addr_t offset,
 SBFileSpecList _list);
 
-lldb::SBBreakpoint
-BreakpointCreateByLocation (const lldb::SBFileSpec _spec, uint32_t 
line,
-uint32_t column, lldb::addr_t offset,
-SBFileSpecList _list,
-bool move_to_nearest_code);
-
 lldb::SBBreakpoint
 BreakpointCreateByName (const char *symbol_name, const char *module_name = 
NULL);
 

diff  --git a/lldb/include/lldb/API/SBTarget.h 
b/lldb/include/lldb/API/SBTarget.h
index bf423726f080..fad842c9cb1c 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -9,8 +9,6 @@
 #ifndef LLDB_API_SBTARGET_H
 #define LLDB_API_SBTARGET_H
 
-#include "lldb/lldb-private-enumerations.h"
-
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBAttachInfo.h"
 #include "lldb/API/SBBreakpoint.h"
@@ -562,12 +560,6 @@ class LLDB_API SBTarget {
  uint32_t column, lldb::addr_t offset,
  SBFileSpecList _list);
 
-  lldb::SBBreakpoint
-  BreakpointCreateByLocation(const lldb::SBFileSpec _spec, uint32_t line,
- uint32_t column, lldb::addr_t offset,
- SBFileSpecList _list,
- bool move_to_nearest_code);
-
   lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
 const char *module_name = nullptr);
 
@@ -866,11 +858,6 @@ class LLDB_API SBTarget {
   void SetSP(const lldb::TargetSP _sp);
 
 private:
-  lldb::SBBreakpoint BreakpointCreateByLocationImpl(
-  const lldb::SBFileSpec _spec, uint32_t line, uint32_t column,
-  lldb::addr_t offset, SBFileSpecList _list,
-  const lldb_private::LazyBool move_to_nearest_code);
-
   lldb::TargetSP m_opaque_sp;
 };
 

diff  --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index d0761d69c667..2a305159bbb5 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -757,10 +757,14 @@ SBTarget::BreakpointCreateByLocation(const SBFileSpec 
_file_spec,
offset, 
sb_module_list));
 }
 
-SBBreakpoint SBTarget::BreakpointCreateByLocationImpl(
-const lldb::SBFileSpec _file_spec, uint32_t line, uint32_t column,
-lldb::addr_t offset, SBFileSpecList _module_list,
-const LazyBool move_to_nearest_code) {
+SBBreakpoint SBTarget::BreakpointCreateByLocation(
+const SBFileSpec _file_spec, uint32_t line, uint32_t column,
+lldb::addr_t offset, SBFileSpecList _module_list) {
+  LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByLocation,
+ (const lldb::SBFileSpec &, uint32_t, uint32_t,
+  lldb::addr_t, lldb::SBFileSpecList &),
+ sb_file_spec, line, column, offset, sb_module_list);
+
   SBBreakpoint sb_bp;
   TargetSP target_sp(GetSP());
   if (target_sp && line != 0) {
@@ -770,6 +774,7 @@ SBBreakpoint SBTarget::BreakpointCreateByLocationImpl(
 const LazyBool skip_prologue = eLazyBoolCalculate;
 const bool internal = false;
 const bool hardware = false;
+const LazyBool move_to_nearest_code = eLazyBoolCalculate;
 const FileSpecList *module_list = nullptr;
 if (sb_module_list.GetSize() > 0) {
   module_list = sb_module_list.get();
@@ -779,34 +784,7 @@ SBBreakpoint SBTarget::BreakpointCreateByLocationImpl(
 skip_prologue, internal, hardware, move_to_nearest_code);
   }
 
-  return sb_bp;
-}
-
-SBBreakpoint SBTarget::BreakpointCreateByLocation(
-const SBFileSpec _file_spec, uint32_t line, uint32_t column,
-lldb::addr_t offset, SBFileSpecList _module_list) {
-  LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBTarget, 

[llvm-branch-commits] [lldb] 0470169 - [lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) overload

2020-12-14 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2020-12-15T04:24:44+01:00
New Revision: 04701698ebaff8d0c108e590a7e55c3c5bcd4d9e

URL: 
https://github.com/llvm/llvm-project/commit/04701698ebaff8d0c108e590a7e55c3c5bcd4d9e
DIFF: 
https://github.com/llvm/llvm-project/commit/04701698ebaff8d0c108e590a7e55c3c5bcd4d9e.diff

LOG: [lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code) 
overload

This patch exposes the Target::CreateBreakpoint overload with the
boolean argument to move to the neareast code to the SBAPI.

This is useful when creating column breakpoints to restrict lldb's
resolution to the pointed source location, preventing it to go to the next
line.

rdar://72196842

Differential Revision: https://reviews.llvm.org/D93266

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/bindings/interface/SBTarget.i
lldb/include/lldb/API/SBTarget.h
lldb/source/API/SBTarget.cpp

lldb/test/API/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py

Removed: 




diff  --git a/lldb/bindings/interface/SBTarget.i 
b/lldb/bindings/interface/SBTarget.i
index 57b5ccea6399..41b9be2bf1fb 100644
--- a/lldb/bindings/interface/SBTarget.i
+++ b/lldb/bindings/interface/SBTarget.i
@@ -579,6 +579,12 @@ public:
 uint32_t column, lldb::addr_t offset,
 SBFileSpecList _list);
 
+lldb::SBBreakpoint
+BreakpointCreateByLocation (const lldb::SBFileSpec _spec, uint32_t 
line,
+uint32_t column, lldb::addr_t offset,
+SBFileSpecList _list,
+bool move_to_nearest_code);
+
 lldb::SBBreakpoint
 BreakpointCreateByName (const char *symbol_name, const char *module_name = 
NULL);
 

diff  --git a/lldb/include/lldb/API/SBTarget.h 
b/lldb/include/lldb/API/SBTarget.h
index fad842c9cb1c..bf423726f080 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -9,6 +9,8 @@
 #ifndef LLDB_API_SBTARGET_H
 #define LLDB_API_SBTARGET_H
 
+#include "lldb/lldb-private-enumerations.h"
+
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBAttachInfo.h"
 #include "lldb/API/SBBreakpoint.h"
@@ -560,6 +562,12 @@ class LLDB_API SBTarget {
  uint32_t column, lldb::addr_t offset,
  SBFileSpecList _list);
 
+  lldb::SBBreakpoint
+  BreakpointCreateByLocation(const lldb::SBFileSpec _spec, uint32_t line,
+ uint32_t column, lldb::addr_t offset,
+ SBFileSpecList _list,
+ bool move_to_nearest_code);
+
   lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
 const char *module_name = nullptr);
 
@@ -858,6 +866,11 @@ class LLDB_API SBTarget {
   void SetSP(const lldb::TargetSP _sp);
 
 private:
+  lldb::SBBreakpoint BreakpointCreateByLocationImpl(
+  const lldb::SBFileSpec _spec, uint32_t line, uint32_t column,
+  lldb::addr_t offset, SBFileSpecList _list,
+  const lldb_private::LazyBool move_to_nearest_code);
+
   lldb::TargetSP m_opaque_sp;
 };
 

diff  --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 2a305159bbb5..d0761d69c667 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -757,14 +757,10 @@ SBTarget::BreakpointCreateByLocation(const SBFileSpec 
_file_spec,
offset, 
sb_module_list));
 }
 
-SBBreakpoint SBTarget::BreakpointCreateByLocation(
-const SBFileSpec _file_spec, uint32_t line, uint32_t column,
-lldb::addr_t offset, SBFileSpecList _module_list) {
-  LLDB_RECORD_METHOD(lldb::SBBreakpoint, SBTarget, BreakpointCreateByLocation,
- (const lldb::SBFileSpec &, uint32_t, uint32_t,
-  lldb::addr_t, lldb::SBFileSpecList &),
- sb_file_spec, line, column, offset, sb_module_list);
-
+SBBreakpoint SBTarget::BreakpointCreateByLocationImpl(
+const lldb::SBFileSpec _file_spec, uint32_t line, uint32_t column,
+lldb::addr_t offset, SBFileSpecList _module_list,
+const LazyBool move_to_nearest_code) {
   SBBreakpoint sb_bp;
   TargetSP target_sp(GetSP());
   if (target_sp && line != 0) {
@@ -774,7 +770,6 @@ SBBreakpoint SBTarget::BreakpointCreateByLocation(
 const LazyBool skip_prologue = eLazyBoolCalculate;
 const bool internal = false;
 const bool hardware = false;
-const LazyBool move_to_nearest_code = eLazyBoolCalculate;
 const FileSpecList *module_list = nullptr;
 if (sb_module_list.GetSize() > 0) {
   module_list = sb_module_list.get();
@@ -784,7 +779,34 @@ SBBreakpoint SBTarget::BreakpointCreateByLocation(
 skip_prologue, internal, hardware, move_to_nearest_code);
   }
 
-  return 

[llvm-branch-commits] [lldb] af8f6c7 - [lldb/Target] Support more than 2 symbols in StackFrameRecognizer

2020-03-20 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2020-03-17T20:43:39+01:00
New Revision: af8f6c7ae9fa8499c3946c74286fd107988fd972

URL: 
https://github.com/llvm/llvm-project/commit/af8f6c7ae9fa8499c3946c74286fd107988fd972
DIFF: 
https://github.com/llvm/llvm-project/commit/af8f6c7ae9fa8499c3946c74286fd107988fd972.diff

LOG: [lldb/Target] Support more than 2 symbols in StackFrameRecognizer

This patch changes the way the StackFrame Recognizers match a certain
frame.

Until now, recognizers could be registered with a function
name but also an alternate symbol.
This change is motivated by a test failure for the Assert frame
recognizer on Linux. Depending the version of the libc, the abort
function (triggered by an assertion), could have more than two
signatures (i.e. `raise`, `__GI_raise` and `gsignal`).

Instead of only checking the default symbol name and the alternate one,
lldb will iterate over a list of symbols to match against.

rdar://60386577

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/include/lldb/Target/StackFrameRecognizer.h
lldb/packages/Python/lldbsuite/test/lldbutil.py
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Commands/Options.td

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Target/AssertFrameRecognizer.cpp
lldb/source/Target/StackFrameRecognizer.cpp
lldb/test/API/commands/frame/recognizer/TestFrameRecognizer.py
lldb/test/API/commands/frame/recognizer/main.m
lldb/unittests/Target/StackFrameRecognizerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/StackFrameRecognizer.h 
b/lldb/include/lldb/Target/StackFrameRecognizer.h
index 3e4d6abe7aeb..6be506391deb 100644
--- a/lldb/include/lldb/Target/StackFrameRecognizer.h
+++ b/lldb/include/lldb/Target/StackFrameRecognizer.h
@@ -101,8 +101,8 @@ class ScriptedStackFrameRecognizer : public 
StackFrameRecognizer {
 class StackFrameRecognizerManager {
 public:
   static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
-ConstString module, ConstString symbol,
-ConstString alternate_symbol,
+ConstString module,
+llvm::ArrayRef symbols,
 bool first_instruction_only = true);
 
   static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
@@ -110,11 +110,11 @@ class StackFrameRecognizerManager {
 lldb::RegularExpressionSP symbol,
 bool first_instruction_only = true);
 
-  static void ForEach(
-  std::function const
-  );
+  static void
+  ForEach(std::function symbols,
+ bool regexp)> const );
 
   static bool RemoveRecognizerWithID(uint32_t recognizer_id);
 

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index d603091677f3..ef0df90c416e 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -797,7 +797,7 @@ def run_to_breakpoint_do_run(test, target, bkpt, 
launch_info = None,
 test.assertEqual(num_threads, 1, "Expected 1 thread to stop at 
breakpoint, %d did."%(num_threads))
 else:
 test.assertGreater(num_threads, 0, "No threads stopped at breakpoint")
-
+
 thread = threads[0]
 return (target, process, thread, bkpt)
 

diff  --git a/lldb/source/Commands/CommandObjectFrame.cpp 
b/lldb/source/Commands/CommandObjectFrame.cpp
index baf64e5c884d..4fef9f4847e0 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -746,7 +746,7 @@ class CommandObjectFrameRecognizerAdd : public 
CommandObjectParsed {
 m_module = std::string(option_arg);
 break;
   case 'n':
-m_function = std::string(option_arg);
+m_symbols.push_back(std::string(option_arg));
 break;
   case 'x':
 m_regex = true;
@@ -760,7 +760,7 @@ class CommandObjectFrameRecognizerAdd : public 
CommandObjectParsed {
 
 void OptionParsingStarting(ExecutionContext *execution_context) override {
   m_module = "";
-  m_function = "";
+  m_symbols.clear();
   m_class_name = "";
   m_regex = false;
 }
@@ -772,7 +772,7 @@ class CommandObjectFrameRecognizerAdd : public 
CommandObjectParsed {
 // Instance variables to hold the values for command options.
 std::string m_class_name;
 std::string m_module;
-std::string m_function;
+std::vector m_symbols;
 bool m_regex;
   };
 
@@ -854,9 +854,18 @@ bool CommandObjectFrameRecognizerAdd::DoExecute(Args 
,
 return false;
   }
 
-  if (m_options.m_function.empty()) {
-result.AppendErrorWithFormat("%s needs a function name (-n argument).\n",
- m_cmd_name.c_str());
+  if 

[llvm-branch-commits] [lldb] 4e5d04d - [lldb/Dwarf] Improve DW_OP_bit_piece support (WIP)

2020-03-20 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2020-03-20T16:31:11+01:00
New Revision: 4e5d04da4990dbc01dd6dfa1c564a552c6b473d8

URL: 
https://github.com/llvm/llvm-project/commit/4e5d04da4990dbc01dd6dfa1c564a552c6b473d8
DIFF: 
https://github.com/llvm/llvm-project/commit/4e5d04da4990dbc01dd6dfa1c564a552c6b473d8.diff

LOG: [lldb/Dwarf] Improve DW_OP_bit_piece support (WIP)

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/include/lldb/Core/Value.h
lldb/source/Core/Value.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index 641a64a3bbbe..8ecff57179df 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -128,6 +128,8 @@ class Value {
   void SetBytes(const void *bytes, int len);
 
   void AppendBytes(const void *bytes, int len);
+  
+  void AppendBits(const Value , int len);
 
   Value =(const Value );
 

diff  --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index 63467644cdef..f3de421dc36a 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -104,6 +104,18 @@ void Value::AppendBytes(const void *bytes, int len) {
   m_value = (uintptr_t)m_data_buffer.GetBytes();
 }
 
+void Value::AppendBits(const Value& rhs, int len) {
+  m_value_type = eValueTypeHostAddress;
+  
+  llvm::APInt fail_value(1, 0, false);
+  llvm::APInt ap_int = GetScalar().UInt128(fail_value);
+  llvm::APInt rhs_int = rhs.GetScalar().UInt128(fail_value);
+  rhs_int = rhs_int << len;
+  ap_int |= rhs_int;
+  memcpy(m_data_buffer.GetBytes(), ap_int.getRawData(), 
ceil(ap_int.getBitWidth() / 8.0));
+  m_value = (uintptr_t)m_data_buffer.GetBytes();
+}
+
 void Value::Dump(Stream *strm) {
   m_value.GetValue(strm, true);
   strm->Printf(", value_type = %s, context = %p, context_type = %s",

diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 09df9b789bab..a4cda94a3ee8 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -933,6 +933,8 @@ bool DWARFExpression::Evaluate(
   uint32_t reg_num;
 
   /// Insertion point for evaluating multi-piece expression.
+//  uint64_t op_piece_offset = 0;
+//  Value pieces; // Used for DW_OP_piece and DW_OP_bit_piece
   llvm::BitVector bit_pieces;
   llvm::BitVector bit_mask;
 
@@ -2164,31 +2166,85 @@ bool DWARFExpression::Evaluate(
   curr_scalar = curr_scalar << curr_width;
   bit_pieces.resize(curr_width + piece_byte_size * 8);
   bit_pieces.setBitsInMask(_scalar);
+  // If this is the second or later piece there should be a value on
+  // the stack.
+//  if (op_piece_offset) {
+//if (pieces.GetBuffer().GetByteSize() != op_piece_offset) {
+//  if (error_ptr)
+//error_ptr->SetErrorStringWithFormat(
+//"DW_OP_piece for offset %" PRIu64
+//" but top of stack is of size %" PRIu64,
+//op_piece_offset, pieces.GetBuffer().GetByteSize());
+//  return false;
+//}
+//  }
+//
+//   This is the first piece, we should push it back onto the stack
+//   so subsequent pieces will be able to access this piece and add
+//   to it.
+//  if (pieces.AppendDataToHostBuffer(curr_piece) == 0) {
+//if (error_ptr)
+//  error_ptr->SetErrorString("failed to append piece data");
+//return false;
+//  }
 }
+//op_piece_offset += piece_byte_size;
   }
 } break;
 
-case DW_OP_bit_piece: // 0x9d ULEB128 bit size, ULEB128 bit offset 
(DWARF3);
-  if (stack.size() < 1) {
-if (error_ptr)
-  error_ptr->SetErrorString(
-  "Expression stack needs at least 1 item for DW_OP_bit_piece.");
-return false;
+// 0x9d ULEB128 bit size, ULEB128 bit offset (DWARF3);
+case DW_OP_bit_piece: {
+  Value curr_bit_piece;
+  
+  const uint64_t piece_bit_size = opcodes.GetULEB128();
+  const uint64_t piece_bit_offset = opcodes.GetULEB128();
+
+  const uint64_t piece_byte_size = ceil(piece_bit_size / 8.0);
+
+
+  if (stack.empty()) {
+// For unknown location, set bits in mask at the right offset.
+bit_mask.resize(bit_mask.size() + piece_bit_size);
+bit_mask.set(bit_mask.size() + piece_bit_offset, piece_bit_offset + 
piece_bit_size);
+
+
+
+// In a multi-piece expression, this means that the current piece is
+// not available. Fill with zeros for now by resizing the data and
+// appending it
+//curr_bit_piece.ResizeData(piece_byte_size);
+//// Note that "0" is not a correct value for the unknown bits.
+//

[llvm-branch-commits] [lldb] 903f2a2 - [lldb/Dwarf] Change DW_OP_piece to use an llvm::BitVector

2020-03-20 Thread Med Ismail Bennani via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2020-03-19T20:07:19+01:00
New Revision: 903f2a2dbb30fcba786d9ae9a63a3b5e414a2a6e

URL: 
https://github.com/llvm/llvm-project/commit/903f2a2dbb30fcba786d9ae9a63a3b5e414a2a6e
DIFF: 
https://github.com/llvm/llvm-project/commit/903f2a2dbb30fcba786d9ae9a63a3b5e414a2a6e.diff

LOG: [lldb/Dwarf] Change DW_OP_piece to use an llvm::BitVector

This patch changes the implementation of DW_OP_piece to use
llvm::BitVector instead of the lldb_private::Value.

This allow to have more granularity which would be useful to implement
DW_OP_bit_piece but also when combined with a second BitVector for
masking the unknown bits/bytes, improves the DWARF Expression
evaluation Since it will show a future patch, the unknown bits/bytes as
optimised.

Additionally, this patch fixes a overloading resolution on the Scalar
constructor when using fixed-size interger types instead of fundamentale types.
It also fixes a bug when requesting a Scalar size when the value is less
than a byte.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Utility/Scalar.cpp

Removed: 




diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 7f12d06450c6..09df9b789bab 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -933,8 +933,8 @@ bool DWARFExpression::Evaluate(
   uint32_t reg_num;
 
   /// Insertion point for evaluating multi-piece expression.
-  uint64_t op_piece_offset = 0;
-  Value pieces; // Used for DW_OP_piece
+  llvm::BitVector bit_pieces;
+  llvm::BitVector bit_mask;
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
@@ -1258,34 +1258,34 @@ bool DWARFExpression::Evaluate(
 // 8-byte signed integer constant DW_OP_constu unsigned LEB128 integer
 // constant DW_OP_consts signed LEB128 integer constant
 case DW_OP_const1u:
-  stack.push_back(Scalar((uint8_t)opcodes.GetU8()));
+  stack.push_back(Scalar((unsigned int)opcodes.GetU8()));
   break;
 case DW_OP_const1s:
-  stack.push_back(Scalar((int8_t)opcodes.GetU8()));
+  stack.push_back(Scalar((int)opcodes.GetU8()));
   break;
 case DW_OP_const2u:
-  stack.push_back(Scalar((uint16_t)opcodes.GetU16()));
+  stack.push_back(Scalar((unsigned int)opcodes.GetU16()));
   break;
 case DW_OP_const2s:
-  stack.push_back(Scalar((int16_t)opcodes.GetU16()));
+  stack.push_back(Scalar((int)opcodes.GetU16()));
   break;
 case DW_OP_const4u:
-  stack.push_back(Scalar((uint32_t)opcodes.GetU32()));
+  stack.push_back(Scalar((unsigned int)opcodes.GetU32()));
   break;
 case DW_OP_const4s:
-  stack.push_back(Scalar((int32_t)opcodes.GetU32()));
+  stack.push_back(Scalar((int)opcodes.GetU32()));
   break;
 case DW_OP_const8u:
-  stack.push_back(Scalar((uint64_t)opcodes.GetU64()));
+  stack.push_back(Scalar((unsigned long)opcodes.GetU64()));
   break;
 case DW_OP_const8s:
-  stack.push_back(Scalar((int64_t)opcodes.GetU64()));
+  stack.push_back(Scalar((long)opcodes.GetU64()));
   break;
 case DW_OP_constu:
-  stack.push_back(Scalar(opcodes.GetULEB128()));
+  stack.push_back(Scalar((unsigned long)opcodes.GetULEB128()));
   break;
 case DW_OP_consts:
-  stack.push_back(Scalar(opcodes.GetSLEB128()));
+  stack.push_back(Scalar((long)opcodes.GetSLEB128()));
   break;
 
 // OPCODE: DW_OP_dup
@@ -2064,27 +2064,19 @@ bool DWARFExpression::Evaluate(
 
   if (piece_byte_size > 0) {
 Value curr_piece;
+
+const uint64_t curr_width = std::max(bit_mask.size(), 
bit_pieces.size());
 
 if (stack.empty()) {
-  // In a multi-piece expression, this means that the current piece is
-  // not available. Fill with zeros for now by resizing the data and
-  // appending it
-  curr_piece.ResizeData(piece_byte_size);
-  // Note that "0" is not a correct value for the unknown bits.
-  // It would be better to also return a mask of valid bits together
-  // with the expression result, so the debugger can print missing
-  // members as "" or something.
-  ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);
-  pieces.AppendDataToHostBuffer(curr_piece);
+  bit_mask.resize(curr_width + piece_byte_size * 8);
+  bit_mask.set(curr_width, curr_width + piece_byte_size * 8);
 } else {
   Status error;
   // Extract the current piece into "curr_piece"
   Value curr_piece_source_value(stack.back());
   stack.pop_back();
 
-  const Value::ValueType curr_piece_source_value_type =
-  curr_piece_source_value.GetValueType();
-  switch