[Lldb-commits] [PATCH] D159164: [lldb] Add assembly syntax highlighting

2023-08-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Similar to the LLVM patch this depends on, this patch is a WIP to get some 
early feedback. This definitely needs a test. Most of the patch deals with 
plumbing the value of `Debugger::GetUseColor` to the `Disassembler`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159164/new/

https://reviews.llvm.org/D159164

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


[Lldb-commits] [PATCH] D159164: [lldb] Add assembly syntax highlighting

2023-08-29 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: jasonmolenda, DavidSpickett, clayborg.
Herald added subscribers: jrtc27, sdardis.
Herald added a project: All.
JDevlieghere requested review of this revision.

Add support for syntax highlighting assembly. The current patch uses a 
different color to highlight registers, immediate and addresses.


https://reviews.llvm.org/D159164

Files:
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/lldb-private-interfaces.h
  lldb/source/API/SBTarget.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Core/Disassembler.cpp
  lldb/source/Core/DumpDataExtractor.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
  
lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
  lldb/source/Target/ThreadPlanTracer.cpp

Index: lldb/source/Target/ThreadPlanTracer.cpp
===
--- lldb/source/Target/ThreadPlanTracer.cpp
+++ lldb/source/Target/ThreadPlanTracer.cpp
@@ -96,7 +96,8 @@
 Disassembler *ThreadPlanAssemblyTracer::GetDisassembler() {
   if (!m_disassembler_sp)
 m_disassembler_sp = Disassembler::FindPlugin(
-m_process.GetTarget().GetArchitecture(), nullptr, nullptr);
+m_process.GetTarget().GetArchitecture(), nullptr,
+m_process.GetTarget().GetDebugger().GetUseColor(), nullptr);
   return m_disassembler_sp.get();
 }
 
Index: lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
===
--- lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -70,7 +70,7 @@
 
 const bool prefer_file_cache = true;
 DisassemblerSP disasm_sp(Disassembler::DisassembleBytes(
-m_arch, nullptr, nullptr, range.GetBaseAddress(), opcode_data,
+m_arch, nullptr, nullptr, false, range.GetBaseAddress(), opcode_data,
 opcode_size, 9, prefer_file_cache));
 
 Log *log = GetLog(LLDBLog::Unwind);
Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
===
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
@@ -22,8 +22,8 @@
 
 class DisassemblerLLVMC : public lldb_private::Disassembler {
 public:
-  DisassemblerLLVMC(const lldb_private::ArchSpec ,
-const char *flavor /* = NULL */);
+  DisassemblerLLVMC(const lldb_private::ArchSpec , const char *flavor,
+bool use_colors = false);
 
   ~DisassemblerLLVMC() override;
 
@@ -35,7 +35,8 @@
   static llvm::StringRef GetPluginNameStatic() { return "llvm-mc"; }
 
   static lldb::DisassemblerSP CreateInstance(const lldb_private::ArchSpec ,
- const char *flavor);
+ const char *flavor,
+ bool use_colors);
 
   size_t DecodeInstructions(const lldb_private::Address _addr,
 const lldb_private::DataExtractor ,
@@ -72,6 +73,7 @@
   InstructionLLVMC *m_inst;
   std::mutex m_mutex;
   bool m_data_from_file;
+  bool m_use_colors;
   // Save the AArch64 ADRP instruction word and address it was at,
   // in case the next instruction is an ADD to the same register;
   // this is a pc-relative address calculation and we need both
Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
===
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -54,7 +54,7 @@
 public:
   static std::unique_ptr
   Create(const char *triple, const char *cpu, const char *features_str,
- unsigned flavor, DisassemblerLLVMC );
+ unsigned flavor, bool use_color, DisassemblerLLVMC );
 
   ~MCDisasmInstance() = default;
 
@@ -1227,7 +1227,7 @@
 std::unique_ptr
 DisassemblerLLVMC::MCDisasmInstance::Create(const char *triple, const char *cpu,
 const char *features_str,
-unsigned flavor,
+unsigned flavor, bool use_color,
 DisassemblerLLVMC ) {
   using Instance = std::unique_ptr;
 
@@ -1291,6 +1291,7 @@
 return Instance();
 
   instr_printer_up->setPrintBranchImmAsAddress(true);
+  instr_printer_up->setUseColor(use_color);
 
   // Not all targets may have registered createMCInstrAnalysis().
   std::unique_ptr instr_analysis_up(
@@ -1344,6 +1345,8 @@
   

[Lldb-commits] [PATCH] D159142: [lldb] Add support for recognizing swift ast sections in object files

2023-08-29 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd accepted this revision.
compnerd added a comment.
This revision is now accepted and ready to land.

LGTM with @kastiglione's comments addressed.




Comment at: lldb/source/Core/Section.cpp:153
+  case eSectionTypeSwiftModules:
+return "swift-modules";
   }

kastiglione wrote:
> I wonder if this should be "swiftmodules". I have never seen it spelled with 
> a hyphen.
Is it actually more than one module?  If not, `swift-module` would make sense 
given the DWARF cases - it is a "Swift Module" converted to lower kebab case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159142/new/

https://reviews.llvm.org/D159142

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


[Lldb-commits] [PATCH] D158785: [lldb] Add a "thread extrainfo" LC_NOTE for Mach-O corefiles, to store the thread IDs of the threads

2023-08-29 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Oh, and I did change the LC_NOTE name that I'm adding to "process metadata" and 
specified that it *may* contain a `threads` key, instead of *shall* contain a 
`threads` key.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158785/new/

https://reviews.llvm.org/D158785

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


[Lldb-commits] [PATCH] D158785: [lldb] Add a "thread extrainfo" LC_NOTE for Mach-O corefiles, to store the thread IDs of the threads

2023-08-29 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda updated this revision to Diff 554541.
jasonmolenda marked an inline comment as done.
jasonmolenda added a comment.

Address feedback from Alex and Jonas.  Most significantly, add a 
`ObjectFileMachO::FindLC_NOTEByName` method which all the LC_NOTE readers in 
ObjectFileMachO call.  One of them specifically needs to iterate over multiple 
LC_NOTEs with the same name ("load binary"), so it returns a vector of offset & 
sizes of matching LC_NOTEs which looks a little unusual for the "there will 
only be one of these" LC_NOTEs.  I also simplified the tid_t creation for 
missing tid_t values in ProcessMachCore when only some threads were given 
specified tid_t values.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158785/new/

https://reviews.llvm.org/D158785

Files:
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
  lldb/source/Plugins/Process/mach-core/ThreadMachCore.h
  lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py

Index: lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py
===
--- lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py
+++ lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py
@@ -26,6 +26,11 @@
 self.runCmd("continue")
 
 self.runCmd("process save-core -s stack " + corefile)
+live_tids = []
+if self.TraceOn():
+self.runCmd("thread list")
+for t in process.threads:
+live_tids.append(t.GetThreadID())
 process.Kill()
 self.dbg.DeleteTarget(target)
 
@@ -42,3 +47,9 @@
 self.assertEqual(
 thread.GetStopDescription(256), "ESR_EC_DABORT_EL0 (fault address: 0x0)"
 )
+
+if self.TraceOn():
+self.runCmd("thread list")
+for i in range(process.GetNumThreads()):
+t = process.GetThreadAtIndex(i)
+self.assertEqual(t.GetThreadID(), live_tids[i])
Index: lldb/source/Plugins/Process/mach-core/ThreadMachCore.h
===
--- lldb/source/Plugins/Process/mach-core/ThreadMachCore.h
+++ lldb/source/Plugins/Process/mach-core/ThreadMachCore.h
@@ -17,7 +17,8 @@
 
 class ThreadMachCore : public lldb_private::Thread {
 public:
-  ThreadMachCore(lldb_private::Process , lldb::tid_t tid);
+  ThreadMachCore(lldb_private::Process , lldb::tid_t tid,
+ uint32_t objfile_lc_thread_idx);
 
   ~ThreadMachCore() override;
 
@@ -57,6 +58,7 @@
   std::string m_dispatch_queue_name;
   lldb::addr_t m_thread_dispatch_qaddr;
   lldb::RegisterContextSP m_thread_reg_ctx_sp;
+  uint32_t m_objfile_lc_thread_idx;
 
   // Protected member functions.
   bool CalculateStopInfo() override;
Index: lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
===
--- lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
+++ lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
@@ -33,9 +33,11 @@
 
 // Thread Registers
 
-ThreadMachCore::ThreadMachCore(Process , lldb::tid_t tid)
+ThreadMachCore::ThreadMachCore(Process , lldb::tid_t tid,
+   uint32_t objfile_lc_thread_idx)
 : Thread(process, tid), m_thread_name(), m_dispatch_queue_name(),
-  m_thread_dispatch_qaddr(LLDB_INVALID_ADDRESS), m_thread_reg_ctx_sp() {}
+  m_thread_dispatch_qaddr(LLDB_INVALID_ADDRESS), m_thread_reg_ctx_sp(),
+  m_objfile_lc_thread_idx(objfile_lc_thread_idx) {}
 
 ThreadMachCore::~ThreadMachCore() { DestroyThread(); }
 
@@ -81,8 +83,8 @@
   ObjectFile *core_objfile =
   static_cast(process_sp.get())->GetCoreObjectFile();
   if (core_objfile)
-m_thread_reg_ctx_sp =
-core_objfile->GetThreadContextAtIndex(GetID(), *this);
+m_thread_reg_ctx_sp = core_objfile->GetThreadContextAtIndex(
+m_objfile_lc_thread_idx, *this);
 }
 reg_ctx_sp = m_thread_reg_ctx_sp;
   } else {
Index: lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
===
--- lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -594,9 +594,33 @@
 ObjectFile *core_objfile = m_core_module_sp->GetObjectFile();
 
 if (core_objfile) {
+  std::set used_tids;
   const uint32_t num_threads = core_objfile->GetNumThreadContexts();
-  for (lldb::tid_t tid = 0; tid < num_threads; ++tid) {
-ThreadSP thread_sp(new ThreadMachCore(*this, tid));
+  std::vector tids;
+  if (core_objfile->GetCorefileThreadExtraInfos(tids)) 

[Lldb-commits] [PATCH] D158785: [lldb] Add a "thread extrainfo" LC_NOTE for Mach-O corefiles, to store the thread IDs of the threads

2023-08-29 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda marked 6 inline comments as done.
jasonmolenda added a comment.

Thanks for the feedback Alex & Jonas.  Jonas' comment that we have a lot of 
different methods manually stepping over load commands to find their LC_NOTEs 
was something I'd been meaning to deal with some day, but hadn't done yet.  I 
shouldn't complicate this patch by also doing that but ... I did.  Updating the 
patch in a minute.




Comment at: lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp:608-619
+// If any threads have an unspecified thread id,
+// find an unused number, use it instead.
+tid_t current_unused_tid = 0;
+for (uint32_t i = 0; i < num_threads; i++) {
+  if (tids[i] == LLDB_INVALID_THREAD_ID) {
+while (used_tids.find(current_unused_tid) != used_tids.end()) {
+  current_unused_tid++;

JDevlieghere wrote:
> This code is (presumably on purpose) trying to find gaps in the available 
> tids: for example if I had `[1, 2, ? ,4, ?, 6]` this is going to turn that 
> into `[1, 2, (3), 4, (5), 6]`. If that property matters, it probably should 
> be part of the comment. If it doesn't, you could exploit the fact that the 
> `set` is sorted and just take the last value (6 for the previous example) and 
> return `[1, 2, 4, 6, 7, 8]`, but again, I assume that's what you're trying to 
> avoid here. 
I wasn't trying to maintain the order of the created tids, you're right I 
shouldn't bother being so fancy, just grab the highest tid number seen and 
increment past it.  I create the set by iterating over the vector, I'll just 
watch for the highest tid_t value in that loop instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158785/new/

https://reviews.llvm.org/D158785

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


[Lldb-commits] [PATCH] D159150: [lldb][NFCI] Replace bespoke iterator check with std::next

2023-08-29 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, mib, jingham, fdeazeve.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The primary goal of this change is to change `if (pair != *(--m_dict.end()))`
to `if (std::next(iter) != m_dict.end())`. I was experimenting with
changing the underlying type of `m_dict` and found that this was an
issue. Specifically, it assumes that m_dict iterators are bidirectional.
This change should make it so we only need to assume m_dict iterators can move
forward.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159150

Files:
  lldb/source/Utility/StructuredData.cpp


Index: lldb/source/Utility/StructuredData.cpp
===
--- lldb/source/Utility/StructuredData.cpp
+++ lldb/source/Utility/StructuredData.cpp
@@ -228,9 +228,9 @@
 
 void StructuredData::Dictionary::GetDescription(lldb_private::Stream ) const 
{
   size_t indentation_level = s.GetIndentLevel();
-  for (const auto  : m_dict) {
+  for (auto iter = m_dict.begin(); iter != m_dict.end(); iter++) {
 // Sanitize.
-if (pair.first.IsNull() || pair.first.IsEmpty() || !pair.second)
+if (iter->first.IsNull() || iter->first.IsEmpty() || !iter->second)
   continue;
 
 // Reset original indentation level.
@@ -238,11 +238,11 @@
 s.Indent();
 
 // Print key.
-s.Printf("%s:", pair.first.AsCString());
+s.Printf("%s:", iter->first.AsCString());
 
 // Return to new line and increase indentation if value is record type.
 // Otherwise add spacing.
-bool should_indent = IsRecordType(pair.second);
+bool should_indent = IsRecordType(iter->second);
 if (should_indent) {
   s.EOL();
   s.IndentMore();
@@ -251,8 +251,8 @@
 }
 
 // Print value and new line if now last pair.
-pair.second->GetDescription(s);
-if (pair != *(--m_dict.end()))
+iter->second->GetDescription(s);
+if (std::next(iter) != m_dict.end())
   s.EOL();
 
 // Reset indentation level if it was incremented previously.


Index: lldb/source/Utility/StructuredData.cpp
===
--- lldb/source/Utility/StructuredData.cpp
+++ lldb/source/Utility/StructuredData.cpp
@@ -228,9 +228,9 @@
 
 void StructuredData::Dictionary::GetDescription(lldb_private::Stream ) const {
   size_t indentation_level = s.GetIndentLevel();
-  for (const auto  : m_dict) {
+  for (auto iter = m_dict.begin(); iter != m_dict.end(); iter++) {
 // Sanitize.
-if (pair.first.IsNull() || pair.first.IsEmpty() || !pair.second)
+if (iter->first.IsNull() || iter->first.IsEmpty() || !iter->second)
   continue;
 
 // Reset original indentation level.
@@ -238,11 +238,11 @@
 s.Indent();
 
 // Print key.
-s.Printf("%s:", pair.first.AsCString());
+s.Printf("%s:", iter->first.AsCString());
 
 // Return to new line and increase indentation if value is record type.
 // Otherwise add spacing.
-bool should_indent = IsRecordType(pair.second);
+bool should_indent = IsRecordType(iter->second);
 if (should_indent) {
   s.EOL();
   s.IndentMore();
@@ -251,8 +251,8 @@
 }
 
 // Print value and new line if now last pair.
-pair.second->GetDescription(s);
-if (pair != *(--m_dict.end()))
+iter->second->GetDescription(s);
+if (std::next(iter) != m_dict.end())
   s.EOL();
 
 // Reset indentation level if it was incremented previously.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D152870: [lldb][NFCI] Remove StructuredData::Array::GetItemAtIndexAsString overloads with ConstString

2023-08-29 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5d49c9ce6588: [lldb][NFCI] Remove 
StructuredData::Array::GetItemAtIndexAsString overloads… (authored by 
bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152870/new/

https://reviews.llvm.org/D152870

Files:
  lldb/include/lldb/Utility/StructuredData.h
  lldb/source/Target/DynamicRegisterInfo.cpp


Index: lldb/source/Target/DynamicRegisterInfo.cpp
===
--- lldb/source/Target/DynamicRegisterInfo.cpp
+++ lldb/source/Target/DynamicRegisterInfo.cpp
@@ -144,21 +144,20 @@
   uint32_t composite_offset = UINT32_MAX;
   for (uint32_t composite_idx = 0; composite_idx < num_composite_regs;
++composite_idx) {
-ConstString composite_reg_name;
-if (!composite_reg_list.GetItemAtIndexAsString(composite_idx,
-   composite_reg_name, 
nullptr))
+llvm::StringRef composite_reg_name;
+if (!composite_reg_list.GetItemAtIndexAsString(composite_idx, 
composite_reg_name))
   return llvm::createStringError(
   llvm::inconvertibleErrorCode(),
   "\"composite\" list value is not a Python string at index %d",
   composite_idx);
 
 const RegisterInfo *composite_reg_info =
-GetRegisterInfo(composite_reg_name.GetStringRef());
+GetRegisterInfo(composite_reg_name);
 if (!composite_reg_info)
   return llvm::createStringError(
   llvm::inconvertibleErrorCode(),
   "failed to find composite register by name: \"%s\"",
-  composite_reg_name.GetCString());
+  composite_reg_name.str().c_str());
 
 composite_offset =
 std::min(composite_offset, composite_reg_info->byte_offset);
@@ -206,9 +205,10 @@
   if (dict.GetValueForKeyAsArray("sets", sets)) {
 const uint32_t num_sets = sets->GetSize();
 for (uint32_t i = 0; i < num_sets; ++i) {
-  ConstString set_name;
-  if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.IsEmpty()) {
-m_sets.push_back({set_name.AsCString(), nullptr, 0, nullptr});
+  llvm::StringRef set_name;
+  if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.empty()) {
+m_sets.push_back(
+{ConstString(set_name).AsCString(), nullptr, 0, nullptr});
   } else {
 Clear();
 printf("error: register sets must have valid names\n");
@@ -345,12 +345,12 @@
   const size_t num_regs = invalidate_reg_list->GetSize();
   if (num_regs > 0) {
 for (uint32_t idx = 0; idx < num_regs; ++idx) {
-  ConstString invalidate_reg_name;
+  llvm::StringRef invalidate_reg_name;
   uint64_t invalidate_reg_num;
   if (invalidate_reg_list->GetItemAtIndexAsString(
   idx, invalidate_reg_name)) {
 const RegisterInfo *invalidate_reg_info =
-GetRegisterInfo(invalidate_reg_name.GetStringRef());
+GetRegisterInfo(invalidate_reg_name);
 if (invalidate_reg_info) {
   m_invalidate_regs_map[i].push_back(
   invalidate_reg_info->kinds[eRegisterKindLLDB]);
@@ -359,7 +359,7 @@
   // format
   printf("error: failed to find a 'invalidate-regs' register for "
  "\"%s\" while parsing register \"%s\"\n",
- invalidate_reg_name.GetCString(), reg_info.name);
+ invalidate_reg_name.str().c_str(), reg_info.name);
 }
   } else if (invalidate_reg_list->GetItemAtIndexAsInteger(
  idx, invalidate_reg_num)) {
Index: lldb/include/lldb/Utility/StructuredData.h
===
--- lldb/include/lldb/Utility/StructuredData.h
+++ lldb/include/lldb/Utility/StructuredData.h
@@ -266,25 +266,6 @@
   return success;
 }
 
-bool GetItemAtIndexAsString(size_t idx, ConstString ) const {
-  ObjectSP value_sp = GetItemAtIndex(idx);
-  if (value_sp.get()) {
-if (auto string_value = value_sp->GetAsString()) {
-  result = ConstString(string_value->GetValue());
-  return true;
-}
-  }
-  return false;
-}
-
-bool GetItemAtIndexAsString(size_t idx, ConstString ,
-const char *default_val) const {
-  bool success = GetItemAtIndexAsString(idx, result);
-  if (!success)
-result.SetCString(default_val);
-  return success;
-}
-
 bool GetItemAtIndexAsDictionary(size_t idx, Dictionary *) const {
   result = nullptr;
   ObjectSP value_sp = GetItemAtIndex(idx);


Index: lldb/source/Target/DynamicRegisterInfo.cpp
===
--- lldb/source/Target/DynamicRegisterInfo.cpp
+++ lldb/source/Target/DynamicRegisterInfo.cpp
@@ -144,21 +144,20 @@
   uint32_t 

[Lldb-commits] [lldb] 5d49c9c - [lldb][NFCI] Remove StructuredData::Array::GetItemAtIndexAsString overloads with ConstString

2023-08-29 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-08-29T16:02:26-07:00
New Revision: 5d49c9ce65881467295fd5ef2022b60d6601e82f

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

LOG: [lldb][NFCI] Remove StructuredData::Array::GetItemAtIndexAsString 
overloads with ConstString

This is the next step in removing ConstString from StructuredData. There
are StringRef overloads already, let's use those where we can.

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

Added: 


Modified: 
lldb/include/lldb/Utility/StructuredData.h
lldb/source/Target/DynamicRegisterInfo.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/StructuredData.h 
b/lldb/include/lldb/Utility/StructuredData.h
index 3d306419340430..4133c0e036a22a 100644
--- a/lldb/include/lldb/Utility/StructuredData.h
+++ b/lldb/include/lldb/Utility/StructuredData.h
@@ -266,25 +266,6 @@ class StructuredData {
   return success;
 }
 
-bool GetItemAtIndexAsString(size_t idx, ConstString ) const {
-  ObjectSP value_sp = GetItemAtIndex(idx);
-  if (value_sp.get()) {
-if (auto string_value = value_sp->GetAsString()) {
-  result = ConstString(string_value->GetValue());
-  return true;
-}
-  }
-  return false;
-}
-
-bool GetItemAtIndexAsString(size_t idx, ConstString ,
-const char *default_val) const {
-  bool success = GetItemAtIndexAsString(idx, result);
-  if (!success)
-result.SetCString(default_val);
-  return success;
-}
-
 bool GetItemAtIndexAsDictionary(size_t idx, Dictionary *) const {
   result = nullptr;
   ObjectSP value_sp = GetItemAtIndex(idx);

diff  --git a/lldb/source/Target/DynamicRegisterInfo.cpp 
b/lldb/source/Target/DynamicRegisterInfo.cpp
index ff255a8f82fd5d..f1f45e52918d37 100644
--- a/lldb/source/Target/DynamicRegisterInfo.cpp
+++ b/lldb/source/Target/DynamicRegisterInfo.cpp
@@ -144,21 +144,20 @@ llvm::Expected 
DynamicRegisterInfo::ByteOffsetFromComposite(
   uint32_t composite_offset = UINT32_MAX;
   for (uint32_t composite_idx = 0; composite_idx < num_composite_regs;
++composite_idx) {
-ConstString composite_reg_name;
-if (!composite_reg_list.GetItemAtIndexAsString(composite_idx,
-   composite_reg_name, 
nullptr))
+llvm::StringRef composite_reg_name;
+if (!composite_reg_list.GetItemAtIndexAsString(composite_idx, 
composite_reg_name))
   return llvm::createStringError(
   llvm::inconvertibleErrorCode(),
   "\"composite\" list value is not a Python string at index %d",
   composite_idx);
 
 const RegisterInfo *composite_reg_info =
-GetRegisterInfo(composite_reg_name.GetStringRef());
+GetRegisterInfo(composite_reg_name);
 if (!composite_reg_info)
   return llvm::createStringError(
   llvm::inconvertibleErrorCode(),
   "failed to find composite register by name: \"%s\"",
-  composite_reg_name.GetCString());
+  composite_reg_name.str().c_str());
 
 composite_offset =
 std::min(composite_offset, composite_reg_info->byte_offset);
@@ -206,9 +205,10 @@ DynamicRegisterInfo::SetRegisterInfo(const 
StructuredData::Dictionary ,
   if (dict.GetValueForKeyAsArray("sets", sets)) {
 const uint32_t num_sets = sets->GetSize();
 for (uint32_t i = 0; i < num_sets; ++i) {
-  ConstString set_name;
-  if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.IsEmpty()) {
-m_sets.push_back({set_name.AsCString(), nullptr, 0, nullptr});
+  llvm::StringRef set_name;
+  if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.empty()) {
+m_sets.push_back(
+{ConstString(set_name).AsCString(), nullptr, 0, nullptr});
   } else {
 Clear();
 printf("error: register sets must have valid names\n");
@@ -345,12 +345,12 @@ DynamicRegisterInfo::SetRegisterInfo(const 
StructuredData::Dictionary ,
   const size_t num_regs = invalidate_reg_list->GetSize();
   if (num_regs > 0) {
 for (uint32_t idx = 0; idx < num_regs; ++idx) {
-  ConstString invalidate_reg_name;
+  llvm::StringRef invalidate_reg_name;
   uint64_t invalidate_reg_num;
   if (invalidate_reg_list->GetItemAtIndexAsString(
   idx, invalidate_reg_name)) {
 const RegisterInfo *invalidate_reg_info =
-GetRegisterInfo(invalidate_reg_name.GetStringRef());
+GetRegisterInfo(invalidate_reg_name);
 if (invalidate_reg_info) {
   m_invalidate_regs_map[i].push_back(
   invalidate_reg_info->kinds[eRegisterKindLLDB]);
@@ -359,7 +359,7 @@ DynamicRegisterInfo::SetRegisterInfo(const 

[Lldb-commits] [PATCH] D158583: Fix shared library loading when users define duplicate _r_debug structure.

2023-08-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Anyone have any objections? Super easy to repro this bug with the test program.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158583/new/

https://reviews.llvm.org/D158583

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added inline comments.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:107
+static size_t word_size = 4U;
+static size_t reg_size = word_size;
+

ted wrote:
> DavidSpickett wrote:
> > What's the reason to do this this way? It seems like adding an extra 
> > argument to the constructor of ABISysV_riscv  would do the same thing 
> > unless someone is calling the constructor directly but that's what 
> > CreateInstance tries to prevent.
> > 
> > I see that mips has 2 ABI plugins, and MacOS on x86 has i386 and x86_64. 
> > The former I don't think has massive differences between 32 and 64 but the 
> > latter does.
> > 
> > So I agree with sharing the ABI here between riscv32 and riscv64 just with 
> > the way it's implemented.
> > 
> > If it's because you use an array later, either make it a vector or better 
> > an llvm::SmallVector which for rv32 will likely just use stack space for 4 
> > byte stuff.
> I copied this from the ARC ABI plugin.
> 
> word_size and reg_size are used in computations, in PrepareTrivialCall and 
> SetReturnValueObject.
I'd prefer that the CreateInstance method initialize an ivar with the word size 
based on the passed-in ArchSpec, or save the ArchSpec in an ivar.  risc-v seems 
to have many variants so I worry about saving the full ArchSpec when 
ABI::CreateInstance is being called, possibly where we might not have the most 
specific ArchSpec for this process?  But 32-bit v. 64-bit will surely be 
constant.  When I was reading the patch later I'd see references to `reg_size` 
and scratch my head where that variable was coming from.

This static will not work correctly if you have an lldb connected to an rv32 
target and an rv64 target simultaneously.

Didn't the earlier ABI have a `isRV64` ivar (should have been m_is_rv64 but 
whatever) to solve this?



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:638
+bool ABISysV_riscv::CreateDefaultUnwindPlan(UnwindPlan _plan) {
+  return false;
+}

We were emailing a couple of months ago and I think I suggested something like 
this, based on the previous ABI patch

```
bool ABISysV_riscv::CreateDefaultUnwindPlan(UnwindPlan _plan) {
  unwind_plan.Clear();
  unwind_plan.SetRegisterKind(eRegisterKindGeneric);

  uint32_t pc_reg_num = LLDB_REGNUM_GENERIC_PC;
  uint32_t fp_reg_num = LLDB_REGNUM_GENERIC_FP;

  UnwindPlan::RowSP row(new UnwindPlan::Row);

  // Define the CFA as the current frame pointer value.
  row->GetCFAValue().SetIsRegisterPlusOffset(fp_reg_num, 0);
  row->SetOffset(0);

  int ptr_size = 4;
  if (isRV64)
ptr_size = 8;

  // Assume the ra reg (return pc) and caller's frame pointer 
  // have been spilled to stack already.
  row->SetRegisterLocationToAtCFAPlusOffset(fp_reg_num, ptr_size * -2, true);
  row->SetRegisterLocationToAtCFAPlusOffset(pc_reg_num, ptr_size * -1, true);

  unwind_plan.AppendRow(row);
  unwind_plan.SetSourceName("riscv default unwind plan");
  unwind_plan.SetSourcedFromCompiler(eLazyBoolNo);
  unwind_plan.SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
  return true;
}
```



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h:79-80
+uint32_t arch_flags = arch.GetFlags();
+if (!(arch_flags & lldb_private::ArchSpec::eRISCV_rvc))
+  if (pc & 2)
+return false;

DavidSpickett wrote:
> Combine this into one if.
Maybe more clear like
```
if (arch_flags | ArchSpec::eRISCV_rvc && pc & 2) 
  return false;
```

It's too bad ArchSpec doesn't have a `Flags()` method which returns a Flags 
object, so this could be  `if (arch.Flags().Test(ArchSpec::eRISCV_rvc) && pc & 
2)`.

Suppose it would be just as easy to do 
```
  Flags arch_flags(arch.GetFlags();
  if (arch_flags.Test(ArchSpec::eRISCV_rvc) && pc & 2)
return false;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159101/new/

https://reviews.llvm.org/D159101

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread Ted Woodward via Phabricator via lldb-commits
ted updated this revision to Diff 554505.
ted added a comment.

Updated with David Spickett's comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159101/new/

https://reviews.llvm.org/D159101

Files:
  lldb/source/Plugins/ABI/CMakeLists.txt
  lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
  lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
  lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
===
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -1550,6 +1550,8 @@
 ArchSpec::eRISCV_float_abi_quad)
   features_str += "+f,+d,+q,";
 // FIXME: how do we detect features such as `+a`, `+m`?
+// Turn them on by default now, since everyone seems to use them
+features_str += "+a,+m,";
   }
 
   // We use m_disasm_up.get() to tell whether we are valid or not, so if this
Index: lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
===
--- /dev/null
+++ lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_lldb_library(lldbPluginABIRISCV PLUGIN
+  ABISysV_riscv.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
+TargetParser
+  )
Index: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
===
--- /dev/null
+++ lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -0,0 +1,127 @@
+//===-- ABISysV_riscv.h -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_ABISysV_riscv_h_
+#define liblldb_ABISysV_riscv_h_
+
+// Other libraries and framework includes
+#include 
+
+#include "llvm/TargetParser/Triple.h"
+
+// Project includes
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Process.h"
+#include "lldb/lldb-private.h"
+
+class ABISysV_riscv : public lldb_private::RegInfoBasedABI {
+public:
+  ~ABISysV_riscv() override = default;
+
+  size_t GetRedZoneSize() const override { return 0; }
+
+  bool PrepareTrivialCall(lldb_private::Thread , lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  // Special thread plan for GDB style non-jit function calls.
+  bool
+  PrepareTrivialCall(lldb_private::Thread , lldb::addr_t sp,
+ lldb::addr_t functionAddress, lldb::addr_t returnAddress,
+ llvm::Type ,
+ llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread ,
+ lldb_private::ValueList ) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP _sp,
+   lldb::ValueObjectSP _value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread ,
+   lldb_private::CompilerType ) const override;
+
+  // Specialized to work with llvm IR types.
+  lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread ,
+   llvm::Type ) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan _plan) override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan _plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+// The CFA must be 128 bit aligned, unless the E ABI is used
+lldb_private::ArchSpec arch = GetProcessSP()->GetTarget().GetArchitecture();
+uint32_t arch_flags = arch.GetFlags();
+if (arch_flags & lldb_private::ArchSpec::eRISCV_rve)
+  return (cfa & 0x3ull) == 0;
+return (cfa & 0xfull) == 0;
+  }
+
+  bool CodeAddressIsValid(lldb::addr_t pc) override {
+// Calls can use the least significant bit to store auxiliary information,
+// so no strict check is done for alignment.
+
+lldb_private::ArchSpec arch = GetProcessSP()->GetTarget().GetArchitecture();
+
+//  & 2 set is a fault if C extension is not used.
+uint32_t arch_flags = arch.GetFlags();
+if (!(arch_flags & lldb_private::ArchSpec::eRISCV_rvc) && (pc & 2))
+  return false;
+
+// Make sure 64 bit addr_t only has lower 32 bits set on riscv32
+llvm::Triple::ArchType machine = arch.GetMachine();
+if (llvm::Triple::riscv32 == machine)
+  

[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-08-29 Thread Alex Langford via Phabricator via lldb-commits
bulbazord updated this revision to Diff 554504.
bulbazord added a comment.

Protect StringSet with a mutex


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

Files:
  lldb/include/lldb/Target/UnixSignals.h
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Target/UnixSignals.cpp

Index: lldb/source/Target/UnixSignals.cpp
===
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -18,17 +18,13 @@
 using namespace lldb_private;
 using namespace llvm;
 
-UnixSignals::Signal::Signal(const char *name, bool default_suppress,
+UnixSignals::Signal::Signal(llvm::StringRef name, bool default_suppress,
 bool default_stop, bool default_notify,
-const char *description, const char *alias)
-: m_name(name), m_alias(alias), m_description(),
+llvm::StringRef description, llvm::StringRef alias)
+: m_name(name), m_alias(alias), m_description(description),
   m_suppress(default_suppress), m_stop(default_stop),
-  m_notify(default_notify),
-  m_default_suppress(default_suppress), m_default_stop(default_stop),
-  m_default_notify(default_notify) {
-  if (description)
-m_description.assign(description);
-}
+  m_notify(default_notify), m_default_suppress(default_suppress),
+  m_default_stop(default_stop), m_default_notify(default_notify) {}
 
 lldb::UnixSignalsSP UnixSignals::Create(const ArchSpec ) {
   const auto  = arch.GetTriple();
@@ -104,9 +100,10 @@
   // clang-format on
 }
 
-void UnixSignals::AddSignal(int signo, const char *name, bool default_suppress,
-bool default_stop, bool default_notify,
-const char *description, const char *alias) {
+void UnixSignals::AddSignal(int signo, llvm::StringRef name,
+bool default_suppress, bool default_stop,
+bool default_notify, llvm::StringRef description,
+llvm::StringRef alias) {
   Signal new_signal(name, default_suppress, default_stop, default_notify,
 description, alias);
   m_signals.insert(std::make_pair(signo, new_signal));
@@ -135,7 +132,7 @@
   const auto pos = m_signals.find(signo);
   if (pos == m_signals.end())
 return {};
-  return pos->second.m_name.GetStringRef();
+  return pos->second.m_name;
 }
 
 std::string
@@ -147,7 +144,7 @@
 
   collection::const_iterator pos = m_signals.find(signo);
   if (pos != m_signals.end()) {
-str = pos->second.m_name.GetCString();
+str = pos->second.m_name.str();
 
 if (code) {
   std::map::const_iterator cpos =
@@ -199,14 +196,13 @@
 }
 
 int32_t UnixSignals::GetSignalNumberFromName(const char *name) const {
-  ConstString const_name(name);
+  llvm::StringRef name_ref(name);
 
   collection::const_iterator pos, end = m_signals.end();
   for (pos = m_signals.begin(); pos != end; pos++) {
-if ((const_name == pos->second.m_name) ||
-(const_name == pos->second.m_alias) ||
-(const_name == GetShortName(pos->second.m_name)) ||
-(const_name == GetShortName(pos->second.m_alias)))
+if ((name_ref == pos->second.m_name) || (name_ref == pos->second.m_alias) ||
+(name_ref == GetShortName(pos->second.m_name)) ||
+(name_ref == GetShortName(pos->second.m_alias)))
   return pos->first;
   }
 
@@ -373,11 +369,10 @@
 
 json::Value UnixSignals::GetHitCountStatistics() const {
   json::Array json_signals;
-  for (const auto : m_signals) {
+  for (const auto  : m_signals) {
 if (pair.second.m_hit_count > 0)
-  json_signals.emplace_back(json::Object{
-{ pair.second.m_name.GetCString(), pair.second.m_hit_count }
-  });
+  json_signals.emplace_back(
+  json::Object{{pair.second.m_name, pair.second.m_hit_count}});
   }
   return std::move(json_signals);
 }
Index: lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
===
--- lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -28,10 +28,12 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/UriParser.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/Support/FormatAdapters.h"
 
 #include "Plugins/Process/Utility/GDBRemoteSignals.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
+#include 
 #include 
 
 using namespace lldb;
@@ -41,6 +43,11 @@
 LLDB_PLUGIN_DEFINE_ADV(PlatformRemoteGDBServer, PlatformGDB)
 
 static bool g_initialized = false;
+// UnixSignals does not store the signal names or descriptions itself.
+// It holds onto StringRefs. Becaue we may get signal information dynamically
+// from the 

[Lldb-commits] [PATCH] D159142: [lldb] Add support for recognizing swift ast sections in object files

2023-08-29 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added inline comments.



Comment at: lldb/source/Core/Section.cpp:153
+  case eSectionTypeSwiftModules:
+return "swift-modules";
   }

I wonder if this should be "swiftmodules". I have never seen it spelled with a 
hyphen.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159142/new/

https://reviews.llvm.org/D159142

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread Ted Woodward via Phabricator via lldb-commits
ted marked 13 inline comments as done.
ted added inline comments.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:107
+static size_t word_size = 4U;
+static size_t reg_size = word_size;
+

DavidSpickett wrote:
> What's the reason to do this this way? It seems like adding an extra argument 
> to the constructor of ABISysV_riscv  would do the same thing unless someone 
> is calling the constructor directly but that's what CreateInstance tries to 
> prevent.
> 
> I see that mips has 2 ABI plugins, and MacOS on x86 has i386 and x86_64. The 
> former I don't think has massive differences between 32 and 64 but the latter 
> does.
> 
> So I agree with sharing the ABI here between riscv32 and riscv64 just with 
> the way it's implemented.
> 
> If it's because you use an array later, either make it a vector or better an 
> llvm::SmallVector which for rv32 will likely just use stack space for 4 byte 
> stuff.
I copied this from the ARC ABI plugin.

word_size and reg_size are used in computations, in PrepareTrivialCall and 
SetReturnValueObject.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:145
+  return false;
+}
+

DavidSpickett wrote:
> Looking at the comments in lldb/include/lldb/Target/ABI.h I'm not sure which 
> of these should be implemented. I think this one is what most plugins provide.
> 
> One way to figure this out is to figure out what actually needs this. Return 
> false from both and try a bunch of things to see if it fails, run an 
> expression, step in and out etc.
> 
> I'd be more comfortable having one not implemented if we know how the other 
> one gets used.
The first one is used for calling functions via JIT. The second is used for 
calling functions via the IR Interpreter. I didn't want to enable JIT, so I 
took the Hexagon implementation (Hexagon doesn't support JIT in lldb, but can 
call functions with the IR interpreter) and reworked it for RISC-V.

Here's a function call on riscv64:
(lldb) re r pc
  pc = 0x000106b2 factrv64`main + 28 at factorial.c:32:8  
factrv64`main + 28 at factorial.c:32:8
(lldb) p factorial(3)
(int) 6




Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:310
+
+raw_value >>= 32;
+reg_info =

DavidSpickett wrote:
> I see this came from Arc which appears to be 32 bit, so this needs to change 
> for rv64?
> 
> If it doesn't, add comments above to note where rv64 would exit before 
> getting here.
Yes - on rv64, a 128 bit scalar can be passed in ARG1 and ARG2. Get the next 
chunk of data from data and write that.



Comment at: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp:1554
+// Turn them on by default now, since everyone seems to use them
+features_str += "+a,+m,";
   }

DavidSpickett wrote:
> You might want to take the lead from AArch64 here:
> ```
> // If any AArch64 variant, enable latest ISA with all extensions.
> ```
> If "+all" doesn't already work for riscv then you don't have to go and make 
> that work right now.
> 
> But in general we decided that much like llvm-objdump, we'll try to 
> disassemble any possible encoding. If the user happens to point the 
> disassembler at garbage that looks like a fancy extension on a cpu from 20 
> years ago, that's on them.
While I like the "turn on the latest" philosophy in general, for RISC-V we 
don't want to do that. It's modular architecture means features can be turned 
on and off when a core is designed, so one core might have +d (floating point 
double), while an newer core might not have any floating point at all. I'm 
inclined to leave the features as they are now, with a and m turned on.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159101/new/

https://reviews.llvm.org/D159101

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


[Lldb-commits] [PATCH] D159031: [LLDB] Fix IOHandlerEditline::GetCurrentLines()

2023-08-29 Thread walter erquinigo via Phabricator via lldb-commits
wallace added inline comments.



Comment at: lldb/source/Expression/REPL.cpp:535
+  if (current_line_idx < current_lines.GetSize()) {
+for (uint32_t i = 0; i < current_line_idx; ++i) {
+  const char *line_cstr = current_lines.GetStringAtIndex(i);

aprantl wrote:
> `for (const char *line_cstr : current_lines)` ?
actually the current code is fine because we don't want to iterate through the 
entire set, we just want the first `current_line_idx + 1` elements


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159031/new/

https://reviews.llvm.org/D159031

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


[Lldb-commits] [PATCH] D159142: [lldb] Add support for recognizing swift ast sections in object files

2023-08-29 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, aprantl, fdeazeve, kastiglione, 
augusto2112.
Herald added a subscriber: emaste.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added subscribers: lldb-commits, MaskRay.
Herald added a project: LLDB.

In Apple's downstream fork, there is support for understanding the swift
AST sections in various binaries. Even though the lldb on llvm.org does
not have support for debugging swift, I think it makes sense to move
support for recognizing swift ast sections upstream.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159142

Files:
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Core/Section.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Symbol/ObjectFile.cpp


Index: lldb/source/Symbol/ObjectFile.cpp
===
--- lldb/source/Symbol/ObjectFile.cpp
+++ lldb/source/Symbol/ObjectFile.cpp
@@ -357,6 +357,7 @@
   case eSectionTypeDWARFAppleObjC:
   case eSectionTypeDWARFGNUDebugAltLink:
   case eSectionTypeCTF:
+  case eSectionTypeSwiftModules:
 return AddressClass::eDebug;
   case eSectionTypeEHFrame:
   case eSectionTypeARMexidx:
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -1009,6 +1009,7 @@
   // .eh_frame can be truncated to 8 chars.
   .Cases(".eh_frame", ".eh_fram", eSectionTypeEHFrame)
   .Case(".gosymtab", eSectionTypeGoSymtab)
+  .Case("swiftast", eSectionTypeSwiftModules)
   .Default(eSectionTypeInvalid);
   if (section_type != eSectionTypeInvalid)
 return section_type;
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1202,6 +1202,7 @@
 case eSectionTypeDWARFAppleObjC:
 case eSectionTypeDWARFGNUDebugAltLink:
 case eSectionTypeCTF:
+case eSectionTypeSwiftModules:
   return AddressClass::eDebug;
 
 case eSectionTypeEHFrame:
@@ -1476,6 +1477,7 @@
   static ConstString g_sect_name_data("__data");
   static ConstString g_sect_name_go_symtab("__gosymtab");
   static ConstString g_sect_name_ctf("__ctf");
+  static ConstString g_sect_name_swift_ast("__swift_ast");
 
   if (section_name == g_sect_name_dwarf_debug_abbrev)
 return eSectionTypeDWARFDebugAbbrev;
@@ -1555,6 +1557,8 @@
 return eSectionTypeGoSymtab;
   if (section_name == g_sect_name_ctf)
 return eSectionTypeCTF;
+  if (section_name == g_sect_name_swift_ast)
+return eSectionTypeSwiftModules;
   if (section_name == g_sect_name_objc_data ||
   section_name == g_sect_name_objc_classrefs ||
   section_name == g_sect_name_objc_superrefs ||
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1679,6 +1679,7 @@
   .Case(".gnu_debugaltlink", eSectionTypeDWARFGNUDebugAltLink)
   .Case(".gosymtab", eSectionTypeGoSymtab)
   .Case(".text", eSectionTypeCode)
+  .Case(".swift_ast", eSectionTypeSwiftModules)
   .Default(eSectionTypeOther);
 }
 
Index: lldb/source/Core/Section.cpp
===
--- lldb/source/Core/Section.cpp
+++ lldb/source/Core/Section.cpp
@@ -149,6 +149,8 @@
 return "ctf";
   case eSectionTypeOther:
 return "regular";
+  case eSectionTypeSwiftModules:
+return "swift-modules";
   }
   return "unknown";
 }
@@ -455,6 +457,7 @@
   case eSectionTypeDWARFAppleObjC:
   case eSectionTypeDWARFGNUDebugAltLink:
   case eSectionTypeCTF:
+  case eSectionTypeSwiftModules:
 return true;
   }
   return false;
Index: lldb/include/lldb/lldb-enumerations.h
===
--- lldb/include/lldb/lldb-enumerations.h
+++ lldb/include/lldb/lldb-enumerations.h
@@ -739,6 +739,7 @@
   eSectionTypeDWARFDebugLocListsDwo,
   eSectionTypeDWARFDebugTuIndex,
   eSectionTypeCTF,
+  eSectionTypeSwiftModules,
 };
 
 FLAGS_ENUM(EmulateInstructionOptions){


Index: lldb/source/Symbol/ObjectFile.cpp
===
--- lldb/source/Symbol/ObjectFile.cpp
+++ lldb/source/Symbol/ObjectFile.cpp
@@ -357,6 +357,7 @@
   case eSectionTypeDWARFAppleObjC:
   case 

[Lldb-commits] [PATCH] D159127: [lldb][libc++] Adds chrono data formatters.

2023-08-29 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

Thanks for doing this!

Question to all: Should the summary string include the unit? lldb doesn't 
always show the type, so it could help comprehension if the unit is included. 
For example `60s` instead of `60`.




Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:986-993
+  "^std::__[[:alnum:]]+::chrono::"
+  "(((nano)|(micro)|(milli)|())seconds)|"
+  "(minutes)|"
+  "(hours)|"
+  "(days)|"
+  "(weeks)|"
+  "(months)|"

there's some regex grouping that doesn't seem to be needed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159127/new/

https://reviews.llvm.org/D159127

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread Ted Woodward via Phabricator via lldb-commits
ted added a comment.

In D159101#4625539 , @DavidSpickett 
wrote:

> Also could you provide a list of things you have tested with qemu. So I can 
> get an idea of how sure we can be any of this works / be a test plan, albeit 
> manual for anyone updating this code in future.

I'll answer this first, because it's the easiest!

I've done the following:

- Run 32 and 64 bit Linux binaries, launched on user space riscv32 and riscv64 
QEMU, using the QemuUser platform.
- Hit a breakpoint
- Continue
- Step in, step over, step out, instruction step in, instruction step out, 
including stepping all the way down and back up a 10 level recursive call
- Looked at a backtrace
- Looked at variables with frame variable
- Looked at and modified variables with the expression parser
- Read and writte memory

@jasonmolenda the step plan issue we discussed was actually a disassembler 
issue, and was fixed by D156086 .


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159101/new/

https://reviews.llvm.org/D159101

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


[Lldb-commits] [PATCH] D159127: [lldb][libc++] Adds chrono data formatters.

2023-08-29 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:996
+  TypeSummaryImplSP(new StringSummaryFormat(
+  eTypeOptionHideChildren | eTypeOptionHideValue, "${var.__rep_}")));
 }

Nice!



Comment at: 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py:23
+# clean slate for the next test case.
+def cleanup():
+self.runCmd("type format clear", check=False)

You probably copied & pasted this — this is no longer needed since every test 
function is now running in its own instance.



Comment at: 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py:33
+
+# empty vectors (and storage pointers SHOULD BOTH BE NULL..)
+self.expect("frame variable ns", substrs=["ns = 0"])

This is not guaranteed behavior and is highly specific on the actual compiler. 
I would probably just remove this first sets of tests.



Comment at: 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/main.cpp:17
+
+  return 0; // break here
+}

can you change this to a function call like
```
std::cout()<<"break here\n";
```

It's not guaranteed that all compilers actually generate code for this line 
that results in a breakpoint opportunity.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159127/new/

https://reviews.llvm.org/D159127

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


[Lldb-commits] [PATCH] D152870: [lldb][NFCI] Remove StructuredData::Array::GetItemAtIndexAsString overloads with ConstString

2023-08-29 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve accepted this revision.
fdeazeve added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152870/new/

https://reviews.llvm.org/D152870

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


[Lldb-commits] [PATCH] D158833: [lldb] Move ScriptInterpreter Interfaces to subdirectory (NFC)

2023-08-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D158833#4625775 , @bulbazord wrote:

> Re-organizing the paths seems okay to me, especially since this is going to 
> grow further. I think the header guards are going to need some adjustment 
> though.

TBH, I didn't even know they were guidelines wrt header guards 

For long file names, I've been using this pattern in the past of separating the 
words by `_` in the header guards, which also makes it more readable.

I don't think that causes any harm but if you feel strongly about it I can 
change it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158833/new/

https://reviews.llvm.org/D158833

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread Ted Woodward via Phabricator via lldb-commits
ted added reviewers: jasonmolenda, labath, asb, lewis-revill, compnerd, 
simoncook, jrtc27, JDevlieghere, aprantl, sven, kasper81, tzb99.
ted added a comment.

Adding commenters from https://reviews.llvm.org/D62732 as reviewers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159101/new/

https://reviews.llvm.org/D159101

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


[Lldb-commits] [PATCH] D158971: [lldb][NFC] Put disassembler test classes and methods in anonymous namespace

2023-08-29 Thread Venkata Ramanaiah Nalamothu via Phabricator via lldb-commits
RamNalamothu added a comment.

In D158971#4624001 , @DavidSpickett 
wrote:

> And this is being done for what reason?

This is a follow-up on https://reviews.llvm.org/D156086#inline-1518306 comment.
I see that most of the lldb unit tests follow this style.

> I seem to remember something about static and anonymous namespace in the 
> developer guide, please cite that if so.

Are you referring to 
https://llvm.org/docs/CodingStandards.html#anonymous-namespaces?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158971/new/

https://reviews.llvm.org/D158971

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread Ted Woodward via Phabricator via lldb-commits
ted added a subscriber: labath.
ted added a comment.

With this change, I'm able to debug RISC-V 32 and 64 bit applications using 
Linux user space QEMU, using @labath 's QemuUser platform. Simple expression 
parsing with the IR Interpreter is working. Complex expression parsing with JIT 
is not tested.

Here's an example of a simple debug session:

  > bin/lldb
  (lldb) platform select qemu-user
Platform: qemu-user
  Triple: x86_64-*-linux-gnu
  OS Version: 5.4.0 (5.4.0-136-generic)
Hostname: 127.0.0.1
  WorkingDir: /local/mnt/ted/upstream/full
  Kernel: #153~18.04.1-Ubuntu SMP Wed Nov 30 15:47:57 UTC 2022
  (lldb) file ~/lldb_test/factrv32
  Current executable set to '/usr2/tedwood/lldb_test/factrv32' (riscv32).
  (lldb) b main
  Breakpoint 1: where = factrv32`main + 28 at factorial.c:32:8, address = 
0x000104ea
  (lldb) target list
  Current targets:
  * target #0: /usr2/tedwood/lldb_test/factrv32 ( arch=riscv32-*-linux, 
platform=qemu-user )
  (lldb) r
  Process 1 launched: '/usr2/tedwood/lldb_test/factrv32' (riscv32)
  Process 1 stopped
  * thread #1, stop reason = breakpoint 1.1
  frame #0: 0x000104ea factrv32`main(argc=1, argv=0x40800604) at 
factorial.c:32:8
 29   }
 30 */
 31 
  -> 32   base = 10;
 33 
 34   printf("Factorial of %d is %d\n", base, factorial(base));
 35   return 0;
  (lldb) s
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x000104ee factrv32`main(argc=1, argv=0x40800604) at 
factorial.c:34:37
 31 
 32   base = 10;
 33 
  -> 34   printf("Factorial of %d is %d\n", base, factorial(base));
 35   return 0;
 36 }
 37 
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x00010488 factrv32`factorial(i=10) at factorial.c:6:7
 3  
 4  int factorial(int i)
 5  {
  -> 6if (i == 1)
 7  return 1;
 8else
 9  return i * factorial(i - 1);
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x000104a4 factrv32`factorial(i=10) at factorial.c:9:12
 6if (i == 1)
 7  return 1;
 8else
  -> 9  return i * factorial(i - 1);
 10 }
 11 
 12 int main(int argc, char **argv)
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x00010488 factrv32`factorial(i=9) at factorial.c:6:7
 3  
 4  int factorial(int i)
 5  {
  -> 6if (i == 1)
 7  return 1;
 8else
 9  return i * factorial(i - 1);
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x000104a4 factrv32`factorial(i=9) at factorial.c:9:12
 6if (i == 1)
 7  return 1;
 8else
  -> 9  return i * factorial(i - 1);
 10 }
 11 
 12 int main(int argc, char **argv)
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x00010488 factrv32`factorial(i=8) at factorial.c:6:7
 3  
 4  int factorial(int i)
 5  {
  -> 6if (i == 1)
 7  return 1;
 8else
 9  return i * factorial(i - 1);
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x000104a4 factrv32`factorial(i=8) at factorial.c:9:12
 6if (i == 1)
 7  return 1;
 8else
  -> 9  return i * factorial(i - 1);
 10 }
 11 
 12 int main(int argc, char **argv)
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x00010488 factrv32`factorial(i=7) at factorial.c:6:7
 3  
 4  int factorial(int i)
 5  {
  -> 6if (i == 1)
 7  return 1;
 8else
 9  return i * factorial(i - 1);
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x000104a4 factrv32`factorial(i=7) at factorial.c:9:12
 6if (i == 1)
 7  return 1;
 8else
  -> 9  return i * factorial(i - 1);
 10 }
 11 
 12 int main(int argc, char **argv)
  (lldb) 
  Process 1 stopped
  * thread #1, stop reason = step in
  frame #0: 0x00010488 factrv32`factorial(i=6) at factorial.c:6:7
 3  
 4  int factorial(int i)
 5  {
  -> 6if (i == 1)
 7  return 1;
 8else
 9  return i * factorial(i - 1);
  (lldb) bt
  * thread #1, stop reason = step in
* frame #0: 0x00010488 factrv32`factorial(i=6) at 

[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-08-29 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.

In D159011#4625915 , @fdeazeve wrote:

>> I decided to make it a global object to guarantee its lifetime independent 
>> of any `PlatformRemoteGDBServer` instance. I don't mind wrapping it in a 
>> concurrent structure to guarantee thread safety though.
>
> At that point we would pretty much be re-implementing the notion of a 
> ConstString but with a separate pool, right?
>
> By the way, feel free to disregard this discussion, I just wanted to make 
> sure we are aware that we lost one safety we had before.

Yep, that's basically correct. It would be a ConstString but a separate pool. I 
also don't want to disregard your point, I think it's a good one. LLDB already 
has enough thread-safety issues as-is...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

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


[Lldb-commits] [PATCH] D159127: [lldb][libc++] Adds chrono data formatters.

2023-08-29 Thread Mark de Wever via Phabricator via lldb-commits
Mordante created this revision.
Mordante added reviewers: Michael137, aprantl.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This adds the data formatters for chrono duration typedefs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159127

Files:
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/Makefile
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/main.cpp

Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/main.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/main.cpp
@@ -0,0 +1,18 @@
+#include 
+
+int main() {
+  // break here
+  std::chrono::nanoseconds ns{1};
+  std::chrono::microseconds us{12};
+  std::chrono::milliseconds ms{123};
+  std::chrono::seconds s{1234};
+  std::chrono::minutes min{12345};
+  std::chrono::hours h{123456};
+
+  std::chrono::days d{654321};
+  std::chrono::weeks w{54321};
+  std::chrono::months m{4321};
+  std::chrono::years y{321};
+
+  return 0; // break here
+}
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
===
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py
@@ -0,0 +1,58 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LibcxxChronoDataFormatterTestCase(TestBase):
+@add_test_categories(["libc++"])
+def test_with_run_command(self):
+"""Test that that file and class static variables display correctly."""
+self.build()
+(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+self, "break here", lldb.SBFileSpec("main.cpp", False)
+)
+
+# This is the function to remove the custom formats in order to have a
+# clean slate for the next test case.
+def cleanup():
+self.runCmd("type format clear", check=False)
+self.runCmd("type summary clear", check=False)
+self.runCmd("type filter clear", check=False)
+self.runCmd("type synth clear", check=False)
+self.runCmd("settings set target.max-children-count 256", check=False)
+
+# Execute the cleanup function during test case tear down.
+self.addTearDownHook(cleanup)
+
+# empty vectors (and storage pointers SHOULD BOTH BE NULL..)
+self.expect("frame variable ns", substrs=["ns = 0"])
+self.expect("frame variable us", substrs=["us = 0"])
+self.expect("frame variable ms", substrs=["ms = 0"])
+self.expect("frame variable s", substrs=["s = 0"])
+self.expect("frame variable min", substrs=["min = 0"])
+self.expect("frame variable h", substrs=["h = 0"])
+
+self.expect("frame variable d", substrs=["d = 0"])
+self.expect("frame variable w", substrs=["w = 0"])
+self.expect("frame variable m", substrs=["m = 0"])
+self.expect("frame variable y", substrs=["y = 0"])
+
+lldbutil.continue_to_breakpoint(process, bkpt)
+self.expect("frame variable ns", substrs=["ns = 1"])
+self.expect("frame variable us", substrs=["us = 12"])
+self.expect("frame variable ms", substrs=["ms = 123"])
+self.expect("frame variable s", substrs=["s = 1234"])
+self.expect("frame variable min", substrs=["min = 12345"])
+self.expect("frame variable h", substrs=["h = 123456"])
+
+self.expect("frame variable d", substrs=["d = 654321"])
+self.expect("frame variable w", substrs=["w = 54321"])
+self.expect("frame variable m", substrs=["m = 4321"])
+self.expect("frame variable y", substrs=["y = 321"])
+
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/Makefile
===
--- /dev/null
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/Makefile
@@ -0,0 +1,6 @@
+CXX_SOURCES := main.cpp
+
+USE_LIBCPP := 1
+
+CXXFLAGS_EXTRAS := -std=c++20
+include Makefile.rules
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -981,6 +981,19 @@
   

[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-08-29 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve added a comment.

> I decided to make it a global object to guarantee its lifetime independent of 
> any `PlatformRemoteGDBServer` instance. I don't mind wrapping it in a 
> concurrent structure to guarantee thread safety though.

At that point we would pretty much be re-implementing the notion of a 
ConstString but with a separate pool, right?

By the way, feel free to disregard this discussion, I just wanted to make sure 
we are aware that we lost one safety we had before.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

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


[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-08-29 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.

In D159011#4624495 , @fdeazeve wrote:

> I am slightly wary of making this a global set without any kind of thread 
> safe mechanism, as I (naively, not really knowing how this class is used) 
> would expect us to be able to instantiate multiple servers and have them be 
> accessed concurrently. As such, it makes more sense to have each server own 
> its set of strings.
>
> Have we considered having UnixSignals be the one to extend the lifetime of 
> strings? It seems that UnixSignals is the one storing the StringRefs and 
> therefore requiring extended lifetime. I couldn't figure out if there is any 
> other advantage to this vs the other suggestion.

Right, that's a fair concern I think. The reason I chose to make it not the job 
of `UnixSignals` is that the majority of these strings are string literals. I 
think having the one instance where the strings are not literals somewhere in a 
data section should be responsible for guaranteeing the lifetimes of these 
strings. I did not want to put them in the ConstString string pool because I 
don't think that string pool needs any more strings in it than already exist 
there.

That being said, you suggested the StringSet be a private member variable of 
`PlatformRemoteGDBServer`. This may work, but I wasn't sure what the lifecycle 
of `PlatformRemoteGDBServer` objects were. Perhaps it exists for a time but is 
destroyed sometime later. At that point, UnixSignals will hold onto some 
dangling references. I decided to make it a global object to guarantee its 
lifetime independent of any `PlatformRemoteGDBServer` instance. I don't mind 
wrapping it in a concurrent structure to guarantee thread safety though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

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


[Lldb-commits] [PATCH] D158833: [lldb] Move ScriptInterpreter Interfaces to subdirectory (NFC)

2023-08-29 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.

Re-organizing the paths seems okay to me, especially since this is going to 
grow further. I think the header guards are going to need some adjustment 
though.




Comment at: 
lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h:9
 
-#ifndef LLDB_INTERPRETER_SCRIPTEDPROCESSINTERFACE_H
-#define LLDB_INTERPRETER_SCRIPTEDPROCESSINTERFACE_H
+#ifndef LLDB_INTERPRETER_SCRIPTED_PROCESS_INTERFACE_H
+#define LLDB_INTERPRETER_SCRIPTED_PROCESS_INTERFACE_H

I think the LLVM convention is to reserve underscores for the `/` in the file 
path.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158833/new/

https://reviews.llvm.org/D158833

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


[Lldb-commits] [PATCH] D158863: Implement the monolithic CI pipeline in the monorepo

2023-08-29 Thread Louis Dionne via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcf1a3d93581f: Implement the monolithic CI pipeline in the 
monorepo (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158863/new/

https://reviews.llvm.org/D158863

Files:
  .ci/generate-buildkite-pipeline-premerge
  .ci/generate-buildkite-pipeline-scheduled
  .ci/monolithic-linux.sh
  .ci/monolithic-windows.sh

Index: .ci/monolithic-windows.sh
===
--- /dev/null
+++ .ci/monolithic-windows.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+#===--===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===--===##
+
+#
+# This script performs a monolithic build of the monorepo and runs the tests of
+# most projects on Windows. This should be replaced by per-project scripts that
+# run only the relevant tests.
+#
+
+set -ex
+set -o pipefail
+
+MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
+BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/monolithic-windows}"
+
+rm -rf ${BUILD_DIR}
+
+sccache --zero-stats
+function show-stats {
+  sccache --show-stats
+}
+trap show-stats EXIT
+
+projects="${1}"
+targets="${2}"
+
+echo "--- cmake"
+pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
+cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
+  -D LLVM_ENABLE_PROJECTS="${projects}" \
+  -G Ninja \
+  -D CMAKE_BUILD_TYPE=Release \
+  -D LLVM_ENABLE_ASSERTIONS=ON \
+  -D LLVM_BUILD_EXAMPLES=ON \
+  -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
+  -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml" \
+  -D COMPILER_RT_BUILD_ORC=OFF \
+  -D CMAKE_C_COMPILER_LAUNCHER=sccache \
+  -D CMAKE_CXX_COMPILER_LAUNCHER=sccache
+
+echo "--- ninja"
+ninja -C ${BUILD_DIR} ${targets}
Index: .ci/monolithic-linux.sh
===
--- /dev/null
+++ .ci/monolithic-linux.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+#===--===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===--===##
+
+#
+# This script performs a monolithic build of the monorepo and runs the tests of
+# most projects on Linux. This should be replaced by per-project scripts that
+# run only the relevant tests.
+#
+
+set -ex
+set -o pipefail
+
+MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
+BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/monolithic-linux}"
+
+rm -rf ${BUILD_DIR}
+
+ccache --zero-stats
+ccache --show-config
+function show-stats {
+  ccache --print-stats
+}
+trap show-stats EXIT
+
+projects="${1}"
+targets="${2}"
+
+echo "--- cmake"
+pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
+cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
+  -D LLVM_ENABLE_PROJECTS="${projects}" \
+  -G Ninja \
+  -D CMAKE_BUILD_TYPE=Release \
+  -D LLVM_ENABLE_ASSERTIONS=ON \
+  -D LLVM_BUILD_EXAMPLES=ON \
+  -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
+  -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml" \
+  -D LLVM_ENABLE_LLD=ON \
+  -D CMAKE_CXX_FLAGS=-gmlt \
+  -D BOLT_CLANG_EXE=/usr/bin/clang \
+  -D LLVM_CCACHE_BUILD=ON
+
+echo "--- ninja"
+ninja -C ${BUILD_DIR} ${targets}
Index: .ci/generate-buildkite-pipeline-scheduled
===
--- .ci/generate-buildkite-pipeline-scheduled
+++ .ci/generate-buildkite-pipeline-scheduled
@@ -27,4 +27,43 @@
   message: "${BUILDKITE_MESSAGE}"
   commit: "${BUILDKITE_COMMIT}"
   branch: "${BUILDKITE_BRANCH}"
-EOF
+
+  - label: ':linux: x64 Debian'
+artifact_paths:
+  - '*_result.json'
+  - 'build/monolithic-linux/test-results.xml'
+agents:
+  queue: 'linux'
+retry:
+  automatic:
+- exit_status: -1  # Agent was lost
+  limit: 2
+- exit_status: 255
+  limit: 2 # Forced agent shutdown
+timeout_in_minutes: 120
+env:
+  CC: 'clang'
+  CXX: 'clang++'
+commands:
+  - './.ci/monolithic-linux.sh "bolt;clang-tools-extra;compiler-rt;flang;libc;libclc;lld;llvm;mlir;polly;pstl" "check-all"'
+
+  - label: ':windows: x64 Windows'
+artifact_paths:
+  - '*_result.json'
+  - 'build/monolithic-windows/test-results.xml'
+agents:
+   

[Lldb-commits] [PATCH] D158863: Implement the monolithic CI pipeline in the monorepo

2023-08-29 Thread Louis Dionne via Phabricator via lldb-commits
ldionne updated this revision to Diff 554420.
ldionne marked an inline comment as done.
ldionne added a comment.

Address review comments. I did some testing using GH PRs and this should work, 
but some tweaks might be necessary. After discussing with Mikhail, I'll merge 
this now and we can make tweaks and fixes on top of it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158863/new/

https://reviews.llvm.org/D158863

Files:
  .ci/generate-buildkite-pipeline-premerge
  .ci/generate-buildkite-pipeline-scheduled
  .ci/monolithic-linux.sh
  .ci/monolithic-windows.sh

Index: .ci/monolithic-windows.sh
===
--- /dev/null
+++ .ci/monolithic-windows.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+#===--===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===--===##
+
+#
+# This script performs a monolithic build of the monorepo and runs the tests of
+# most projects on Windows. This should be replaced by per-project scripts that
+# run only the relevant tests.
+#
+
+set -ex
+set -o pipefail
+
+MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
+BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/monolithic-windows}"
+
+rm -rf ${BUILD_DIR}
+
+sccache --zero-stats
+function show-stats {
+  sccache --show-stats
+}
+trap show-stats EXIT
+
+projects="${1}"
+targets="${2}"
+
+echo "--- cmake"
+pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
+cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
+  -D LLVM_ENABLE_PROJECTS="${projects}" \
+  -G Ninja \
+  -D CMAKE_BUILD_TYPE=Release \
+  -D LLVM_ENABLE_ASSERTIONS=ON \
+  -D LLVM_BUILD_EXAMPLES=ON \
+  -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
+  -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml" \
+  -D COMPILER_RT_BUILD_ORC=OFF \
+  -D CMAKE_C_COMPILER_LAUNCHER=sccache \
+  -D CMAKE_CXX_COMPILER_LAUNCHER=sccache
+
+echo "--- ninja"
+ninja -C ${BUILD_DIR} ${targets}
Index: .ci/monolithic-linux.sh
===
--- /dev/null
+++ .ci/monolithic-linux.sh
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+#===--===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===--===##
+
+#
+# This script performs a monolithic build of the monorepo and runs the tests of
+# most projects on Linux. This should be replaced by per-project scripts that
+# run only the relevant tests.
+#
+
+set -ex
+set -o pipefail
+
+MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
+BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/monolithic-linux}"
+
+rm -rf ${BUILD_DIR}
+
+ccache --zero-stats
+ccache --show-config
+function show-stats {
+  ccache --print-stats
+}
+trap show-stats EXIT
+
+projects="${1}"
+targets="${2}"
+
+echo "--- cmake"
+pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
+cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
+  -D LLVM_ENABLE_PROJECTS="${projects}" \
+  -G Ninja \
+  -D CMAKE_BUILD_TYPE=Release \
+  -D LLVM_ENABLE_ASSERTIONS=ON \
+  -D LLVM_BUILD_EXAMPLES=ON \
+  -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
+  -D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml" \
+  -D LLVM_ENABLE_LLD=ON \
+  -D CMAKE_CXX_FLAGS=-gmlt \
+  -D BOLT_CLANG_EXE=/usr/bin/clang \
+  -D LLVM_CCACHE_BUILD=ON
+
+echo "--- ninja"
+ninja -C ${BUILD_DIR} ${targets}
Index: .ci/generate-buildkite-pipeline-scheduled
===
--- .ci/generate-buildkite-pipeline-scheduled
+++ .ci/generate-buildkite-pipeline-scheduled
@@ -27,4 +27,43 @@
   message: "${BUILDKITE_MESSAGE}"
   commit: "${BUILDKITE_COMMIT}"
   branch: "${BUILDKITE_BRANCH}"
-EOF
+
+  - label: ':linux: x64 Debian'
+artifact_paths:
+  - '*_result.json'
+  - 'build/monolithic-linux/test-results.xml'
+agents:
+  queue: 'linux'
+retry:
+  automatic:
+- exit_status: -1  # Agent was lost
+  limit: 2
+- exit_status: 255
+  limit: 2 # Forced agent shutdown
+timeout_in_minutes: 120
+env:
+  CC: 'clang'
+  CXX: 'clang++'
+commands:
+  - './.ci/monolithic-linux.sh "bolt;clang-tools-extra;compiler-rt;flang;libc;libclc;lld;llvm;mlir;polly;pstl" "check-all"'
+
+  - label: ':windows: x64 Windows'
+artifact_paths:
+

[Lldb-commits] [PATCH] D156687: [lldb][AArch64] Add kind marker to ReadAll/WriteALLRegisterValues data

2023-08-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

I understand now. If we take `WriteTLS` for example, that ends with 
`m_tls_is_valid = false;`. So you're suggesting instead we have a `WriteTLS` 
whose source is not the usual TLS buffer, but the set of saved register data 
instead. I'll look into it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156687/new/

https://reviews.llvm.org/D156687

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

Also could you provide a list of things you have tested with qemu. So I can get 
an idea of how sure we can be any of this works / be a test plan, albeit manual 
for anyone updating this code in future.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159101/new/

https://reviews.llvm.org/D159101

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a reviewer: DavidSpickett.
DavidSpickett added a comment.

From what little I know about the ABI this looks ok. Consider adding a riscv 
expert to check those bits for you.

Testing wise riscv is in a strange place without a working lldb-server or a 
buildbot that could run such a thing (and qemu-user doesn't emulate ptrace 
calls). Getting the test suite to run against qemu instead is probably more 
effort than it's worth assuming lldb-server is not that far off working. If 
that's true then I'd be ok accepting this, it's quite self contained in any 
case and we have all that instruction emulation code for single stepping 
already.

If someone could get lldb-server running on qemu-system and test against that 
(just locally) that would be a great improvement and likely flush out many 
problems with a lot of the more niche methods in these classes.




Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:11
+
+// C Includes
+// C++ Includes

In general most of these include comments you can remove, but this one in 
particular because there are no C includes.

We don't have a rule that states you comment each block, clang-format may 
re-order them but that's it.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:107
+static size_t word_size = 4U;
+static size_t reg_size = word_size;
+

What's the reason to do this this way? It seems like adding an extra argument 
to the constructor of ABISysV_riscv  would do the same thing unless someone is 
calling the constructor directly but that's what CreateInstance tries to 
prevent.

I see that mips has 2 ABI plugins, and MacOS on x86 has i386 and x86_64. The 
former I don't think has massive differences between 32 and 64 but the latter 
does.

So I agree with sharing the ABI here between riscv32 and riscv64 just with the 
way it's implemented.

If it's because you use an array later, either make it a vector or better an 
llvm::SmallVector which for rv32 will likely just use stack space for 4 byte 
stuff.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:145
+  return false;
+}
+

Looking at the comments in lldb/include/lldb/Target/ABI.h I'm not sure which of 
these should be implemented. I think this one is what most plugins provide.

One way to figure this out is to figure out what actually needs this. Return 
false from both and try a bunch of things to see if it fails, run an 
expression, step in and out etc.

I'd be more comfortable having one not implemented if we know how the other one 
gets used.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:217
+  while (byte_index < end) {
+reg_value[byte_index++] = *(value++);
+--size;

If, as I think, this and the bit below are just memcpy and memset, just use 
those and make it obvious.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:221
+
+  while (byte_index < reg_size) {
+reg_value[byte_index++] = 0;

Add a comment here like "// Pad if the type's size is smaller than the 
register.".



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:310
+
+raw_value >>= 32;
+reg_info =

I see this came from Arc which appears to be 32 bit, so this needs to change 
for rv64?

If it doesn't, add comments above to note where rv64 would exit before getting 
here.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:392
+
+  if (sizeof(uint32_t) >= byte_size) {
+// Read a0 to get the arg

I'm not sure, but perhaps `switch (byte_size)` removing one level of if/else 
would make this whole thing more clear.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:408
+  return return_valobj_sp;
+} else {
+  // Create the ValueObjectSP here and return

No need for else after a return.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:462
+  case ArchSpec::eRISCV_float_abi_soft:
+return_valobj_sp = GetValObjFromIntRegs(thread, reg_ctx, machine,
+type_flags, byte_size);

return GetValObjFromIntRegs(thread, reg_ctx, machine, type_flags, 
byte_size);



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:467
+  case ArchSpec::eRISCV_float_abi_single:
+if (4 >= byte_size)
+  use_fp_regs = true;

In general don't use this order for comparisons, it's harder to understand as a 
reader. `byte_size <= 4` is easier.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:482
+  }
+  if (use_fp_regs){
+uint64_t raw_value;

Blank line between this and the switch above it.



Comment at: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp:492
+ 

[Lldb-commits] [PATCH] D156687: [lldb][AArch64] Add kind marker to ReadAll/WriteALLRegisterValues data

2023-08-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

> I don't know about expensive literally but I did wonder if we could rely on 
> the NativeRegisterContextLinux_arm64 buffers not being modified while the 
> expression runs. Then do what I think you mean which is just flush them all 
> to the process.
>
> I'll need to work out exactly when SaveAll/WriteAll is and can be called. 
> Part of me wonders why we even have such methods if you could just flush the 
> existing buffers, but it wouldn't be the first time we've duplicated things.

I guess it looks like a lucrative solution but process/registers state between 
two consecutive stops can not be determined hence we are stuck with old 
fashioned way of save/restore.

> At minimum the SVE registers and the ZA header and tpidr2. So ~ (45*16) + 16 
> + 16 + 8. If ZA is on then you've got another 16*16 on top of that.
>
> But to be clear, the amount of data is not the issue this change aims to 
> address, it's purely the ordering of the restoration.

Agreed, I am just curious if we can save some cycles by avoiding copying first 
from source to cache and then writing to registers. Specially when we are going 
to invalidate the cache anyway after the write.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156687/new/

https://reviews.llvm.org/D156687

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


[Lldb-commits] [lldb] f2f5d6f - [lldb] Fix test failures introduced by 8e0a087571a3

2023-08-29 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-08-29T16:52:30+01:00
New Revision: f2f5d6fb8d53bc4bd93a3d4e110134ed017b636f

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

LOG: [lldb] Fix test failures introduced by 8e0a087571a3

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/bindings/interface/SBValueExtensions.i

Removed: 




diff  --git a/lldb/bindings/interface/SBValueExtensions.i 
b/lldb/bindings/interface/SBValueExtensions.i
index 22ac6a177b1547..2676a5c38a3d77 100644
--- a/lldb/bindings/interface/SBValueExtensions.i
+++ b/lldb/bindings/interface/SBValueExtensions.i
@@ -37,9 +37,6 @@ STRING_EXTENSION_OUTSIDE(SBValue)
 children.append(accessor[idx])
 return children
 
-def __eq__(self, other):
-return not self.__ne__(other)
-
 def __int__(self):
 pass
 



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


[Lldb-commits] [lldb] 8e0a087 - [lldb] Fix build failures introduced in f0731d5b61ba (NFCI)

2023-08-29 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-08-29T16:34:56+01:00
New Revision: 8e0a087571a31057bb98939e3ada73227bed83c7

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

LOG: [lldb] Fix build failures introduced in f0731d5b61ba (NFCI)

This patch should fix the build failures introduced by f0731d5b61ba.

This removes the use of the `STRING_EXTENSION_OUTSIDE` swig macro in SB
classes that don't implement a `GetDescription` method.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/bindings/interface/SBAttachInfoExtensions.i
lldb/bindings/interface/SBBreakpointListExtensions.i
lldb/bindings/interface/SBBroadcastExtensions.i
lldb/bindings/interface/SBCommandInterpreterExtensions.i
lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i
lldb/bindings/interface/SBCommunicationExtensions.i
lldb/bindings/interface/SBEnvironmentExtensions.i
lldb/bindings/interface/SBExpressionOptionsExtensions.i
lldb/bindings/interface/SBHostOSExtensions.i
lldb/bindings/interface/SBLanguageRuntimeExtensions.i
lldb/bindings/interface/SBLaunchInfoExtensions.i
lldb/bindings/interface/SBListenerExtensions.i
lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i
lldb/bindings/interface/SBPlatformConnectOptionsExtensions.i
lldb/bindings/interface/SBPlatformExtensions.i
lldb/bindings/interface/SBPlatformShellCommandExtensions.i
lldb/bindings/interface/SBProcessInfoExtensions.i
lldb/bindings/interface/SBQueueExtensions.i
lldb/bindings/interface/SBQueueItemExtensions.i
lldb/bindings/interface/SBReproducerExtensions.i
lldb/bindings/interface/SBScriptObjectExtensions.i
lldb/bindings/interface/SBSourceManagerExtensions.i
lldb/bindings/interface/SBThreadCollectionExtensions.i
lldb/bindings/interface/SBTraceCursorExtensions.i
lldb/bindings/interface/SBTraceExtensions.i
lldb/bindings/interface/SBTypeSummaryOptionsExtensions.i
lldb/bindings/interface/SBVariablesOptionsExtensions.i

Removed: 




diff  --git a/lldb/bindings/interface/SBAttachInfoExtensions.i 
b/lldb/bindings/interface/SBAttachInfoExtensions.i
index 570c79e11e00cc..3057a038a91ebe 100644
--- a/lldb/bindings/interface/SBAttachInfoExtensions.i
+++ b/lldb/bindings/interface/SBAttachInfoExtensions.i
@@ -1,5 +1,3 @@
-STRING_EXTENSION_OUTSIDE(SBAttachInfo)
-
 %extend lldb::SBAttachInfo {
 #ifdef SWIGPYTHON
 // operator== is a free function, which swig does not handle, so we inject

diff  --git a/lldb/bindings/interface/SBBreakpointListExtensions.i 
b/lldb/bindings/interface/SBBreakpointListExtensions.i
index e376b07ba5fe9c..7036df002fd5d0 100644
--- a/lldb/bindings/interface/SBBreakpointListExtensions.i
+++ b/lldb/bindings/interface/SBBreakpointListExtensions.i
@@ -1,5 +1,3 @@
-STRING_EXTENSION_OUTSIDE(SBBreakpointList)
-
 %extend lldb::SBBreakpointList {
 #ifdef SWIGPYTHON
 // operator== is a free function, which swig does not handle, so we inject

diff  --git a/lldb/bindings/interface/SBBroadcastExtensions.i 
b/lldb/bindings/interface/SBBroadcastExtensions.i
index 6bcb84598fb46c..8baac6fc31bd16 100644
--- a/lldb/bindings/interface/SBBroadcastExtensions.i
+++ b/lldb/bindings/interface/SBBroadcastExtensions.i
@@ -1,5 +1,3 @@
-STRING_EXTENSION_OUTSIDE(SBBroadcaster)
-
 %extend lldb::SBBroadcaster {
 #ifdef SWIGPYTHON
 // operator== is a free function, which swig does not handle, so we inject

diff  --git a/lldb/bindings/interface/SBCommandInterpreterExtensions.i 
b/lldb/bindings/interface/SBCommandInterpreterExtensions.i
index 91d5b7bfefbd32..36d9c107d993ab 100644
--- a/lldb/bindings/interface/SBCommandInterpreterExtensions.i
+++ b/lldb/bindings/interface/SBCommandInterpreterExtensions.i
@@ -1,5 +1,3 @@
-STRING_EXTENSION_OUTSIDE(SBCommandInterpreter)
-
 %extend lldb::SBCommandInterpreter {
 #ifdef SWIGPYTHON
 // operator== is a free function, which swig does not handle, so we inject

diff  --git 
a/lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i 
b/lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i
index 358b2ba500c19b..8535e2ed4df327 100644
--- a/lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i
+++ b/lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i
@@ -1,5 +1,3 @@
-STRING_EXTENSION_OUTSIDE(SBCommandInterpreterRunOptions)
-
 %extend lldb::SBCommandInterpreterRunOptions {
 #ifdef SWIGPYTHON
 // operator== is a free function, which swig does not handle, so we inject

diff  --git a/lldb/bindings/interface/SBCommunicationExtensions.i 
b/lldb/bindings/interface/SBCommunicationExtensions.i
index 0e94f7f3e6407a..fbe80d33b736da 100644
--- a/lldb/bindings/interface/SBCommunicationExtensions.i
+++ b/lldb/bindings/interface/SBCommunicationExtensions.i
@@ -1,5 

[Lldb-commits] [PATCH] D158958: [LLDB][REPL] Change the default tab size

2023-08-29 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

> @aprantl, how should I proceed with the swift branch? Should I create a new 
> branch in https://github.com/apple/swift and share it here so it's available 
> for whoever does the merge?

Actually, I can just cherry-pick it myself, let's not worry about this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158958/new/

https://reviews.llvm.org/D158958

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


[Lldb-commits] [PATCH] D159031: [LLDB] Fix IOHandlerEditline::GetCurrentLines()

2023-08-29 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Is this covered by any tests?




Comment at: lldb/source/Core/IOHandler.cpp:512
+StringList IOHandlerEditline::GetCurrentLines() const {
+#if LLDB_ENABLE_LIBEDIT
+  if (m_editline_up)

I think this would benefit from a comment explaining the difference?



Comment at: lldb/source/Expression/REPL.cpp:535
+  if (current_line_idx < current_lines.GetSize()) {
+for (uint32_t i = 0; i < current_line_idx; ++i) {
+  const char *line_cstr = current_lines.GetStringAtIndex(i);

`for (const char *line_cstr : current_lines)` ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159031/new/

https://reviews.llvm.org/D159031

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


[Lldb-commits] [PATCH] D159017: [lldb/docs] Silence warnings when generating website

2023-08-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf0731d5b61ba: Re-land [lldb/docs] Silence warnings 
when generating website (authored by mib).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159017/new/

https://reviews.llvm.org/D159017

Files:
  lldb/bindings/interface/SBAddressExtensions.i
  lldb/bindings/interface/SBAttachInfoExtensions.i
  lldb/bindings/interface/SBBlockExtensions.i
  lldb/bindings/interface/SBBreakpointExtensions.i
  lldb/bindings/interface/SBBreakpointListExtensions.i
  lldb/bindings/interface/SBBreakpointLocationExtensions.i
  lldb/bindings/interface/SBBreakpointNameExtensions.i
  lldb/bindings/interface/SBBroadcastExtensions.i
  lldb/bindings/interface/SBCommandInterpreterExtensions.i
  lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i
  lldb/bindings/interface/SBCommandReturnObjectExtensions.i
  lldb/bindings/interface/SBCommunicationExtensions.i
  lldb/bindings/interface/SBCompileUnitExtensions.i
  lldb/bindings/interface/SBDataExtensions.i
  lldb/bindings/interface/SBDebuggerExtensions.i
  lldb/bindings/interface/SBDeclarationExtensions.i
  lldb/bindings/interface/SBEnvironmentExtensions.i
  lldb/bindings/interface/SBErrorExtensions.i
  lldb/bindings/interface/SBEventExtensions.i
  lldb/bindings/interface/SBExecutionContextExtensions.i
  lldb/bindings/interface/SBExpressionOptionsExtensions.i
  lldb/bindings/interface/SBFileExtensions.i
  lldb/bindings/interface/SBFileSpecExtensions.i
  lldb/bindings/interface/SBFileSpecListExtensions.i
  lldb/bindings/interface/SBFrameExtensions.i
  lldb/bindings/interface/SBFunctionExtensions.i
  lldb/bindings/interface/SBHostOSExtensions.i
  lldb/bindings/interface/SBInstructionExtensions.i
  lldb/bindings/interface/SBInstructionListExtensions.i
  lldb/bindings/interface/SBLanguageRuntimeExtensions.i
  lldb/bindings/interface/SBLaunchInfoExtensions.i
  lldb/bindings/interface/SBLineEntryExtensions.i
  lldb/bindings/interface/SBListenerExtensions.i
  lldb/bindings/interface/SBMemoryRegionInfoExtensions.i
  lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i
  lldb/bindings/interface/SBModuleExtensions.i
  lldb/bindings/interface/SBModuleSpecExtensions.i
  lldb/bindings/interface/SBModuleSpecListExtensions.i
  lldb/bindings/interface/SBPlatformConnectOptionsExtensions.i
  lldb/bindings/interface/SBPlatformExtensions.i
  lldb/bindings/interface/SBPlatformShellCommandExtensions.i
  lldb/bindings/interface/SBProcessDocstrings.i
  lldb/bindings/interface/SBProcessExtensions.i
  lldb/bindings/interface/SBProcessInfoExtensions.i
  lldb/bindings/interface/SBQueueExtensions.i
  lldb/bindings/interface/SBQueueItemExtensions.i
  lldb/bindings/interface/SBReproducerExtensions.i
  lldb/bindings/interface/SBScriptObjectExtensions.i
  lldb/bindings/interface/SBSectionExtensions.i
  lldb/bindings/interface/SBSourceManagerExtensions.i
  lldb/bindings/interface/SBStreamExtensions.i
  lldb/bindings/interface/SBStringListExtensions.i
  lldb/bindings/interface/SBStructuredDataExtensions.i
  lldb/bindings/interface/SBSymbolContextExtensions.i
  lldb/bindings/interface/SBSymbolContextListExtensions.i
  lldb/bindings/interface/SBSymbolExtensions.i
  lldb/bindings/interface/SBTargetExtensions.i
  lldb/bindings/interface/SBThreadCollectionExtensions.i
  lldb/bindings/interface/SBThreadExtensions.i
  lldb/bindings/interface/SBThreadPlanExtensions.i
  lldb/bindings/interface/SBTraceCursorExtensions.i
  lldb/bindings/interface/SBTraceExtensions.i
  lldb/bindings/interface/SBTypeCategoryExtensions.i
  lldb/bindings/interface/SBTypeEnumMemberExtensions.i
  lldb/bindings/interface/SBTypeExtensions.i
  lldb/bindings/interface/SBTypeFilterExtensions.i
  lldb/bindings/interface/SBTypeFormatExtensions.i
  lldb/bindings/interface/SBTypeNameSpecifierExtensions.i
  lldb/bindings/interface/SBTypeSummaryExtensions.i
  lldb/bindings/interface/SBTypeSummaryOptionsExtensions.i
  lldb/bindings/interface/SBTypeSyntheticExtensions.i
  lldb/bindings/interface/SBUnixSignalsExtensions.i
  lldb/bindings/interface/SBValueExtensions.i
  lldb/bindings/interface/SBValueListExtensions.i
  lldb/bindings/interface/SBVariablesOptionsExtensions.i
  lldb/bindings/interface/SBWatchpointExtensions.i
  lldb/bindings/interfaces.swig
  lldb/bindings/python/python-extensions.swig
  lldb/bindings/python/python.swig
  lldb/docs/conf.py
  lldb/docs/python_api.rst

Index: lldb/docs/python_api.rst
===
--- lldb/docs/python_api.rst
+++ lldb/docs/python_api.rst
@@ -5,94 +5,10 @@
   The long list of "skip" filters out several global functions that are
   generated by SWIG (but which are not useful as they are only the
   backend for their respective static functions in the classes).
-  Without this list
 .. automodapi:: lldb
   :no-inheritance-diagram:
-  :skip: SBBreakpoint_EventIsBreakpointEvent
-  :skip: 

[Lldb-commits] [lldb] f0731d5 - Re-land "[lldb/docs] Silence warnings when generating website"

2023-08-29 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-08-29T16:24:33+01:00
New Revision: f0731d5b61ba798e6d5a63a92d9228010e5a3b50

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

LOG: Re-land "[lldb/docs] Silence warnings when generating website"

This reverts commit 18f1c1ace7a6099f3e8e56cf4b81aa0f64a7dd23 and fix the
build failure issues introduced because of the `STRING_EXTENSION_OUTSIDE`
swig macros.

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

Signed-off-by: Med Ismail Bennani 

Added: 
lldb/bindings/interface/SBAttachInfoExtensions.i
lldb/bindings/interface/SBBreakpointListExtensions.i
lldb/bindings/interface/SBBroadcastExtensions.i
lldb/bindings/interface/SBCommandInterpreterExtensions.i
lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i
lldb/bindings/interface/SBCommunicationExtensions.i
lldb/bindings/interface/SBEnvironmentExtensions.i
lldb/bindings/interface/SBEventExtensions.i
lldb/bindings/interface/SBExpressionOptionsExtensions.i
lldb/bindings/interface/SBFileSpecListExtensions.i
lldb/bindings/interface/SBHostOSExtensions.i
lldb/bindings/interface/SBLanguageRuntimeExtensions.i
lldb/bindings/interface/SBLaunchInfoExtensions.i
lldb/bindings/interface/SBListenerExtensions.i
lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i
lldb/bindings/interface/SBModuleSpecListExtensions.i
lldb/bindings/interface/SBPlatformConnectOptionsExtensions.i
lldb/bindings/interface/SBPlatformExtensions.i
lldb/bindings/interface/SBPlatformShellCommandExtensions.i
lldb/bindings/interface/SBProcessInfoExtensions.i
lldb/bindings/interface/SBQueueExtensions.i
lldb/bindings/interface/SBQueueItemExtensions.i
lldb/bindings/interface/SBReproducerExtensions.i
lldb/bindings/interface/SBSourceManagerExtensions.i
lldb/bindings/interface/SBStructuredDataExtensions.i
lldb/bindings/interface/SBThreadCollectionExtensions.i
lldb/bindings/interface/SBThreadPlanExtensions.i
lldb/bindings/interface/SBTraceCursorExtensions.i
lldb/bindings/interface/SBTraceExtensions.i
lldb/bindings/interface/SBTypeSummaryOptionsExtensions.i
lldb/bindings/interface/SBVariablesOptionsExtensions.i

Modified: 
lldb/bindings/interface/SBAddressExtensions.i
lldb/bindings/interface/SBBlockExtensions.i
lldb/bindings/interface/SBBreakpointExtensions.i
lldb/bindings/interface/SBBreakpointLocationExtensions.i
lldb/bindings/interface/SBBreakpointNameExtensions.i
lldb/bindings/interface/SBCommandReturnObjectExtensions.i
lldb/bindings/interface/SBCompileUnitExtensions.i
lldb/bindings/interface/SBDataExtensions.i
lldb/bindings/interface/SBDebuggerExtensions.i
lldb/bindings/interface/SBDeclarationExtensions.i
lldb/bindings/interface/SBErrorExtensions.i
lldb/bindings/interface/SBExecutionContextExtensions.i
lldb/bindings/interface/SBFileExtensions.i
lldb/bindings/interface/SBFileSpecExtensions.i
lldb/bindings/interface/SBFrameExtensions.i
lldb/bindings/interface/SBFunctionExtensions.i
lldb/bindings/interface/SBInstructionExtensions.i
lldb/bindings/interface/SBInstructionListExtensions.i
lldb/bindings/interface/SBLineEntryExtensions.i
lldb/bindings/interface/SBMemoryRegionInfoExtensions.i
lldb/bindings/interface/SBModuleExtensions.i
lldb/bindings/interface/SBModuleSpecExtensions.i
lldb/bindings/interface/SBProcessDocstrings.i
lldb/bindings/interface/SBProcessExtensions.i
lldb/bindings/interface/SBScriptObjectExtensions.i
lldb/bindings/interface/SBSectionExtensions.i
lldb/bindings/interface/SBStreamExtensions.i
lldb/bindings/interface/SBStringListExtensions.i
lldb/bindings/interface/SBSymbolContextExtensions.i
lldb/bindings/interface/SBSymbolContextListExtensions.i
lldb/bindings/interface/SBSymbolExtensions.i
lldb/bindings/interface/SBTargetExtensions.i
lldb/bindings/interface/SBThreadExtensions.i
lldb/bindings/interface/SBTypeCategoryExtensions.i
lldb/bindings/interface/SBTypeEnumMemberExtensions.i
lldb/bindings/interface/SBTypeExtensions.i
lldb/bindings/interface/SBTypeFilterExtensions.i
lldb/bindings/interface/SBTypeFormatExtensions.i
lldb/bindings/interface/SBTypeNameSpecifierExtensions.i
lldb/bindings/interface/SBTypeSummaryExtensions.i
lldb/bindings/interface/SBTypeSyntheticExtensions.i
lldb/bindings/interface/SBUnixSignalsExtensions.i
lldb/bindings/interface/SBValueExtensions.i
lldb/bindings/interface/SBValueListExtensions.i
lldb/bindings/interface/SBWatchpointExtensions.i
lldb/bindings/interfaces.swig
lldb/bindings/python/python-extensions.swig
lldb/bindings/python/python.swig
lldb/docs/conf.py
lldb/docs/python_api.rst

Removed: 




[Lldb-commits] [PATCH] D156687: [lldb][AArch64] Add kind marker to ReadAll/WriteALLRegisterValues data

2023-08-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

> Is there a way we can optimise this may be write register directly from 
> source buffer.

Though now I wonder if when you say source here you mean the member buffers in 
the register context, or literally the `src` pointer we use in the code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156687/new/

https://reviews.llvm.org/D156687

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


[Lldb-commits] [PATCH] D156687: [lldb][AArch64] Add kind marker to ReadAll/WriteALLRegisterValues data

2023-08-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

> I have a feeling that expressions are becoming an expensive operation with 
> amount of data we need to move back and forth between various buffers. Is 
> there a way we can optimise this may be write register directly from source 
> buffer.

I don't know about expensive literally but I did wonder if we could rely on the 
NativeRegisterContextLinux_arm64 buffers not being modified while the 
expression runs. Then do what I think you mean which is just flush them all to 
the process.

I'll need to work out exactly when SaveAll/WriteAll is and can be called. Part 
of me wonders why we even have such methods if you could just flush the 
existing buffers, but it wouldn't be the first time we've duplicated things.

> Also how much minimum data we need to move when SME is enabled?

At minimum the SVE registers and the ZA header and tpidr2. So ~ (45*16) + 16 + 
16 + 8. If ZA is on then you've got another 16*16 on top of that.

But to be clear, the amount of data is not the issue this change aims to 
address, it's purely the ordering of the restoration.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156687/new/

https://reviews.llvm.org/D156687

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


[Lldb-commits] [PATCH] D156687: [lldb][AArch64] Add kind marker to ReadAll/WriteALLRegisterValues data

2023-08-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

I have a feeling that expressions are becoming an expensive operation with 
amount of data we need to move back and forth between various buffers. Is there 
a way we can optimise this may be write register directly from source buffer. 
Also how much minimum data we need to move when SME is enabled?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156687/new/

https://reviews.llvm.org/D156687

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


[Lldb-commits] [PATCH] D159101: [RISC-V] Add RISC-V ABI plugin

2023-08-29 Thread Ted Woodward via Phabricator via lldb-commits
ted created this revision.
Herald added subscribers: luke, sunshaoce, VincentWu, vkmr, frasercrmck, 
luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, 
brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, 
kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson.
Herald added a project: All.
ted requested review of this revision.
Herald added subscribers: lldb-commits, wangpc, MaskRay.
Herald added a project: LLDB.

Also default to disassembling a and m features
Some code taken from https://reviews.llvm.org/D62732 , which hasn't been
updated in a year.

Tested with 32 and 64 bit Linux user space QEMU


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159101

Files:
  lldb/source/Plugins/ABI/CMakeLists.txt
  lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
  lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
  lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
===
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -1550,6 +1550,8 @@
 ArchSpec::eRISCV_float_abi_quad)
   features_str += "+f,+d,+q,";
 // FIXME: how do we detect features such as `+a`, `+m`?
+// Turn them on by default now, since everyone seems to use them
+features_str += "+a,+m,";
   }
 
   // We use m_disasm_up.get() to tell whether we are valid or not, so if this
Index: lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
===
--- /dev/null
+++ lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_lldb_library(lldbPluginABIRISCV PLUGIN
+  ABISysV_riscv.cpp
+
+  LINK_LIBS
+lldbCore
+lldbSymbol
+lldbTarget
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
+TargetParser
+  )
Index: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
===
--- /dev/null
+++ lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -0,0 +1,127 @@
+//===-- ABISysV_riscv.h ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_ABISysV_riscv_h_
+#define liblldb_ABISysV_riscv_h_
+
+// Other libraries and framework includes
+#include 
+
+#include "llvm/TargetParser/Triple.h"
+
+// Project includes
+#include "lldb/Target/ABI.h"
+#include "lldb/Target/Process.h"
+#include "lldb/lldb-private.h"
+
+class ABISysV_riscv : public lldb_private::RegInfoBasedABI {
+public:
+  ~ABISysV_riscv() override = default;
+
+  size_t GetRedZoneSize() const override { return 0; }
+
+  bool PrepareTrivialCall(lldb_private::Thread , lldb::addr_t sp,
+  lldb::addr_t functionAddress,
+  lldb::addr_t returnAddress,
+  llvm::ArrayRef args) const override;
+
+  // Special thread plan for GDB style non-jit function calls.
+  bool
+  PrepareTrivialCall(lldb_private::Thread , lldb::addr_t sp,
+ lldb::addr_t functionAddress, lldb::addr_t returnAddress,
+ llvm::Type ,
+ llvm::ArrayRef args) const override;
+
+  bool GetArgumentValues(lldb_private::Thread ,
+ lldb_private::ValueList ) const override;
+
+  lldb_private::Status
+  SetReturnValueObject(lldb::StackFrameSP _sp,
+   lldb::ValueObjectSP _value) override;
+
+  lldb::ValueObjectSP
+  GetReturnValueObjectImpl(lldb_private::Thread ,
+   lldb_private::CompilerType ) const override;
+
+  // Specialized to work with llvm IR types.
+  lldb::ValueObjectSP GetReturnValueObjectImpl(lldb_private::Thread ,
+   llvm::Type ) const override;
+
+  bool
+  CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan _plan) override;
+
+  bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan _plan) override;
+
+  bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
+
+  bool CallFrameAddressIsValid(lldb::addr_t cfa) override {
+// The CFA must be 128 bit aligned, unless the E ABI is used
+lldb_private::ArchSpec arch = GetProcessSP()->GetTarget().GetArchitecture();
+uint32_t arch_flags = arch.GetFlags();
+if (arch_flags & lldb_private::ArchSpec::eRISCV_rve)
+  return (cfa & 0x3ull) == 0;
+return (cfa & 0xfull) == 0;
+  }
+
+  bool CodeAddressIsValid(lldb::addr_t pc) override {
+// Calls can use the least significant bit to store auxiliary information,
+

[Lldb-commits] [PATCH] D158863: Implement the monolithic CI pipeline in the monorepo

2023-08-29 Thread Louis Dionne via Phabricator via lldb-commits
ldionne marked an inline comment as done.
ldionne added inline comments.



Comment at: .ci/generate-buildkite-pipeline-premerge:163
+
+if [[ ! ${SPECIFIC_PIPELINE_AVAILABLE} -eq 1 ]]; then
+  # Figure out which projects need to be built on each platform

goncharov wrote:
> ldionne wrote:
> > goncharov wrote:
> > > do I understand correctly that if mlir and libcxx modified then only 
> > > libcxx will be run as SPECIFIC_PIPELINE_AVAILABLE=1?
> > Yes. This corresponds to the current logic as well. Basically if a project 
> > has some custom CI set up, we don't want to also run the general CI since 
> > that's just a waste of resources.
> The previous logic was that we caclulated first all projects that might be 
> affected by current set (e.g. mlir is affected by llvm), then we added add 
> dependencies.
> So e.g. if mlir was modified, we should add "flang" to test set and then add 
> "llvm clang" as dependincies, resutling in "mlir flang llvm clang" set. I can 
> re-implement this logic later here no problem.
> Also, it seems incorrect to only run "libc++" tests if libc++ was modified 
> among other things. E.g. if something has touched libc++ and mlir than mlir 
> should still run.
Ah, I see. Yeah I guess that makes sense. I'll update this review with the 
updated logic.

> Also, it seems incorrect to only run "libc++" tests if libc++ was modified 
> among other things. E.g. if something has touched libc++ and mlir than mlir 
> should still run.

You're right, I guess in that case we should run both jobs. I'll remove the 
check.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158863/new/

https://reviews.llvm.org/D158863

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


[Lldb-commits] [PATCH] D159076: [lldb] Add DynamicLoader for FreeBSD Kernel post-mortem debug facility

2023-08-29 Thread Ed Maste via Phabricator via lldb-commits
emaste added inline comments.



Comment at: 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp:115-116
+// TODO: If we need to check unknow OS triple like armv7-unknown-unknown?
+// TODO: I don't know if kFreeBSD is a type of FreeBSD and should we accept
+// this Triple? Check the type of kernel
+if (!triple_ref.isOSFreeBSD()) {

kFreeBSD indicates a FreeBSD kernel, typically with some other userland (e.g. 
Debian GNU/kFreeBSD is Debian's standard userland, with FreeBSD instead of 
Linux as the kernel). But these projects are mostly not active anymore and I'm 
not sure how we'd test.



Comment at: 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp:183
+  if (header.getDataEncoding() == llvm::ELF::ELFDATA2MSB) {
+// TODO: swap byte order for big endian
+  }

Add `return false;` for now as well?



Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:943
+  if (header.sh_flags & SHF_ALLOC)
+   return Address(GetSectionList()->FindSectionByID(SectionIndex(I)), 0);
+}

The indentation looks wrong on a few lines here, 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159076/new/

https://reviews.llvm.org/D159076

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


[Lldb-commits] [lldb] 18f1c1a - Revert "[lldb/docs] Silence warnings when generating website"

2023-08-29 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-08-29T13:57:35+01:00
New Revision: 18f1c1ace7a6099f3e8e56cf4b81aa0f64a7dd23

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

LOG: Revert "[lldb/docs] Silence warnings when generating website"

This reverts commit 498b59e01133bed16c72dd939a9daa8ae1f359e4 since it
introduces a build failure:

https://lab.llvm.org/buildbot/#/builders/68/builds/58995

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/bindings/interface/SBAddressExtensions.i
lldb/bindings/interface/SBBlockExtensions.i
lldb/bindings/interface/SBBreakpointExtensions.i
lldb/bindings/interface/SBBreakpointLocationExtensions.i
lldb/bindings/interface/SBBreakpointNameExtensions.i
lldb/bindings/interface/SBCommandReturnObjectExtensions.i
lldb/bindings/interface/SBCompileUnitExtensions.i
lldb/bindings/interface/SBDataExtensions.i
lldb/bindings/interface/SBDebuggerExtensions.i
lldb/bindings/interface/SBDeclarationExtensions.i
lldb/bindings/interface/SBErrorExtensions.i
lldb/bindings/interface/SBExecutionContextExtensions.i
lldb/bindings/interface/SBFileExtensions.i
lldb/bindings/interface/SBFileSpecExtensions.i
lldb/bindings/interface/SBFrameExtensions.i
lldb/bindings/interface/SBFunctionExtensions.i
lldb/bindings/interface/SBInstructionExtensions.i
lldb/bindings/interface/SBInstructionListExtensions.i
lldb/bindings/interface/SBLineEntryExtensions.i
lldb/bindings/interface/SBMemoryRegionInfoExtensions.i
lldb/bindings/interface/SBModuleExtensions.i
lldb/bindings/interface/SBModuleSpecExtensions.i
lldb/bindings/interface/SBProcessDocstrings.i
lldb/bindings/interface/SBProcessExtensions.i
lldb/bindings/interface/SBScriptObjectExtensions.i
lldb/bindings/interface/SBSectionExtensions.i
lldb/bindings/interface/SBStreamExtensions.i
lldb/bindings/interface/SBStringListExtensions.i
lldb/bindings/interface/SBSymbolContextExtensions.i
lldb/bindings/interface/SBSymbolContextListExtensions.i
lldb/bindings/interface/SBSymbolExtensions.i
lldb/bindings/interface/SBTargetExtensions.i
lldb/bindings/interface/SBThreadExtensions.i
lldb/bindings/interface/SBTypeCategoryExtensions.i
lldb/bindings/interface/SBTypeEnumMemberExtensions.i
lldb/bindings/interface/SBTypeExtensions.i
lldb/bindings/interface/SBTypeFilterExtensions.i
lldb/bindings/interface/SBTypeFormatExtensions.i
lldb/bindings/interface/SBTypeNameSpecifierExtensions.i
lldb/bindings/interface/SBTypeSummaryExtensions.i
lldb/bindings/interface/SBTypeSyntheticExtensions.i
lldb/bindings/interface/SBUnixSignalsExtensions.i
lldb/bindings/interface/SBValueExtensions.i
lldb/bindings/interface/SBValueListExtensions.i
lldb/bindings/interface/SBWatchpointExtensions.i
lldb/bindings/interfaces.swig
lldb/bindings/python/python-extensions.swig
lldb/bindings/python/python.swig
lldb/docs/conf.py
lldb/docs/python_api.rst

Removed: 
lldb/bindings/interface/SBAttachInfoExtensions.i
lldb/bindings/interface/SBBreakpointListExtensions.i
lldb/bindings/interface/SBBroadcastExtensions.i
lldb/bindings/interface/SBCommandInterpreterExtensions.i
lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i
lldb/bindings/interface/SBCommunicationExtensions.i
lldb/bindings/interface/SBEnvironmentExtensions.i
lldb/bindings/interface/SBEventExtensions.i
lldb/bindings/interface/SBExpressionOptionsExtensions.i
lldb/bindings/interface/SBFileSpecListExtensions.i
lldb/bindings/interface/SBHostOSExtensions.i
lldb/bindings/interface/SBLanguageRuntimeExtensions.i
lldb/bindings/interface/SBLaunchInfoExtensions.i
lldb/bindings/interface/SBListenerExtensions.i
lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i
lldb/bindings/interface/SBModuleSpecListExtensions.i
lldb/bindings/interface/SBPlatformConnectOptionsExtensions.i
lldb/bindings/interface/SBPlatformExtensions.i
lldb/bindings/interface/SBPlatformShellCommandExtensions.i
lldb/bindings/interface/SBProcessInfoExtensions.i
lldb/bindings/interface/SBQueueExtensions.i
lldb/bindings/interface/SBQueueItemExtensions.i
lldb/bindings/interface/SBReproducerExtensions.i
lldb/bindings/interface/SBSourceManagerExtensions.i
lldb/bindings/interface/SBStructuredDataExtensions.i
lldb/bindings/interface/SBThreadCollectionExtensions.i
lldb/bindings/interface/SBThreadPlanExtensions.i
lldb/bindings/interface/SBTraceCursorExtensions.i
lldb/bindings/interface/SBTraceExtensions.i
lldb/bindings/interface/SBTypeSummaryOptionsExtensions.i
lldb/bindings/interface/SBVariablesOptionsExtensions.i



diff  --git 

[Lldb-commits] [lldb] 498b59e - [lldb/docs] Silence warnings when generating website

2023-08-29 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-08-29T13:45:30+01:00
New Revision: 498b59e01133bed16c72dd939a9daa8ae1f359e4

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

LOG: [lldb/docs] Silence warnings when generating website

This patch does various things to silence the warnings that show up when
generating the website documentation.

First, this patch adds the missing definition for special member methods
in every SBAPI class. If the class cannot implement one of the special
member method, we just define it as a null operation (pass).

This should fix the following warnings:

```
WARNING: missing attribute __int__ in object lldb.SB*
WARNING: missing attribute __len__ in object lldb.SB*
WARNING: missing attribute __hex__ in object lldb.SB*
WARNING: missing attribute __oct__ in object lldb.SB*
WARNING: missing attribute __iter__ in object lldb.SB*
```

Then, it un-skips the various `static` methods that we didn't generate
the methods for, since it's not necessary thanks to the automod-api module.

Finally, this comments out the `_static` directory in the sphinx config,
since we don't need it anymore.

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

Signed-off-by: Med Ismail Bennani 

Added: 
lldb/bindings/interface/SBAttachInfoExtensions.i
lldb/bindings/interface/SBBreakpointListExtensions.i
lldb/bindings/interface/SBBroadcastExtensions.i
lldb/bindings/interface/SBCommandInterpreterExtensions.i
lldb/bindings/interface/SBCommandInterpreterRunOptionsExtensions.i
lldb/bindings/interface/SBCommunicationExtensions.i
lldb/bindings/interface/SBEnvironmentExtensions.i
lldb/bindings/interface/SBEventExtensions.i
lldb/bindings/interface/SBExpressionOptionsExtensions.i
lldb/bindings/interface/SBFileSpecListExtensions.i
lldb/bindings/interface/SBHostOSExtensions.i
lldb/bindings/interface/SBLanguageRuntimeExtensions.i
lldb/bindings/interface/SBLaunchInfoExtensions.i
lldb/bindings/interface/SBListenerExtensions.i
lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i
lldb/bindings/interface/SBModuleSpecListExtensions.i
lldb/bindings/interface/SBPlatformConnectOptionsExtensions.i
lldb/bindings/interface/SBPlatformExtensions.i
lldb/bindings/interface/SBPlatformShellCommandExtensions.i
lldb/bindings/interface/SBProcessInfoExtensions.i
lldb/bindings/interface/SBQueueExtensions.i
lldb/bindings/interface/SBQueueItemExtensions.i
lldb/bindings/interface/SBReproducerExtensions.i
lldb/bindings/interface/SBSourceManagerExtensions.i
lldb/bindings/interface/SBStructuredDataExtensions.i
lldb/bindings/interface/SBThreadCollectionExtensions.i
lldb/bindings/interface/SBThreadPlanExtensions.i
lldb/bindings/interface/SBTraceCursorExtensions.i
lldb/bindings/interface/SBTraceExtensions.i
lldb/bindings/interface/SBTypeSummaryOptionsExtensions.i
lldb/bindings/interface/SBVariablesOptionsExtensions.i

Modified: 
lldb/bindings/interface/SBAddressExtensions.i
lldb/bindings/interface/SBBlockExtensions.i
lldb/bindings/interface/SBBreakpointExtensions.i
lldb/bindings/interface/SBBreakpointLocationExtensions.i
lldb/bindings/interface/SBBreakpointNameExtensions.i
lldb/bindings/interface/SBCommandReturnObjectExtensions.i
lldb/bindings/interface/SBCompileUnitExtensions.i
lldb/bindings/interface/SBDataExtensions.i
lldb/bindings/interface/SBDebuggerExtensions.i
lldb/bindings/interface/SBDeclarationExtensions.i
lldb/bindings/interface/SBErrorExtensions.i
lldb/bindings/interface/SBExecutionContextExtensions.i
lldb/bindings/interface/SBFileExtensions.i
lldb/bindings/interface/SBFileSpecExtensions.i
lldb/bindings/interface/SBFrameExtensions.i
lldb/bindings/interface/SBFunctionExtensions.i
lldb/bindings/interface/SBInstructionExtensions.i
lldb/bindings/interface/SBInstructionListExtensions.i
lldb/bindings/interface/SBLineEntryExtensions.i
lldb/bindings/interface/SBMemoryRegionInfoExtensions.i
lldb/bindings/interface/SBModuleExtensions.i
lldb/bindings/interface/SBModuleSpecExtensions.i
lldb/bindings/interface/SBProcessDocstrings.i
lldb/bindings/interface/SBProcessExtensions.i
lldb/bindings/interface/SBScriptObjectExtensions.i
lldb/bindings/interface/SBSectionExtensions.i
lldb/bindings/interface/SBStreamExtensions.i
lldb/bindings/interface/SBStringListExtensions.i
lldb/bindings/interface/SBSymbolContextExtensions.i
lldb/bindings/interface/SBSymbolContextListExtensions.i
lldb/bindings/interface/SBSymbolExtensions.i
lldb/bindings/interface/SBTargetExtensions.i
lldb/bindings/interface/SBThreadExtensions.i
lldb/bindings/interface/SBTypeCategoryExtensions.i
lldb/bindings/interface/SBTypeEnumMemberExtensions.i
lldb/bindings/interface/SBTypeExtensions.i
   

[Lldb-commits] [PATCH] D159017: [lldb/docs] Silence warnings when generating website

2023-08-29 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added inline comments.



Comment at: lldb/docs/conf.py:46
 autodoc_default_options = {
 "special-members": "__int__, __len__, __hex__, __oct__, __iter__",
 }

@JDevlieghere AFAIK, if we want to silence the warnings, we should disable 
generating special members (such as `__hex__`) however I think this would be a 
missed opportunity since they can make using SB classes in python more 
ergonomic, for example using `hex(SBAddress)` instead of 
`hex(SBAddress.GetLoadAddress)`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159017/new/

https://reviews.llvm.org/D159017

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


[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-08-29 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
fdeazeve added a comment.

I am slightly wary of making this a global set without any kind of thread safe 
mechanism, as I (naively, not really knowing how this class is used) would 
expect us to be able to instantiate multiple servers and have them be accessed 
concurrently. As such, it makes more sense to have each server own its set of 
strings.

Have we considered having UnixSignals be the one to extend the lifetime of 
strings? I couldn't figure out if there is any advantage to this vs the other 
suggestion.




Comment at: 
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp:48
+// from the remote, these strings need persistent storage client-side.
+static llvm::StringSet<> g_signal_string_storage;
 

Is there a strong motivation for making this a global static, instead of a 
private member of PlatformRemoteGDBServer?
My assumption here is that we only ever have one PlatformRemoteGDBServer active 
at any given time, otherwise (if concurrent servers now or in the future) the 
global approach is not thread safe.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

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


[Lldb-commits] [PATCH] D157488: [lldb][AArch64] Add testing of save/restore for Linux MTE control register

2023-08-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

This looks fine but instead of adding a new test cant we add MTE control 
register tests to already available MTE tests?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157488/new/

https://reviews.llvm.org/D157488

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


[Lldb-commits] [PATCH] D157000: [lldb][AArch64] Check SIMD save/restore in SVE SIMD test

2023-08-29 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid accepted this revision.
omjavaid added inline comments.
This revision is now accepted and ready to land.



Comment at: 
lldb/test/API/commands/register/register/aarch64_sve_simd_registers/main.c:43
 
+void write_simd_regs_expr() {
+#define WRITE_SIMD(NUM)
\

There is subtle difference between write_simd_regs and write_simd_regs_expr. 

BTW, cant we avoid another function and just do something like


```
#define WRITE_SIMD(NUM, I)  
\
  asm volatile("MOV v" #NUM ".d[0], %0\n\t" 
\
   "MOV v" #NUM ".d[1], %0\n\t" ::"r"(NUM + I))
```



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157000/new/

https://reviews.llvm.org/D157000

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


[Lldb-commits] [PATCH] D159076: [lldb] Add DynamicLoader for FreeBSD Kernel post-mortem debug facility

2023-08-29 Thread Sheng-Yi Hung via Phabricator via lldb-commits
aokblast updated this revision to Diff 554237.
aokblast added a comment.

Add subdirectory for DynamicLoader Plugin directory


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159076/new/

https://reviews.llvm.org/D159076

Files:
  lldb/source/Plugins/DynamicLoader/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
  
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
  lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp

Index: lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
===
--- lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
+++ lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
@@ -10,7 +10,7 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/DynamicLoader.h"
 
-#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
+#include "Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h"
 #include "ProcessFreeBSDKernel.h"
 #include "ThreadFreeBSDKernel.h"
 
@@ -262,7 +262,7 @@
 DynamicLoader *ProcessFreeBSDKernel::GetDynamicLoader() {
   if (m_dyld_up.get() == nullptr)
 m_dyld_up.reset(DynamicLoader::FindPlugin(
-this, DynamicLoaderStatic::GetPluginNameStatic()));
+this, DynamicLoaderFreeBSDKernel::GetPluginNameStatic()));
   return m_dyld_up.get();
 }
 
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -935,6 +935,16 @@
 }
 
 Address ObjectFileELF::GetBaseAddress() {
+  if (GetType() == ObjectFile::eTypeObjectFile) {
+for (SectionHeaderCollIter I = std::next(m_section_headers.begin());
+	 I != m_section_headers.end(); ++I) {
+  const ELFSectionHeaderInfo  = *I;
+  if (header.sh_flags & SHF_ALLOC)
+	return Address(GetSectionList()->FindSectionByID(SectionIndex(I)), 0);
+}
+return LLDB_INVALID_ADDRESS;
+  }
+
   for (const auto  : llvm::enumerate(ProgramHeaders())) {
 const ELFProgramHeader  = EnumPHdr.value();
 if (H.p_type != PT_LOAD)
@@ -1763,7 +1773,10 @@
   VMRange GetVMRange(const ELFSectionHeader ) {
 addr_t Address = H.sh_addr;
 addr_t Size = H.sh_flags & SHF_ALLOC ? H.sh_size : 0;
-if (ObjectType == ObjectFile::Type::eTypeObjectFile && Segments.empty() && (H.sh_flags & SHF_ALLOC)) {
+
+// When this is a debug file for relocatable file, the address is all zero
+if ((ObjectType == ObjectFile::Type::eTypeObjectFile ||
+	 (ObjectType == ObjectFile::Type::eTypeDebugInfo && H.sh_addr == 0)) && Segments.empty() && (H.sh_flags & SHF_ALLOC)) {
   NextVMAddress =
   llvm::alignTo(NextVMAddress, std::max(H.sh_addralign, 1));
   Address = NextVMAddress;
Index: lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
===
--- /dev/null
+++ lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
@@ -0,0 +1,165 @@
+#ifndef LLDB_SOURCE_PLUGINS_DYNAMICLOADER_FREEBSD_KERNEL_DYNAMICLOADERFREEBSDKERNEL_H
+#define LLDB_SOURCE_PLUGINS_DYNAMICLOADER_FREEBSD_KERNEL_DYNAMICLOADERFREEBSDKERNEL_H
+
+#include 
+#include 
+#include 
+
+#include "lldb/Target/DynamicLoader.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
+#include "llvm/BinaryFormat/ELF.h"
+
+class DynamicLoaderFreeBSDKernel : public lldb_private::DynamicLoader {
+public:
+  DynamicLoaderFreeBSDKernel(lldb_private::Process *process,
+ lldb::addr_t kernel_addr);
+
+  ~DynamicLoaderFreeBSDKernel() override;
+
+  // Static Functions
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static llvm::StringRef GetPluginNameStatic() {
+return "DynamicLoaderFreeBSDKernel";
+  }
+
+  static llvm::StringRef GetPluginDescriptionStatic();
+
+  static lldb_private::DynamicLoader *
+  CreateInstance(lldb_private::Process *process, bool force);
+
+  static void DebuggerInit(lldb_private::Debugger );
+
+  static lldb::addr_t FindFreeBSDKernel(lldb_private::Process *process);
+
+  // Hooks for time point that after attach to some proccess
+  void DidAttach() override;
+
+  void DidLaunch() override;
+
+  lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread ,
+  bool stop_others) override;
+
+  lldb_private::Status CanLoadImage() override;
+
+  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
+
+protected:
+  class KModImageInfo {
+  public:
+KModImageInfo()
+: m_module_sp(), m_memory_module_sp(), 

[Lldb-commits] [PATCH] D159076: [lldb] Add DynamicLoader for FreeBSD Kernel post-mortem debug facility

2023-08-29 Thread Sheng-Yi Hung via Phabricator via lldb-commits
aokblast updated this revision to Diff 554236.
aokblast added a comment.
Herald added a subscriber: MaskRay.

Add relocatable file support for kernel module


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159076/new/

https://reviews.llvm.org/D159076

Files:
  lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
  
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
  lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp

Index: lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
===
--- lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
+++ lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
@@ -10,7 +10,7 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/DynamicLoader.h"
 
-#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
+#include "Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h"
 #include "ProcessFreeBSDKernel.h"
 #include "ThreadFreeBSDKernel.h"
 
@@ -262,7 +262,7 @@
 DynamicLoader *ProcessFreeBSDKernel::GetDynamicLoader() {
   if (m_dyld_up.get() == nullptr)
 m_dyld_up.reset(DynamicLoader::FindPlugin(
-this, DynamicLoaderStatic::GetPluginNameStatic()));
+this, DynamicLoaderFreeBSDKernel::GetPluginNameStatic()));
   return m_dyld_up.get();
 }
 
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -935,6 +935,16 @@
 }
 
 Address ObjectFileELF::GetBaseAddress() {
+  if (GetType() == ObjectFile::eTypeObjectFile) {
+for (SectionHeaderCollIter I = std::next(m_section_headers.begin());
+	 I != m_section_headers.end(); ++I) {
+  const ELFSectionHeaderInfo  = *I;
+  if (header.sh_flags & SHF_ALLOC)
+	return Address(GetSectionList()->FindSectionByID(SectionIndex(I)), 0);
+}
+return LLDB_INVALID_ADDRESS;
+  }
+
   for (const auto  : llvm::enumerate(ProgramHeaders())) {
 const ELFProgramHeader  = EnumPHdr.value();
 if (H.p_type != PT_LOAD)
@@ -1763,7 +1773,10 @@
   VMRange GetVMRange(const ELFSectionHeader ) {
 addr_t Address = H.sh_addr;
 addr_t Size = H.sh_flags & SHF_ALLOC ? H.sh_size : 0;
-if (ObjectType == ObjectFile::Type::eTypeObjectFile && Segments.empty() && (H.sh_flags & SHF_ALLOC)) {
+
+// When this is a debug file for relocatable file, the address is all zero
+if ((ObjectType == ObjectFile::Type::eTypeObjectFile ||
+	 (ObjectType == ObjectFile::Type::eTypeDebugInfo && H.sh_addr == 0)) && Segments.empty() && (H.sh_flags & SHF_ALLOC)) {
   NextVMAddress =
   llvm::alignTo(NextVMAddress, std::max(H.sh_addralign, 1));
   Address = NextVMAddress;
Index: lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
===
--- /dev/null
+++ lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
@@ -0,0 +1,165 @@
+#ifndef LLDB_SOURCE_PLUGINS_DYNAMICLOADER_FREEBSD_KERNEL_DYNAMICLOADERFREEBSDKERNEL_H
+#define LLDB_SOURCE_PLUGINS_DYNAMICLOADER_FREEBSD_KERNEL_DYNAMICLOADERFREEBSDKERNEL_H
+
+#include 
+#include 
+#include 
+
+#include "lldb/Target/DynamicLoader.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
+#include "llvm/BinaryFormat/ELF.h"
+
+class DynamicLoaderFreeBSDKernel : public lldb_private::DynamicLoader {
+public:
+  DynamicLoaderFreeBSDKernel(lldb_private::Process *process,
+ lldb::addr_t kernel_addr);
+
+  ~DynamicLoaderFreeBSDKernel() override;
+
+  // Static Functions
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static llvm::StringRef GetPluginNameStatic() {
+return "DynamicLoaderFreeBSDKernel";
+  }
+
+  static llvm::StringRef GetPluginDescriptionStatic();
+
+  static lldb_private::DynamicLoader *
+  CreateInstance(lldb_private::Process *process, bool force);
+
+  static void DebuggerInit(lldb_private::Debugger );
+
+  static lldb::addr_t FindFreeBSDKernel(lldb_private::Process *process);
+
+  // Hooks for time point that after attach to some proccess
+  void DidAttach() override;
+
+  void DidLaunch() override;
+
+  lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread ,
+  bool stop_others) override;
+
+  lldb_private::Status CanLoadImage() override;
+
+  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
+
+protected:
+  class KModImageInfo {
+  public:
+KModImageInfo()
+: m_module_sp(), m_memory_module_sp(), m_uuid(), m_name(), m_path() 

[Lldb-commits] [PATCH] D159076: [lldb] Add DynamicLoader for FreeBSD Kernel post-mortem debug facility

2023-08-29 Thread Sheng-Yi Hung via Phabricator via lldb-commits
aokblast updated this revision to Diff 554235.
aokblast added a comment.

Change DynamicLoader plugin for ProcessFreeBSDKernel


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159076/new/

https://reviews.llvm.org/D159076

Files:
  lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
  
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
  lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
  lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp

Index: lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
===
--- lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
+++ lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
@@ -10,7 +10,7 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/DynamicLoader.h"
 
-#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
+#include "Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h"
 #include "ProcessFreeBSDKernel.h"
 #include "ThreadFreeBSDKernel.h"
 
@@ -262,7 +262,7 @@
 DynamicLoader *ProcessFreeBSDKernel::GetDynamicLoader() {
   if (m_dyld_up.get() == nullptr)
 m_dyld_up.reset(DynamicLoader::FindPlugin(
-this, DynamicLoaderStatic::GetPluginNameStatic()));
+this, DynamicLoaderFreeBSDKernel::GetPluginNameStatic()));
   return m_dyld_up.get();
 }
 
Index: lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
===
--- /dev/null
+++ lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
@@ -0,0 +1,165 @@
+#ifndef LLDB_SOURCE_PLUGINS_DYNAMICLOADER_FREEBSD_KERNEL_DYNAMICLOADERFREEBSDKERNEL_H
+#define LLDB_SOURCE_PLUGINS_DYNAMICLOADER_FREEBSD_KERNEL_DYNAMICLOADERFREEBSDKERNEL_H
+
+#include 
+#include 
+#include 
+
+#include "lldb/Target/DynamicLoader.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
+#include "llvm/BinaryFormat/ELF.h"
+
+class DynamicLoaderFreeBSDKernel : public lldb_private::DynamicLoader {
+public:
+  DynamicLoaderFreeBSDKernel(lldb_private::Process *process,
+ lldb::addr_t kernel_addr);
+
+  ~DynamicLoaderFreeBSDKernel() override;
+
+  // Static Functions
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static llvm::StringRef GetPluginNameStatic() {
+return "DynamicLoaderFreeBSDKernel";
+  }
+
+  static llvm::StringRef GetPluginDescriptionStatic();
+
+  static lldb_private::DynamicLoader *
+  CreateInstance(lldb_private::Process *process, bool force);
+
+  static void DebuggerInit(lldb_private::Debugger );
+
+  static lldb::addr_t FindFreeBSDKernel(lldb_private::Process *process);
+
+  // Hooks for time point that after attach to some proccess
+  void DidAttach() override;
+
+  void DidLaunch() override;
+
+  lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread ,
+  bool stop_others) override;
+
+  lldb_private::Status CanLoadImage() override;
+
+  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
+
+protected:
+  class KModImageInfo {
+  public:
+KModImageInfo()
+: m_module_sp(), m_memory_module_sp(), m_uuid(), m_name(), m_path() {}
+
+void Clear() {
+  m_load_address = LLDB_INVALID_ADDRESS;
+  m_name.clear();
+  m_uuid.Clear();
+  m_module_sp.reset();
+  m_memory_module_sp.reset();
+  m_stop_id = UINT32_MAX;
+  m_path.clear();
+}
+
+void SetLoadAddress(lldb::addr_t load_address) {
+  m_load_address = load_address;
+}
+
+lldb::addr_t GetLoadAddress() const { return m_load_address; }
+
+void SetUUID(const lldb_private::UUID uuid) { m_uuid = uuid; }
+
+lldb_private::UUID GetUUID() const { return m_uuid; }
+
+void SetName(const char *name) { m_name = name; }
+
+std::string GetName() const { return m_name; }
+
+void SetPath(const char *path) { m_path = path; }
+
+std::string GetPath() const { return m_path; }
+
+void SetModule(lldb::ModuleSP module) { m_module_sp = module; }
+
+lldb::ModuleSP GetModule() { return m_module_sp; }
+
+void SetIsKernel(bool is_kernel) { m_is_kernel = is_kernel; }
+
+bool IsKernel() const { return m_is_kernel; };
+
+void SetStopID(uint32_t stop_id) { m_stop_id = stop_id; }
+
+uint32_t GetStopID() { return m_stop_id; }
+
+bool IsLoaded() const { return m_stop_id != UINT32_MAX; };
+
+bool ReadMemoryModule(lldb_private::Process *process);
+
+bool LoadImageUsingMemoryModule(lldb_private::Process *process);
+
+bool LoadImageUsingFileAddress(lldb_private::Process *process);
+
+using collection_type = std::vector;
+
+  private:
+lldb::ModuleSP m_module_sp;
+lldb::ModuleSP m_memory_module_sp;
+lldb::addr_t 

[Lldb-commits] [PATCH] D159076: [lldb] Add DynamicLoader for FreeBSD Kernel post-mortem debug facility

2023-08-29 Thread Sheng-Yi Hung via Phabricator via lldb-commits
aokblast created this revision.
Herald added a subscriber: emaste.
Herald added a project: All.
aokblast requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159076

Files:
  lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/CMakeLists.txt
  
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
  lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h

Index: lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
===
--- /dev/null
+++ lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h
@@ -0,0 +1,165 @@
+#ifndef LLDB_SOURCE_PLUGINS_DYNAMICLOADER_FREEBSD_KERNEL_DYNAMICLOADERFREEBSDKERNEL_H
+#define LLDB_SOURCE_PLUGINS_DYNAMICLOADER_FREEBSD_KERNEL_DYNAMICLOADERFREEBSDKERNEL_H
+
+#include 
+#include 
+#include 
+
+#include "lldb/Target/DynamicLoader.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/UUID.h"
+#include "llvm/BinaryFormat/ELF.h"
+
+class DynamicLoaderFreeBSDKernel : public lldb_private::DynamicLoader {
+public:
+  DynamicLoaderFreeBSDKernel(lldb_private::Process *process,
+ lldb::addr_t kernel_addr);
+
+  ~DynamicLoaderFreeBSDKernel() override;
+
+  // Static Functions
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static llvm::StringRef GetPluginNameStatic() {
+return "DynamicLoaderFreeBSDKernel";
+  }
+
+  static llvm::StringRef GetPluginDescriptionStatic();
+
+  static lldb_private::DynamicLoader *
+  CreateInstance(lldb_private::Process *process, bool force);
+
+  static void DebuggerInit(lldb_private::Debugger );
+
+  static lldb::addr_t FindFreeBSDKernel(lldb_private::Process *process);
+
+  // Hooks for time point that after attach to some proccess
+  void DidAttach() override;
+
+  void DidLaunch() override;
+
+  lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread ,
+  bool stop_others) override;
+
+  lldb_private::Status CanLoadImage() override;
+
+  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
+
+protected:
+  class KModImageInfo {
+  public:
+KModImageInfo()
+: m_module_sp(), m_memory_module_sp(), m_uuid(), m_name(), m_path() {}
+
+void Clear() {
+  m_load_address = LLDB_INVALID_ADDRESS;
+  m_name.clear();
+  m_uuid.Clear();
+  m_module_sp.reset();
+  m_memory_module_sp.reset();
+  m_stop_id = UINT32_MAX;
+  m_path.clear();
+}
+
+void SetLoadAddress(lldb::addr_t load_address) {
+  m_load_address = load_address;
+}
+
+lldb::addr_t GetLoadAddress() const { return m_load_address; }
+
+void SetUUID(const lldb_private::UUID uuid) { m_uuid = uuid; }
+
+lldb_private::UUID GetUUID() const { return m_uuid; }
+
+void SetName(const char *name) { m_name = name; }
+
+std::string GetName() const { return m_name; }
+
+void SetPath(const char *path) { m_path = path; }
+
+std::string GetPath() const { return m_path; }
+
+void SetModule(lldb::ModuleSP module) { m_module_sp = module; }
+
+lldb::ModuleSP GetModule() { return m_module_sp; }
+
+void SetIsKernel(bool is_kernel) { m_is_kernel = is_kernel; }
+
+bool IsKernel() const { return m_is_kernel; };
+
+void SetStopID(uint32_t stop_id) { m_stop_id = stop_id; }
+
+uint32_t GetStopID() { return m_stop_id; }
+
+bool IsLoaded() const { return m_stop_id != UINT32_MAX; };
+
+bool ReadMemoryModule(lldb_private::Process *process);
+
+bool LoadImageUsingMemoryModule(lldb_private::Process *process);
+
+bool LoadImageUsingFileAddress(lldb_private::Process *process);
+
+using collection_type = std::vector;
+
+  private:
+lldb::ModuleSP m_module_sp;
+lldb::ModuleSP m_memory_module_sp;
+lldb::addr_t m_load_address = LLDB_INVALID_ADDRESS;
+lldb_private::UUID m_uuid;
+bool m_is_kernel = false;
+std::string m_name;
+std::string m_path;
+uint32_t m_stop_id = UINT32_MAX;
+  };
+
+  void PrivateInitialize(lldb_private::Process *process);
+
+  void Clear(bool clear_process);
+
+  void Update();
+
+  void LoadKernelModules();
+
+  bool ReadAllKmods();
+
+  bool ReadAllKmods(lldb_private::Address linker_files_head_address,
+KModImageInfo::collection_type _list);
+
+  bool ReadKmodsListHeader();
+
+  bool ParseKmods(lldb_private::Address linker_files_head_address);
+
+  void SetNotificationBreakPoint();
+
+  static lldb_private::UUID
+  CheckForKernelImageAtAddress(lldb_private::Process *process,
+   lldb::addr_t address,
+   bool *read_error = nullptr);
+
+  static lldb::addr_t FindKernelAtLoadAddress(lldb_private::Process *process);
+
+  static bool 

[Lldb-commits] [PATCH] D159011: [lldb][NFCI] Remove use of ConstString from UnixSignals

2023-08-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett accepted this revision.
DavidSpickett added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159011/new/

https://reviews.llvm.org/D159011

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


[Lldb-commits] [PATCH] D158971: [lldb][NFC] Put disassembler test classes and methods in anonymous namespace

2023-08-29 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

And this is being done for what reason?

I seem to remember something about static and anonymous namespace in the 
developer guide, please cite that if so.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158971/new/

https://reviews.llvm.org/D158971

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


[Lldb-commits] [PATCH] D158863: Implement the monolithic CI pipeline in the monorepo

2023-08-29 Thread Mikhail Goncharov via Phabricator via lldb-commits
goncharov added inline comments.



Comment at: .ci/generate-buildkite-pipeline-premerge:163
+
+if [[ ! ${SPECIFIC_PIPELINE_AVAILABLE} -eq 1 ]]; then
+  # Figure out which projects need to be built on each platform

ldionne wrote:
> goncharov wrote:
> > do I understand correctly that if mlir and libcxx modified then only libcxx 
> > will be run as SPECIFIC_PIPELINE_AVAILABLE=1?
> Yes. This corresponds to the current logic as well. Basically if a project 
> has some custom CI set up, we don't want to also run the general CI since 
> that's just a waste of resources.
The previous logic was that we caclulated first all projects that might be 
affected by current set (e.g. mlir is affected by llvm), then we added add 
dependencies.
So e.g. if mlir was modified, we should add "flang" to test set and then add 
"llvm clang" as dependincies, resutling in "mlir flang llvm clang" set. I can 
re-implement this logic later here no problem.
Also, it seems incorrect to only run "libc++" tests if libc++ was modified 
among other things. E.g. if something has touched libc++ and mlir than mlir 
should still run.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158863/new/

https://reviews.llvm.org/D158863

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