[Lldb-commits] [PATCH] D130743: [LLDB][RISCV] Add DWARF Registers

2022-07-28 Thread Emmmer S via Phabricator via lldb-commits
Emmmer created this revision.
Herald added subscribers: sunshaoce, VincentWu, luke957, vkmr, frasercrmck, 
evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, 
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.
Emmmer requested review of this revision.
Herald added subscribers: lldb-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130743

Files:
  lldb/source/Utility/RISCV_DWARF_Registers.h

Index: lldb/source/Utility/RISCV_DWARF_Registers.h
===
--- /dev/null
+++ lldb/source/Utility/RISCV_DWARF_Registers.h
@@ -0,0 +1,132 @@
+//===-- RISCV_DWARF_Registers.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 LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
+#define LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
+
+#include "lldb/lldb-private.h"
+
+namespace riscv_dwarf {
+
+enum {
+  dwarf_gpr_x0 = 0,
+  dwarf_gpr_x1,
+  dwarf_gpr_x2,
+  dwarf_gpr_x3,
+  dwarf_gpr_x4,
+  dwarf_gpr_x5,
+  dwarf_gpr_x6,
+  dwarf_gpr_x7,
+  dwarf_gpr_x8,
+  dwarf_gpr_x9,
+  dwarf_gpr_x10,
+  dwarf_gpr_x11,
+  dwarf_gpr_x12,
+  dwarf_gpr_x13,
+  dwarf_gpr_x14,
+  dwarf_gpr_x15,
+  dwarf_gpr_x16,
+  dwarf_gpr_x17,
+  dwarf_gpr_x18,
+  dwarf_gpr_x19,
+  dwarf_gpr_x20,
+  dwarf_gpr_x21,
+  dwarf_gpr_x22,
+  dwarf_gpr_x23,
+  dwarf_gpr_x24,
+  dwarf_gpr_x25,
+  dwarf_gpr_x26,
+  dwarf_gpr_x27,
+  dwarf_gpr_x28,
+  dwarf_gpr_x29,
+  dwarf_gpr_x30,
+  dwarf_gpr_x31 = 31,
+
+  dwarf_fpr_f0 = 32,
+  dwarf_fpr_f1,
+  dwarf_fpr_f2,
+  dwarf_fpr_f3,
+  dwarf_fpr_f4,
+  dwarf_fpr_f5,
+  dwarf_fpr_f6,
+  dwarf_fpr_f7,
+  dwarf_fpr_f8,
+  dwarf_fpr_f9,
+  dwarf_fpr_f10,
+  dwarf_fpr_f11,
+  dwarf_fpr_f12,
+  dwarf_fpr_f13,
+  dwarf_fpr_f14,
+  dwarf_fpr_f15,
+  dwarf_fpr_f16,
+  dwarf_fpr_f17,
+  dwarf_fpr_f18,
+  dwarf_fpr_f19,
+  dwarf_fpr_f20,
+  dwarf_fpr_f21,
+  dwarf_fpr_f22,
+  dwarf_fpr_f23,
+  dwarf_fpr_f24,
+  dwarf_fpr_f25,
+  dwarf_fpr_f26,
+  dwarf_fpr_f27,
+  dwarf_fpr_f28,
+  dwarf_fpr_f29,
+  dwarf_fpr_f30,
+  dwarf_fpr_f31 = 63,
+
+  // alternate frame return column
+  dwarf_alt_fr_col = 64,
+
+  dwarf_v0 = 96,
+  dwarf_v1,
+  dwarf_v2,
+  dwarf_v3,
+  dwarf_v4,
+  dwarf_v5,
+  dwarf_v6,
+  dwarf_v7,
+  dwarf_v8,
+  dwarf_v9,
+  dwarf_v10,
+  dwarf_v11,
+  dwarf_v12,
+  dwarf_v13,
+  dwarf_v14,
+  dwarf_v15,
+  dwarf_v16,
+  dwarf_v17,
+  dwarf_v18,
+  dwarf_v19,
+  dwarf_v20,
+  dwarf_v21,
+  dwarf_v22,
+  dwarf_v23,
+  dwarf_v24,
+  dwarf_v25,
+  dwarf_v26,
+  dwarf_v27,
+  dwarf_v28,
+  dwarf_v29,
+  dwarf_v30,
+  dwarf_v31 = 127,
+  dwarf_first_csr = 4096,
+  dwarf_last_csr = 8191,
+
+  // register name alias
+  dwarf_gpr_ra = dwarf_gpr_x1,
+  dwarf_gpr_sp = dwarf_gpr_x2,
+  dwarf_gpr_fp = dwarf_gpr_x8,
+
+  // mock pc regnum
+  dwarf_gpr_pc = UINT32_MAX,
+};
+
+} // namespace riscv_dwarf
+
+#endif // LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

It'd be nice if this was landed opt-in behind some cmake variable at first, so 
that folks could try it out on their bots and see how well things work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D116467: Deprecate `LLVM_LIBRARY_DIRS`

2022-07-28 Thread John Ericson via Phabricator via lldb-commits
Ericson2314 updated this revision to Diff 448493.
Ericson2314 added a comment.
Herald added a project: All.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116467

Files:
  lld/CMakeLists.txt
  lldb/cmake/modules/LLDBConfig.cmake
  llvm/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in

Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -107,7 +107,6 @@
 set(LLVM_LIBDIR_SUFFIX @LLVM_LIBDIR_SUFFIX@)
 
 set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@")
-set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@")
 
 set(LLVM_APPEND_VC_REV "@LLVM_APPEND_VC_REV@")
 
@@ -116,9 +115,8 @@
 # and generated include directories while the following variables have
 # them split.
 
-# These are the "main" dirs
+# This is the "main" dir
 set(LLVM_MAIN_INCLUDE_DIR "@LLVM_CONFIG_MAIN_INCLUDE_DIR@")
-set(LLVM_LIBRARY_DIR "@LLVM_CONFIG_LIBRARY_DIR@")
 
 # This is a secondary one for generated files
 set(LLVM_INCLUDE_DIR "@LLVM_CONFIG_INCLUDE_DIR@")
@@ -127,10 +125,15 @@
 set(LLVM_BINARY_DIR "@LLVM_CONFIG_BINARY_DIR@")
 set(LLVM_CMAKE_DIR "@LLVM_CONFIG_CMAKE_DIR@")
 set(LLVM_TOOLS_BINARY_DIR "@LLVM_CONFIG_TOOLS_BINARY_DIR@")
+set(LLVM_LIBRARY_DIR "@LLVM_CONFIG_LIBRARY_DIR@")
 set(LLVM_HAVE_OPT_VIEWER_MODULES @LLVM_HAVE_OPT_VIEWER_MODULES@)
 set(LLVM_CONFIGURATION_TYPES @CMAKE_CONFIGURATION_TYPES@)
 set(LLVM_ENABLE_SHARED_LIBS @BUILD_SHARED_LIBS@)
 
+# This is deprecated and just here for backwards compatibility. It will be
+# removed in the future.
+set(LLVM_LIBRARY_DIRS "${LLVM_LIBRARY_DIR}")
+
 set(LLVM_DEFAULT_EXTERNAL_LIT "@LLVM_CONFIG_DEFAULT_EXTERNAL_LIT@")
 set(LLVM_LIT_ARGS "@LLVM_LIT_ARGS@")
 
Index: llvm/cmake/modules/CMakeLists.txt
===
--- llvm/cmake/modules/CMakeLists.txt
+++ llvm/cmake/modules/CMakeLists.txt
@@ -59,16 +59,10 @@
   )
 list(REMOVE_DUPLICATES LLVM_CONFIG_INCLUDE_DIRS)
 
-set(LLVM_CONFIG_LIBRARY_DIR "${LLVM_LIBRARY_DIR}")
-set(LLVM_CONFIG_LIBRARY_DIRS
-  "${LLVM_CONFIG_LIBRARY_DIR}"
-  # FIXME: Should there be other entries here?
-  )
-list(REMOVE_DUPLICATES LLVM_CONFIG_LIBRARY_DIRS)
-
 set(LLVM_CONFIG_BINARY_DIR "${LLVM_BINARY_DIR}")
 set(LLVM_CONFIG_CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 set(LLVM_CONFIG_TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}")
+set(LLVM_CONFIG_LIBRARY_DIR "${LLVM_LIBRARY_DIR}")
 
 # Generate a default location for lit
 if (LLVM_BUILD_UTILS)
@@ -128,16 +122,10 @@
   )
 list(REMOVE_DUPLICATES LLVM_CONFIG_INCLUDE_DIRS)
 
-extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "lib\${LLVM_LIBDIR_SUFFIX}")
-set(LLVM_CONFIG_LIBRARY_DIRS
-  "${LLVM_CONFIG_LIBRARY_DIR}"
-  # FIXME: Should there be other entries here?
-  )
-list(REMOVE_DUPLICATES LLVM_CONFIG_LIBRARY_DIRS)
-
 set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
 extend_path(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
 extend_path(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}" "${LLVM_TOOLS_INSTALL_DIR}")
+extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "lib\${LLVM_LIBDIR_SUFFIX}")
 
 # Generate a default location for lit
 if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -274,7 +274,7 @@
   set(LLDB_CLANG_RESOURCE_DIR_NAME "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
   # Iterate over the possible places where the external resource directory
   # could be and pick the first that exists.
-  foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
+  foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIR}"
 "${LLVM_BUILD_LIBRARY_DIR}"
 "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
 # Build the resource directory path by appending 'clang/'.
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -98,7 +98,7 @@
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
   include_directories(${LLVM_INCLUDE_DIRS})
-  link_directories(${LLVM_LIBRARY_DIRS})
+  link_directories("${LLVM_LIBRARY_DIR}")
 
   if(LLVM_INCLUDE_TESTS)
 find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D129682: [lldb] Filter DIEs based on qualified name when possible

2022-07-28 Thread Alex Langford via Phabricator via lldb-commits
bulbazord marked 3 inline comments as done.
bulbazord added inline comments.



Comment at: lldb/source/Core/Module.cpp:730
 
+bool Module::LookupInfo::NameMatchesLookupInfo(
+ConstString function_name, LanguageType language_type) const {

clayborg wrote:
> So this function can end up being called with an empty function_name when 
> there is no mangled name (see comment in DWARFIndex.cpp). If there is no 
> language then we return true, but what does a language plug-in do in 
> DemangledNameContainsPath? The same thing?
> 
> I guess this means if you lookup "foo::erase" and you get a DIE that has 
> "erase" as its DW_AT_name, but the DIE has no DW_AT_mangled (yes, some C++ 
> debug info is emitted without a mangled name), that it will match any DIE 
> that has a DW_AT_name that matches "erase" regardless of the actual decl 
> context?
I moved the empty check to the top since we always want to keep unnamed 
symbols. 


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

https://reviews.llvm.org/D129682

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


[Lldb-commits] [PATCH] D129682: [lldb] Filter DIEs based on qualified name when possible

2022-07-28 Thread Alex Langford via Phabricator via lldb-commits
bulbazord updated this revision to Diff 448472.
bulbazord added a comment.
Herald added a reviewer: shafik.

- Expanded on NameMatchesLookupInfo to handle different scenarios when names we 
are comparing are mangled/demangled.
- Extracted functionality from DWARFASTParserClang to construct a demangled 
name from the DIE's context. This is now exposed through SymbolFileDWARF so 
that we can get a demangled name of a DIE consistently with one piece of code.


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

https://reviews.llvm.org/D129682

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/SymbolFileOnDemand.h
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Symbol/SymbolFile.cpp
  lldb/source/Symbol/SymbolFileOnDemand.cpp
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -459,8 +459,9 @@
 ContextOr->IsValid() ? *ContextOr : CompilerDeclContext();
 
 List.Clear();
-Symfile.FindFunctions(ConstString(Name), ContextPtr, getFunctionNameFlags(),
- true, List);
+Module::LookupInfo lookup_info(ConstString(Name), getFunctionNameFlags(),
+   eLanguageTypeUnknown);
+Symfile.FindFunctions(lookup_info, ContextPtr, true, List);
   }
   outs() << formatv("Found {0} functions:\n", List.GetSize());
   StreamString Stream;
Index: lldb/source/Symbol/SymbolFileOnDemand.cpp
===
--- lldb/source/Symbol/SymbolFileOnDemand.cpp
+++ lldb/source/Symbol/SymbolFileOnDemand.cpp
@@ -375,9 +375,11 @@
 }
 
 void SymbolFileOnDemand::FindFunctions(
-ConstString name, const CompilerDeclContext _decl_ctx,
-FunctionNameType name_type_mask, bool include_inlines,
+const Module::LookupInfo _info,
+const CompilerDeclContext _decl_ctx, bool include_inlines,
 SymbolContextList _list) {
+  ConstString name = lookup_info.GetLookupName();
+  FunctionNameType name_type_mask = lookup_info.GetNameTypeMask();
   if (!m_debug_info_enabled) {
 Log *log = GetLog();
 
@@ -402,7 +404,7 @@
 // allow the FindFucntions to go through.
 SetLoadDebugInfoEnabled();
   }
-  return m_sym_file_impl->FindFunctions(name, parent_decl_ctx, name_type_mask,
+  return m_sym_file_impl->FindFunctions(lookup_info, parent_decl_ctx,
 include_inlines, sc_list);
 }
 
Index: lldb/source/Symbol/SymbolFile.cpp
===
--- lldb/source/Symbol/SymbolFile.cpp
+++ lldb/source/Symbol/SymbolFile.cpp
@@ -120,9 +120,8 @@
  uint32_t max_matches,
  VariableList ) {}
 
-void SymbolFile::FindFunctions(ConstString name,
+void SymbolFile::FindFunctions(const Module::LookupInfo _info,
const CompilerDeclContext _decl_ctx,
-   lldb::FunctionNameType name_type_mask,
bool include_inlines,
SymbolContextList _list) {}
 
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -119,9 +119,8 @@
uint32_t 

[Lldb-commits] [PATCH] D130660: [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

2022-07-28 Thread Slava Gurevich via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2e6b6522296e: [LLDB] Fix missing return value in 
SBBreakpointLocation::GetQueueName() (authored by fixathon).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130660

Files:
  lldb/source/API/SBBreakpointLocation.cpp
  
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py


Index: 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -89,6 +89,53 @@
 bkpt.SetCondition(bkpt_new_cond)
 self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, 
"Didn't go back to tracking condition")
 
+# Test that set/get accessor methods on BreakpointLocation behave 
correctly.
+bkpt_loc = bkpt.GetLocationAtIndex(0)
+
+value = "MyQueue"
+bkpt_loc.SetQueueName(value)
+self.assertEqual(bkpt_loc.GetQueueName(), value,"Successfully set/get 
bp location QueueName")
+
+value = 5
+bkpt_loc.SetThreadID(value)
+self.assertEqual(bkpt_loc.GetThreadID(), value,"Successfully set/get 
bp location ThreadID")
+
+value = "1 == 0"
+bkpt_loc.SetCondition(value)
+self.assertEqual(bkpt_loc.GetCondition(), value,"Successfully set/get 
bp location Condition")
+
+value = 6
+bkpt_loc.SetThreadIndex(value)
+self.assertEqual(bkpt_loc.GetThreadIndex(), value,"Successfully 
set/get bp location ThreadIndex")
+
+value = "MyThread"
+bkpt_loc.SetThreadName(value)
+self.assertEqual(bkpt_loc.GetThreadName(), value,"Successfully set/get 
bp location ThreadName")
+
+value = 5
+bkpt_loc.SetIgnoreCount(value)
+self.assertEqual(bkpt_loc.GetIgnoreCount(), value,"Successfully 
set/get bp location IgnoreCount")
+
+for value in [True,False]:
+bkpt_loc.SetAutoContinue(value)
+self.assertEqual(bkpt_loc.GetAutoContinue(), value,"Successfully 
set/get bp location AutoContinue")
+
+for value in [True,False]:
+bkpt_loc.SetEnabled(value)
+self.assertEqual(bkpt_loc.IsEnabled(), value,"Successfully set/get 
bp location SetEnabled")
+
+# test set/get CommandLineCommands
+set_cmds = lldb.SBStringList()
+set_cmds.AppendString("frame var")
+set_cmds.AppendString("bt")
+bkpt_loc.SetCommandLineCommands(set_cmds)
+
+get_cmds = lldb.SBStringList()
+bkpt_loc.GetCommandLineCommands(get_cmds)
+self.assertEqual(set_cmds.GetSize(), get_cmds.GetSize(), "Size of 
command line commands")
+for idx, _ in  enumerate(set_cmds):
+self.assertEqual(set_cmds.GetStringAtIndex(idx), 
get_cmds.GetStringAtIndex(idx), "Command %d"%(idx))
+
 def shadowed_bkpt_command_test(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 # Breakpoint option propagation from bkpt to loc used to be done the 
first time
Index: lldb/source/API/SBBreakpointLocation.cpp
===
--- lldb/source/API/SBBreakpointLocation.cpp
+++ lldb/source/API/SBBreakpointLocation.cpp
@@ -374,7 +374,7 @@
   if (loc_sp) {
 std::lock_guard guard(
 loc_sp->GetTarget().GetAPIMutex());
-loc_sp->GetQueueName();
+return loc_sp->GetQueueName();
   }
   return nullptr;
 }


Index: lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -89,6 +89,53 @@
 bkpt.SetCondition(bkpt_new_cond)
 self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, "Didn't go back to tracking condition")
 
+# Test that set/get accessor methods on BreakpointLocation behave correctly.
+bkpt_loc = bkpt.GetLocationAtIndex(0)
+
+value = "MyQueue"
+bkpt_loc.SetQueueName(value)
+self.assertEqual(bkpt_loc.GetQueueName(), value,"Successfully set/get bp location QueueName")
+
+value = 5
+bkpt_loc.SetThreadID(value)
+self.assertEqual(bkpt_loc.GetThreadID(), value,"Successfully set/get bp location ThreadID")
+
+value = "1 == 0"
+bkpt_loc.SetCondition(value)
+self.assertEqual(bkpt_loc.GetCondition(), value,"Successfully set/get bp location Condition")
+
+value = 6
+bkpt_loc.SetThreadIndex(value)
+

[Lldb-commits] [lldb] 2e6b652 - [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

2022-07-28 Thread Slava Gurevich via lldb-commits

Author: Slava Gurevich
Date: 2022-07-28T16:08:35-07:00
New Revision: 2e6b6522296e40304ccd2766ad3233af8a0851bb

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

LOG: [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

- Fix a typo in the function that never returns a significant value

- Add unit tests for the getters/setters in SBBreakpointLocation

- Verified the newly added unit test succeeds after the fix:
llvm-lit -sv  
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py

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

Added: 


Modified: 
lldb/source/API/SBBreakpointLocation.cpp

lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py

Removed: 




diff  --git a/lldb/source/API/SBBreakpointLocation.cpp 
b/lldb/source/API/SBBreakpointLocation.cpp
index 9143174377236..6c03aba15447f 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -374,7 +374,7 @@ const char *SBBreakpointLocation::GetQueueName() const {
   if (loc_sp) {
 std::lock_guard guard(
 loc_sp->GetTarget().GetAPIMutex());
-loc_sp->GetQueueName();
+return loc_sp->GetQueueName();
   }
   return nullptr;
 }

diff  --git 
a/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
 
b/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index 85c55a44d7226..982e56a74e260 100644
--- 
a/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ 
b/lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -89,6 +89,53 @@ def shadowed_bkpt_cond_test(self):
 bkpt.SetCondition(bkpt_new_cond)
 self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, 
"Didn't go back to tracking condition")
 
+# Test that set/get accessor methods on BreakpointLocation behave 
correctly.
+bkpt_loc = bkpt.GetLocationAtIndex(0)
+
+value = "MyQueue"
+bkpt_loc.SetQueueName(value)
+self.assertEqual(bkpt_loc.GetQueueName(), value,"Successfully set/get 
bp location QueueName")
+
+value = 5
+bkpt_loc.SetThreadID(value)
+self.assertEqual(bkpt_loc.GetThreadID(), value,"Successfully set/get 
bp location ThreadID")
+
+value = "1 == 0"
+bkpt_loc.SetCondition(value)
+self.assertEqual(bkpt_loc.GetCondition(), value,"Successfully set/get 
bp location Condition")
+
+value = 6
+bkpt_loc.SetThreadIndex(value)
+self.assertEqual(bkpt_loc.GetThreadIndex(), value,"Successfully 
set/get bp location ThreadIndex")
+
+value = "MyThread"
+bkpt_loc.SetThreadName(value)
+self.assertEqual(bkpt_loc.GetThreadName(), value,"Successfully set/get 
bp location ThreadName")
+
+value = 5
+bkpt_loc.SetIgnoreCount(value)
+self.assertEqual(bkpt_loc.GetIgnoreCount(), value,"Successfully 
set/get bp location IgnoreCount")
+
+for value in [True,False]:
+bkpt_loc.SetAutoContinue(value)
+self.assertEqual(bkpt_loc.GetAutoContinue(), value,"Successfully 
set/get bp location AutoContinue")
+
+for value in [True,False]:
+bkpt_loc.SetEnabled(value)
+self.assertEqual(bkpt_loc.IsEnabled(), value,"Successfully set/get 
bp location SetEnabled")
+
+# test set/get CommandLineCommands
+set_cmds = lldb.SBStringList()
+set_cmds.AppendString("frame var")
+set_cmds.AppendString("bt")
+bkpt_loc.SetCommandLineCommands(set_cmds)
+
+get_cmds = lldb.SBStringList()
+bkpt_loc.GetCommandLineCommands(get_cmds)
+self.assertEqual(set_cmds.GetSize(), get_cmds.GetSize(), "Size of 
command line commands")
+for idx, _ in  enumerate(set_cmds):
+self.assertEqual(set_cmds.GetStringAtIndex(idx), 
get_cmds.GetStringAtIndex(idx), "Command %d"%(idx))
+
 def shadowed_bkpt_command_test(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 # Breakpoint option propagation from bkpt to loc used to be done the 
first time



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


[Lldb-commits] [PATCH] D130660: [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

2022-07-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

As long as all values being set on the location differ from any that might be 
set on the breakpoint itself for any get/set tests you added this is good to go!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130660

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


[Lldb-commits] [PATCH] D129614: [lldb/crashlog] Surface error using SBCommandReturnObject argument

2022-07-28 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 448465.
mib marked an inline comment as done.

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

https://reviews.llvm.org/D129614

Files:
  lldb/examples/python/crashlog.py

Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -923,7 +923,7 @@
 pass
 
 def __call__(self, debugger, command, exe_ctx, result):
-SymbolicateCrashLogs(debugger, shlex.split(command))
+SymbolicateCrashLogs(debugger, shlex.split(command), result)
 
 def get_short_help(self):
 return "Symbolicate one or more darwin crash log files."
@@ -1008,12 +1008,15 @@
 for error in crash_log.errors:
 print(error)
 
-def load_crashlog_in_scripted_process(debugger, crash_log_file, options):
-result = lldb.SBCommandReturnObject()
+def load_crashlog_in_scripted_process(debugger, crash_log_file, options, result):
+def error(message, sb_error=lldb.SBError()):
+nonlocal result
+result.SetError(sb_error, message)
+return
 
 crashlog_path = os.path.expanduser(crash_log_file)
 if not os.path.exists(crashlog_path):
-result.PutCString("error: crashlog file %s does not exist" % crashlog_path)
+return error("crashlog file %s does not exist" % crashlog_path)
 
 crashlog = CrashLogParser().parse(debugger, crashlog_path, False)
 
@@ -1032,19 +1035,15 @@
 target = debugger.GetTargetAtIndex(0)
 # 4. Fail
 if target is None or not target.IsValid():
-result.PutCString("error: couldn't create target")
-return
+return error("couldn't create target")
 
 ci = debugger.GetCommandInterpreter()
 if not ci:
-result.PutCString("error: couldn't get command interpreter")
-return
+return error("couldn't get command interpreter")
 
-res = lldb.SBCommandReturnObject()
-ci.HandleCommand('script from lldb.macosx import crashlog_scripted_process', res)
-if not res.Succeeded():
-result.PutCString("error: couldn't import crashlog scripted process module")
-return
+ci.HandleCommand('script from lldb.macosx import crashlog_scripted_process', result)
+if not result.Succeeded():
+return error("couldn't import crashlog scripted process module")
 
 structured_data = lldb.SBStructuredData()
 structured_data.SetFromJSON(json.dumps({ "crashlog_path" : crashlog_path,
@@ -1053,11 +1052,11 @@
 launch_info.SetProcessPluginName("ScriptedProcess")
 launch_info.SetScriptedProcessClassName("crashlog_scripted_process.CrashLogScriptedProcess")
 launch_info.SetScriptedProcessDictionary(structured_data)
-error = lldb.SBError()
-process = target.Launch(launch_info, error)
+sb_error = lldb.SBError()
+process = target.Launch(launch_info, sb_error)
 
-if not process or error.Fail():
-return
+if not process or sb_error.Fail():
+return error("couldn't launch Scripted Process", sb_error)
 
 @contextlib.contextmanager
 def synchronous(debugger):
@@ -1213,7 +1212,7 @@
 be disassembled and lookups can be performed using the addresses found in the crash log.'''
 return CreateSymbolicateCrashLogOptions('crashlog', description, True)
 
-def SymbolicateCrashLogs(debugger, command_args):
+def SymbolicateCrashLogs(debugger, command_args, result):
 option_parser = CrashLogOptionParser()
 
 if not len(command_args):
@@ -1251,15 +1250,16 @@
 for crash_log_file in args:
 if should_run_in_interactive_mode(options, ci):
 load_crashlog_in_scripted_process(debugger, crash_log_file,
-  options)
+  options, result)
 else:
 crash_log = CrashLogParser().parse(debugger, crash_log_file, options.verbose)
-SymbolicateCrashLog(crash_log, options)
+SymbolicateCrashLog(crash_log, options, result)
 
 if __name__ == '__main__':
 # Create a new debugger instance
 debugger = lldb.SBDebugger.Create()
-SymbolicateCrashLogs(debugger, sys.argv[1:])
+result = lldb.SBCommandReturnObject()
+SymbolicateCrashLogs(debugger, sys.argv[1:], result)
 lldb.SBDebugger.Destroy(debugger)
 
 def __lldb_init_module(debugger, internal_dict):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D129614: [lldb/crashlog] Surface error using SBCommandReturnObject argument

2022-07-28 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked 2 inline comments as done.
mib added inline comments.



Comment at: lldb/examples/python/crashlog.py:1012-1015
+def error(message, sb_error=lldb.SBError()):
+nonlocal result
+result.SetError(sb_error, "error: %s" % message)
+return

JDevlieghere wrote:
> Can we do this with a try-catch + an exception?
@JDevlieghere As mentioned on D129611, if we raise an exception we won't be 
able to surface the error to lldb or even to IDEs. I think it's better to use 
the `SBCommandReturnObject`

@kastiglione true! I'll remove the "error: " prefix, but I think it's 
reasonable to keep this helper function to avoid code duplication.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129614

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


[Lldb-commits] [PATCH] D130660: [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

2022-07-28 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon marked an inline comment as done.
fixathon added a comment.

Address the review comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130660

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


[Lldb-commits] [PATCH] D130660: [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

2022-07-28 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon updated this revision to Diff 448463.
fixathon added a comment.

Address the review comments and inline the tests into an existing test function


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130660

Files:
  lldb/source/API/SBBreakpointLocation.cpp
  
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py


Index: 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -89,6 +89,53 @@
 bkpt.SetCondition(bkpt_new_cond)
 self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, 
"Didn't go back to tracking condition")
 
+# Test that set/get accessor methods on BreakpointLocation behave 
correctly.
+bkpt_loc = bkpt.GetLocationAtIndex(0)
+
+value = "MyQueue"
+bkpt_loc.SetQueueName(value)
+self.assertEqual(bkpt_loc.GetQueueName(), value,"Successfully set/get 
bp location QueueName")
+
+value = 5
+bkpt_loc.SetThreadID(value)
+self.assertEqual(bkpt_loc.GetThreadID(), value,"Successfully set/get 
bp location ThreadID")
+
+value = "1 == 0"
+bkpt_loc.SetCondition(value)
+self.assertEqual(bkpt_loc.GetCondition(), value,"Successfully set/get 
bp location Condition")
+
+value = 6
+bkpt_loc.SetThreadIndex(value)
+self.assertEqual(bkpt_loc.GetThreadIndex(), value,"Successfully 
set/get bp location ThreadIndex")
+
+value = "MyThread"
+bkpt_loc.SetThreadName(value)
+self.assertEqual(bkpt_loc.GetThreadName(), value,"Successfully set/get 
bp location ThreadName")
+
+value = 5
+bkpt_loc.SetIgnoreCount(value)
+self.assertEqual(bkpt_loc.GetIgnoreCount(), value,"Successfully 
set/get bp location IgnoreCount")
+
+for value in [True,False]:
+bkpt_loc.SetAutoContinue(value)
+self.assertEqual(bkpt_loc.GetAutoContinue(), value,"Successfully 
set/get bp location AutoContinue")
+
+for value in [True,False]:
+bkpt_loc.SetEnabled(value)
+self.assertEqual(bkpt_loc.IsEnabled(), value,"Successfully set/get 
bp location SetEnabled")
+
+# test set/get CommandLineCommands
+set_cmds = lldb.SBStringList()
+set_cmds.AppendString("frame var")
+set_cmds.AppendString("bt")
+bkpt_loc.SetCommandLineCommands(set_cmds)
+
+get_cmds = lldb.SBStringList()
+bkpt_loc.GetCommandLineCommands(get_cmds)
+self.assertEqual(set_cmds.GetSize(), get_cmds.GetSize(), "Size of 
command line commands")
+for idx, _ in  enumerate(set_cmds):
+self.assertEqual(set_cmds.GetStringAtIndex(idx), 
get_cmds.GetStringAtIndex(idx), "Command %d"%(idx))
+
 def shadowed_bkpt_command_test(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 # Breakpoint option propagation from bkpt to loc used to be done the 
first time
Index: lldb/source/API/SBBreakpointLocation.cpp
===
--- lldb/source/API/SBBreakpointLocation.cpp
+++ lldb/source/API/SBBreakpointLocation.cpp
@@ -374,7 +374,7 @@
   if (loc_sp) {
 std::lock_guard guard(
 loc_sp->GetTarget().GetAPIMutex());
-loc_sp->GetQueueName();
+return loc_sp->GetQueueName();
   }
   return nullptr;
 }


Index: lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -89,6 +89,53 @@
 bkpt.SetCondition(bkpt_new_cond)
 self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, "Didn't go back to tracking condition")
 
+# Test that set/get accessor methods on BreakpointLocation behave correctly.
+bkpt_loc = bkpt.GetLocationAtIndex(0)
+
+value = "MyQueue"
+bkpt_loc.SetQueueName(value)
+self.assertEqual(bkpt_loc.GetQueueName(), value,"Successfully set/get bp location QueueName")
+
+value = 5
+bkpt_loc.SetThreadID(value)
+self.assertEqual(bkpt_loc.GetThreadID(), value,"Successfully set/get bp location ThreadID")
+
+value = "1 == 0"
+bkpt_loc.SetCondition(value)
+self.assertEqual(bkpt_loc.GetCondition(), value,"Successfully set/get bp location Condition")
+
+value = 6
+bkpt_loc.SetThreadIndex(value)
+self.assertEqual(bkpt_loc.GetThreadIndex(), value,"Successfully 

[Lldb-commits] [PATCH] D130660: [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

2022-07-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Looks good. I would just inline the contents of 
shadowed_bkpt_locations_setters_getters_test into 
test_shadowed_location_getters_setters since it isn't use anywhere else.




Comment at: 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py:29
+self.build()
+self.shadowed_bkpt_locations_setters_getters_test()
+

unless you plan on re-using shadowed_bkpt_locations_setters_getters_test() I 
would just inline the function's contents here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130660

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


[Lldb-commits] [PATCH] D130660: [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

2022-07-28 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon updated this revision to Diff 448457.
fixathon added a comment.

Fix duplicate  name of the test function


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130660

Files:
  lldb/source/API/SBBreakpointLocation.cpp
  
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py


Index: 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -23,6 +23,11 @@
 self.build()
 self.shadowed_bkpt_cond_test()
 
+def test_shadowed_location_getters_setters(self):
+"""Test that options set/get on breakpoint location behave 
correctly."""
+self.build()
+self.shadowed_bkpt_locations_setters_getters_test()
+
 def test_shadowed_command_options(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 self.build()
@@ -89,6 +94,56 @@
 bkpt.SetCondition(bkpt_new_cond)
 self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, 
"Didn't go back to tracking condition")
 
+def shadowed_bkpt_locations_setters_getters_test(self):
+"""Test that set/get accessor methods on BreakpointLocation behave 
correctly."""
+
+bkpt = self.set_breakpoint()
+bkpt_loc = bkpt.GetLocationAtIndex(0)
+
+value = "MyQueue"
+bkpt_loc.SetQueueName(value)
+self.assertEqual(bkpt_loc.GetQueueName(), value,"Successfully set/get 
bp location QueueName")
+
+value = 5
+bkpt_loc.SetThreadID(value)
+self.assertEqual(bkpt_loc.GetThreadID(), value,"Successfully set/get 
bp location ThreadID")
+
+value = "1 == 0"
+bkpt_loc.SetCondition(value)
+self.assertEqual(bkpt_loc.GetCondition(), value,"Successfully set/get 
bp location Condition")
+
+value = 6
+bkpt_loc.SetThreadIndex(value)
+self.assertEqual(bkpt_loc.GetThreadIndex(), value,"Successfully 
set/get bp location ThreadIndex")
+
+value = "MyThread"
+bkpt_loc.SetThreadName(value)
+self.assertEqual(bkpt_loc.GetThreadName(), value,"Successfully set/get 
bp location ThreadName")
+
+value = 5
+bkpt_loc.SetIgnoreCount(value)
+self.assertEqual(bkpt_loc.GetIgnoreCount(), value,"Successfully 
set/get bp location IgnoreCount")
+
+for value in [True,False]:
+bkpt_loc.SetAutoContinue(value)
+self.assertEqual(bkpt_loc.GetAutoContinue(), value,"Successfully 
set/get bp location AutoContinue")
+
+for value in [True,False]:
+bkpt_loc.SetEnabled(value)
+self.assertEqual(bkpt_loc.IsEnabled(), value,"Successfully set/get 
bp location SetEnabled")
+
+# test set/get CommandLineCommands
+set_cmds = lldb.SBStringList()
+set_cmds.AppendString("frame var")
+set_cmds.AppendString("bt")
+bkpt_loc.SetCommandLineCommands(set_cmds)
+
+get_cmds = lldb.SBStringList()
+bkpt_loc.GetCommandLineCommands(get_cmds)
+self.assertEqual(set_cmds.GetSize(), get_cmds.GetSize(), "Size of 
command line commands")
+for idx, _ in  enumerate(set_cmds):
+self.assertEqual(set_cmds.GetStringAtIndex(idx), 
get_cmds.GetStringAtIndex(idx), "Command %d"%(idx))
+
 def shadowed_bkpt_command_test(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 # Breakpoint option propagation from bkpt to loc used to be done the 
first time
Index: lldb/source/API/SBBreakpointLocation.cpp
===
--- lldb/source/API/SBBreakpointLocation.cpp
+++ lldb/source/API/SBBreakpointLocation.cpp
@@ -374,7 +374,7 @@
   if (loc_sp) {
 std::lock_guard guard(
 loc_sp->GetTarget().GetAPIMutex());
-loc_sp->GetQueueName();
+return loc_sp->GetQueueName();
   }
   return nullptr;
 }


Index: lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -23,6 +23,11 @@
 self.build()
 self.shadowed_bkpt_cond_test()
 
+def test_shadowed_location_getters_setters(self):
+"""Test that options set/get on breakpoint location behave correctly."""
+self.build()
+self.shadowed_bkpt_locations_setters_getters_test()
+
 def test_shadowed_command_options(self):
 """Test that options set on the breakpoint and location 

[Lldb-commits] [PATCH] D130660: [LLDB] Fix missing return value in SBBreakpointLocation::GetQueueName()

2022-07-28 Thread Slava Gurevich via Phabricator via lldb-commits
fixathon updated this revision to Diff 448453.
fixathon added a comment.

Added unit tests, and verified the fix is working.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130660

Files:
  lldb/source/API/SBBreakpointLocation.cpp
  
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py


Index: 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ 
lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -23,6 +23,11 @@
 self.build()
 self.shadowed_bkpt_cond_test()
 
+def test_shadowed_cond_options(self):
+"""Test that options set/get on breakpoint location behave 
correctly."""
+self.build()
+self.shadowed_bkpt_locations_setters_getters_test()
+
 def test_shadowed_command_options(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 self.build()
@@ -89,6 +94,56 @@
 bkpt.SetCondition(bkpt_new_cond)
 self.assertEqual(bkpt.location[0].GetCondition(), bkpt_new_cond, 
"Didn't go back to tracking condition")
 
+def shadowed_bkpt_locations_setters_getters_test(self):
+"""Test that set/get accessor methods on BreakpointLocation behave 
correctly."""
+
+bkpt = self.set_breakpoint()
+bkpt_loc = bkpt.GetLocationAtIndex(0)
+
+value = "MyQueue"
+bkpt_loc.SetQueueName(value)
+self.assertEqual(bkpt_loc.GetQueueName(), value,"Successfully set/get 
bp location QueueName")
+
+value = 5
+bkpt_loc.SetThreadID(value)
+self.assertEqual(bkpt_loc.GetThreadID(), value,"Successfully set/get 
bp location ThreadID")
+
+value = "1 == 0"
+bkpt_loc.SetCondition(value)
+self.assertEqual(bkpt_loc.GetCondition(), value,"Successfully set/get 
bp location Condition")
+
+value = 6
+bkpt_loc.SetThreadIndex(value)
+self.assertEqual(bkpt_loc.GetThreadIndex(), value,"Successfully 
set/get bp location ThreadIndex")
+
+value = "MyThread"
+bkpt_loc.SetThreadName(value)
+self.assertEqual(bkpt_loc.GetThreadName(), value,"Successfully set/get 
bp location ThreadName")
+
+value = 5
+bkpt_loc.SetIgnoreCount(value)
+self.assertEqual(bkpt_loc.GetIgnoreCount(), value,"Successfully 
set/get bp location IgnoreCount")
+
+for value in [True,False]:
+bkpt_loc.SetAutoContinue(value)
+self.assertEqual(bkpt_loc.GetAutoContinue(), value,"Successfully 
set/get bp location AutoContinue")
+
+for value in [True,False]:
+bkpt_loc.SetEnabled(value)
+self.assertEqual(bkpt_loc.IsEnabled(), value,"Successfully set/get 
bp location SetEnabled")
+
+# test set/get CommandLineCommands
+set_cmds = lldb.SBStringList()
+set_cmds.AppendString("frame var")
+set_cmds.AppendString("bt")
+bkpt_loc.SetCommandLineCommands(set_cmds)
+
+get_cmds = lldb.SBStringList()
+bkpt_loc.GetCommandLineCommands(get_cmds)
+self.assertEqual(set_cmds.GetSize(), get_cmds.GetSize(), "Size of 
command line commands")
+for idx, _ in  enumerate(set_cmds):
+self.assertEqual(set_cmds.GetStringAtIndex(idx), 
get_cmds.GetStringAtIndex(idx), "Command %d"%(idx))
+
 def shadowed_bkpt_command_test(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 # Breakpoint option propagation from bkpt to loc used to be done the 
first time
Index: lldb/source/API/SBBreakpointLocation.cpp
===
--- lldb/source/API/SBBreakpointLocation.cpp
+++ lldb/source/API/SBBreakpointLocation.cpp
@@ -374,7 +374,7 @@
   if (loc_sp) {
 std::lock_guard guard(
 loc_sp->GetTarget().GetAPIMutex());
-loc_sp->GetQueueName();
+return loc_sp->GetQueueName();
   }
   return nullptr;
 }


Index: lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ lldb/test/API/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -23,6 +23,11 @@
 self.build()
 self.shadowed_bkpt_cond_test()
 
+def test_shadowed_cond_options(self):
+"""Test that options set/get on breakpoint location behave correctly."""
+self.build()
+self.shadowed_bkpt_locations_setters_getters_test()
+
 def test_shadowed_command_options(self):
 """Test that options set on the breakpoint and location behave 

[Lldb-commits] [PATCH] D130401: Implement better path matching in FileSpecList::FindCompatibleIndex(...).

2022-07-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg updated this revision to Diff 448436.
clayborg added a comment.

Revert FileSpec::GetPathSeparator() changes that are no longer needed and 
respond to other imrpovement feedback.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130401

Files:
  lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
  lldb/include/lldb/Core/FileSpecList.h
  lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
  lldb/source/Core/FileSpecList.cpp
  lldb/source/Symbol/CompileUnit.cpp
  
lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
  lldb/test/API/functionalities/breakpoint/breakpoint_command/relative.yaml
  lldb/unittests/Core/CMakeLists.txt
  lldb/unittests/Core/FileSpecListTest.cpp

Index: lldb/unittests/Core/FileSpecListTest.cpp
===
--- /dev/null
+++ lldb/unittests/Core/FileSpecListTest.cpp
@@ -0,0 +1,125 @@
+//===-- FileSpecListTest.cpp --===//
+//
+// 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
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Core/FileSpecList.h"
+
+using namespace lldb_private;
+
+static FileSpec PosixSpec(llvm::StringRef path) {
+  return FileSpec(path, FileSpec::Style::posix);
+}
+
+static FileSpec WindowsSpec(llvm::StringRef path) {
+  return FileSpec(path, FileSpec::Style::windows);
+}
+
+TEST(FileSpecListTest, RelativePathMatchesPosix) {
+
+  const FileSpec fullpath = PosixSpec("/build/src/main.cpp");
+  const FileSpec relative = PosixSpec("./src/main.cpp");
+  const FileSpec basename = PosixSpec("./main.cpp");
+  const FileSpec full_wrong = PosixSpec("/other/wrong/main.cpp");
+  const FileSpec rel_wrong = PosixSpec("./wrong/main.cpp");
+  // Make sure these don't match "src/main.cpp" as we want to match full
+  // directories only
+  const FileSpec rel2_wrong = PosixSpec("asrc/main.cpp");
+  const FileSpec rel3_wrong = PosixSpec("rc/main.cpp");
+
+  FileSpecList files;
+  files.Append(fullpath);
+  files.Append(relative);
+  files.Append(basename);
+  files.Append(full_wrong);
+  files.Append(rel_wrong);
+  files.Append(rel2_wrong);
+  files.Append(rel3_wrong);
+
+  // Make sure the full path only matches the first entry
+  EXPECT_EQ((size_t)0, files.FindCompatibleIndex(0, fullpath));
+  EXPECT_EQ((size_t)1, files.FindCompatibleIndex(1, fullpath));
+  EXPECT_EQ((size_t)2, files.FindCompatibleIndex(2, fullpath));
+  EXPECT_EQ((size_t)UINT32_MAX, files.FindCompatibleIndex(3, fullpath));
+  // Make sure the relative path matches the all of the entries that contain
+  // the relative path
+  EXPECT_EQ((size_t)0, files.FindCompatibleIndex(0, relative));
+  EXPECT_EQ((size_t)1, files.FindCompatibleIndex(1, relative));
+  EXPECT_EQ((size_t)2, files.FindCompatibleIndex(2, relative));
+  EXPECT_EQ((size_t)UINT32_MAX, files.FindCompatibleIndex(3, relative));
+
+  // Make sure looking file a file using the basename matches all entries
+  EXPECT_EQ((size_t)0, files.FindCompatibleIndex(0, basename));
+  EXPECT_EQ((size_t)1, files.FindCompatibleIndex(1, basename));
+  EXPECT_EQ((size_t)2, files.FindCompatibleIndex(2, basename));
+  EXPECT_EQ((size_t)3, files.FindCompatibleIndex(3, basename));
+  EXPECT_EQ((size_t)4, files.FindCompatibleIndex(4, basename));
+  EXPECT_EQ((size_t)5, files.FindCompatibleIndex(5, basename));
+  EXPECT_EQ((size_t)6, files.FindCompatibleIndex(6, basename));
+
+  // Make sure that paths that have a common suffix don't return values that
+  // don't match on directory delimiters.
+  EXPECT_EQ((size_t)2, files.FindCompatibleIndex(0, rel2_wrong));
+  EXPECT_EQ((size_t)5, files.FindCompatibleIndex(3, rel2_wrong));
+  EXPECT_EQ((size_t)UINT32_MAX, files.FindCompatibleIndex(6, rel2_wrong));
+
+  EXPECT_EQ((size_t)2, files.FindCompatibleIndex(0, rel3_wrong));
+  EXPECT_EQ((size_t)6, files.FindCompatibleIndex(3, rel3_wrong));
+}
+
+TEST(FileSpecListTest, RelativePathMatchesWindows) {
+
+  const FileSpec fullpath = WindowsSpec(R"(C:\build\src\main.cpp)");
+  const FileSpec relative = WindowsSpec(R"(.\src\main.cpp)");
+  const FileSpec basename = WindowsSpec(R"(.\main.cpp)");
+  const FileSpec full_wrong = WindowsSpec(R"(\other\wrong\main.cpp)");
+  const FileSpec rel_wrong = WindowsSpec(R"(.\wrong\main.cpp)");
+  // Make sure these don't match "src\main.cpp" as we want to match full
+  // directories only
+  const FileSpec rel2_wrong = WindowsSpec(R"(asrc\main.cpp)");
+  const FileSpec rel3_wrong = WindowsSpec(R"("rc\main.cpp)");
+
+  FileSpecList files;
+  files.Append(fullpath);
+  files.Append(relative);
+  files.Append(basename);
+  files.Append(full_wrong);
+  files.Append(rel_wrong);
+  files.Append(rel2_wrong);

[Lldb-commits] [PATCH] D129611: [lldb/crashlog] Add '-t|--target' option to interactive mode

2022-07-28 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 448434.
mib edited the summary of this revision.
mib added a comment.

Address @JDevlieghere feedbacks.


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

https://reviews.llvm.org/D129611

Files:
  lldb/examples/python/crashlog.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test


Index: 
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
===
--- 
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
+++ 
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
@@ -2,7 +2,7 @@
 
 # RUN: mkdir -p %t.dir
 # RUN: yaml2obj %S/Inputs/interactive_crashlog/multithread-test.yaml > 
%t.dir/multithread-test
-# RUN: %lldb %t.dir/multithread-test -o 'command script import 
lldb.macosx.crashlog' -o 'crashlog -a -i 
%S/Inputs/interactive_crashlog/multithread-test.ips' -o "thread list" -o "bt 
all" 2>&1 | FileCheck %s
+# RUN: %lldb -o 'command script import lldb.macosx.crashlog' -o 'crashlog -a 
-i -t %t.dir/multithread-test 
%S/Inputs/interactive_crashlog/multithread-test.ips' -o "thread list" -o "bt 
all" 2>&1 | FileCheck %s
 
 # CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" 
options on these commands
 
Index: lldb/examples/python/scripted_process/crashlog_scripted_process.py
===
--- lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -13,7 +13,7 @@
 try:
 crash_log = CrashLogParser().parse(self.dbg, self.crashlog_path, 
False)
 except Exception as e:
-return
+raise e
 
 self.pid = crash_log.process_id
 self.addr_mask = crash_log.addr_mask
@@ -44,6 +44,7 @@
 super().__init__(target, args)
 
 if not self.target or not self.target.IsValid():
+# Return error
 return
 
 self.crashlog_path = None
@@ -54,6 +55,7 @@
 self.crashlog_path = crashlog_path.GetStringValue(4096)
 
 if not self.crashlog_path:
+# Return error
 return
 
 load_all_images = args.GetValueForKey("load_all_images")
Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -1017,11 +1017,21 @@
 
 crashlog = CrashLogParser().parse(debugger, crashlog_path, False)
 
-if debugger.GetNumTargets() > 0:
-target = debugger.GetTargetAtIndex(0)
-else:
+target = lldb.SBTarget()
+# 1. Try to use the user-provided target
+if options.target_path:
+target = debugger.CreateTarget(options.target_path)
+if not target:
+result.PutCString("error: couldn't create target provided by the 
user ({option.target_path})")
+return
+# 2. If the user didn't provide a target, try to create a target using the 
symbolicator
+if not target or not target.IsValid():
 target = crashlog.create_target()
-if not target:
+# 3. If that didn't work, and a target is already loaded, use it
+if (target is None  or not target.IsValid()) and debugger.GetNumTargets() 
> 0:
+target = debugger.GetTargetAtIndex(0)
+# 4. Fail
+if target is None or not target.IsValid():
 result.PutCString("error: couldn't create target")
 return
 
@@ -1183,6 +1193,12 @@
 action='store_true',
 help='dump symbolicated stackframes without creating a debug 
session',
 default=True)
+option_parser.add_option(
+'--target',
+'-t',
+dest='target_path',
+help='the target binary path that should be used for interactive 
crashlog (optional)',
+default=None)
 return option_parser
 
 


Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
===
--- lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test
@@ -2,7 +2,7 @@
 
 # RUN: mkdir -p %t.dir
 # RUN: yaml2obj %S/Inputs/interactive_crashlog/multithread-test.yaml > %t.dir/multithread-test
-# RUN: %lldb %t.dir/multithread-test -o 'command script import lldb.macosx.crashlog' -o 'crashlog -a -i %S/Inputs/interactive_crashlog/multithread-test.ips' -o "thread list" -o "bt all" 2>&1 | FileCheck %s
+# RUN: %lldb -o 'command script import lldb.macosx.crashlog' -o 'crashlog -a -i -t %t.dir/multithread-test %S/Inputs/interactive_crashlog/multithread-test.ips' -o "thread list" -o "bt all" 2>&1 | FileCheck %s
 
 # CHECK: 

[Lldb-commits] [PATCH] D129611: [lldb/crashlog] Add '-t|--target' option to interactive mode

2022-07-28 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked 5 inline comments as done.
mib added inline comments.



Comment at: 
lldb/examples/python/scripted_process/crashlog_scripted_process.py:47-48
+if not self.target.GetExecutable() or not self.target.IsValid():
+# Return error
 return
 

JDevlieghere wrote:
> The comment says return error but we're not returning anything. Should this 
> raise an exception? 
I was thinking of adding a `SBCommandObjectReturn` to every script process init 
function so we print errors in lldb instead of raising a python exception. That 
way we could propage that into the IDEs.
I'm doing that in a follow-up patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129611

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


[Lldb-commits] [lldb] dc0f452 - Cache the value for absolute path in FileSpec.

2022-07-28 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2022-07-28T13:31:41-07:00
New Revision: dc0f452e85e572f1e824c1eb3cdaa060d326f0c3

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

LOG: Cache the value for absolute path in FileSpec.

Checking if a path is absolute can be expensive and currently the result is not 
cached in the FileSpec object. This patch adds caching and also code to clear 
the cache if the file is modified.

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

Added: 


Modified: 
lldb/include/lldb/Utility/FileSpec.h
lldb/source/Utility/FileSpec.cpp
lldb/unittests/Utility/FileSpecTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/FileSpec.h 
b/lldb/include/lldb/Utility/FileSpec.h
index a0b01fb085ebe..8492c93fd58a1 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -416,10 +416,24 @@ class FileSpec {
   // Convenience method for setting the file without changing the style.
   void SetFile(llvm::StringRef path);
 
+  /// Called anytime m_directory or m_filename is changed to clear any cached
+  /// state in this object.
+  void PathWasModified() {
+m_is_resolved = false;
+m_absolute = Absolute::Calculate;
+  }
+
+  enum class Absolute : uint8_t {
+Calculate,
+Yes,
+No
+  };
+
   // Member variables
   ConstString m_directory;///< The uniqued directory path
   ConstString m_filename; ///< The uniqued filename path
   mutable bool m_is_resolved = false; ///< True if this path has been resolved.
+  mutable Absolute m_absolute = Absolute::Calculate; ///< Cache absoluteness.
   Style m_style; ///< The syntax that this path uses (e.g. Windows / Posix)
 };
 

diff  --git a/lldb/source/Utility/FileSpec.cpp 
b/lldb/source/Utility/FileSpec.cpp
index 7646d33264226..48b922970d87e 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -170,9 +170,7 @@ void FileSpec::SetFile(llvm::StringRef pathname) { 
SetFile(pathname, m_style); }
 // up into a directory and filename and stored as uniqued string values for
 // quick comparison and efficient memory usage.
 void FileSpec::SetFile(llvm::StringRef pathname, Style style) {
-  m_filename.Clear();
-  m_directory.Clear();
-  m_is_resolved = false;
+  Clear();
   m_style = (style == Style::native) ? GetNativeStyle() : style;
 
   if (pathname.empty())
@@ -259,6 +257,7 @@ Stream _private::operator<<(Stream , const FileSpec 
) {
 void FileSpec::Clear() {
   m_directory.Clear();
   m_filename.Clear();
+  PathWasModified();
 }
 
 // Compare two FileSpec objects. If "full" is true, then both the directory and
@@ -332,26 +331,32 @@ FileSpec::Style FileSpec::GetPathStyle() const { return 
m_style; }
 
 void FileSpec::SetDirectory(ConstString directory) {
   m_directory = directory;
+  PathWasModified();
 }
 
 void FileSpec::SetDirectory(llvm::StringRef directory) {
   m_directory = ConstString(directory);
+  PathWasModified();
 }
 
 void FileSpec::SetFilename(ConstString filename) {
   m_filename = filename;
+  PathWasModified();
 }
 
 void FileSpec::SetFilename(llvm::StringRef filename) {
   m_filename = ConstString(filename);
+  PathWasModified();
 }
 
 void FileSpec::ClearFilename() {
   m_filename.Clear();
+  PathWasModified();
 }
 
 void FileSpec::ClearDirectory() {
   m_directory.Clear();
+  PathWasModified();
 }
 
 // Extract the directory and path into a fixed buffer. This is needed as the
@@ -488,18 +493,22 @@ bool FileSpec::IsRelative() const {
 }
 
 bool FileSpec::IsAbsolute() const {
-llvm::SmallString<64> current_path;
-  GetPath(current_path, false);
+  // Check if we have cached if this path is absolute to avoid recalculating.
+  if (m_absolute != Absolute::Calculate)
+return m_absolute == Absolute::Yes;
 
-  // Early return if the path is empty.
-  if (current_path.empty())
-return false;
+  m_absolute = Absolute::No;
 
-  // We consider paths starting with ~ to be absolute.
-  if (current_path[0] == '~')
-return true;
+  llvm::SmallString<64> path;
+  GetPath(path, false);
+
+  if (!path.empty()) {
+// We consider paths starting with ~ to be absolute.
+if (path[0] == '~' || llvm::sys::path::is_absolute(path, m_style))
+  m_absolute = Absolute::Yes;
+  }
 
-  return llvm::sys::path::is_absolute(current_path, m_style);
+  return m_absolute == Absolute::Yes;
 }
 
 void FileSpec::MakeAbsolute(const FileSpec ) {

diff  --git a/lldb/unittests/Utility/FileSpecTest.cpp 
b/lldb/unittests/Utility/FileSpecTest.cpp
index 9260262d8b674..0249dd5a98a4d 100644
--- a/lldb/unittests/Utility/FileSpecTest.cpp
+++ b/lldb/unittests/Utility/FileSpecTest.cpp
@@ -450,3 +450,29 @@ TEST(FileSpecTest, OperatorBool) {
   EXPECT_FALSE(FileSpec(""));
   EXPECT_TRUE(FileSpec("/foo/bar"));
 }
+
+

[Lldb-commits] [PATCH] D130549: [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute.

2022-07-28 Thread Greg Clayton via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG529a3d87a799: [NFC] Improve FileSpec internal APIs and usage 
in preparation for adding… (authored by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130549

Files:
  lldb/include/lldb/Utility/FileSpec.h
  lldb/source/API/SBFileSpec.cpp
  lldb/source/API/SBLaunchInfo.cpp
  lldb/source/API/SBPlatform.cpp
  lldb/source/API/SBReproducer.cpp
  lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
  lldb/source/Commands/CommandObjectLog.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandlerCursesGUI.cpp
  lldb/source/Expression/FunctionCaller.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Host/common/FileAction.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Host/common/HostInfoBase.cpp
  lldb/source/Host/linux/HostInfoLinux.cpp
  lldb/source/Host/macosx/objcxx/Host.mm
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
  lldb/source/Host/posix/FileSystemPosix.cpp
  lldb/source/Host/posix/HostInfoPosix.cpp
  lldb/source/Host/windows/FileSystem.cpp
  lldb/source/Host/windows/ProcessLauncherWindows.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
  lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
  lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Symbol/SymbolContext.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/TargetList.cpp
  lldb/source/Target/Trace.cpp
  lldb/source/Utility/FileSpec.cpp
  lldb/tools/lldb-server/lldb-platform.cpp
  lldb/tools/lldb-test/lldb-test.cpp
  lldb/unittests/Target/FindFileTest.cpp
  lldb/unittests/Target/ModuleCacheTest.cpp
  lldb/unittests/Utility/FileSpecTest.cpp

Index: lldb/unittests/Utility/FileSpecTest.cpp
===
--- lldb/unittests/Utility/FileSpecTest.cpp
+++ lldb/unittests/Utility/FileSpecTest.cpp
@@ -22,92 +22,92 @@
 
 TEST(FileSpecTest, FileAndDirectoryComponents) {
   FileSpec fs_posix("/foo/bar", FileSpec::Style::posix);
-  EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
+  EXPECT_STREQ("/foo/bar", fs_posix.GetPath().c_str());
   EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString());
   EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString());
 
   FileSpec fs_windows("F:\\bar", FileSpec::Style::windows);
-  EXPECT_STREQ("F:\\bar", fs_windows.GetCString());
-  // EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetCString()); // It returns
+  EXPECT_STREQ("F:\\bar", fs_windows.GetPath().c_str());
+  // EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetPath().c_str()); // It returns
   // "F:/"
   EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString());
 
   FileSpec fs_posix_root("/", FileSpec::Style::posix);
-  EXPECT_STREQ("/", fs_posix_root.GetCString());
+  EXPECT_STREQ("/", fs_posix_root.GetPath().c_str());
   EXPECT_EQ(nullptr, fs_posix_root.GetDirectory().GetCString());
   EXPECT_STREQ("/", fs_posix_root.GetFilename().GetCString());
 
   FileSpec fs_net_drive("//net", FileSpec::Style::posix);
-  EXPECT_STREQ("//net", fs_net_drive.GetCString());
+  EXPECT_STREQ("//net", fs_net_drive.GetPath().c_str());
   EXPECT_EQ(nullptr, fs_net_drive.GetDirectory().GetCString());
   EXPECT_STREQ("//net", 

[Lldb-commits] [lldb] 529a3d8 - [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute.

2022-07-28 Thread Greg Clayton via lldb-commits

Author: Greg Clayton
Date: 2022-07-28T13:28:26-07:00
New Revision: 529a3d87a799a2cba29bc1d0f426a00d5bb4c88f

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

LOG: [NFC] Improve FileSpec internal APIs and usage in preparation for adding 
caching of resolved/absolute.

Resubmission of https://reviews.llvm.org/D130309 with the 2 patches that fixed 
the linux buildbot, and new windows fixes.

The FileSpec APIs allow users to modify instance variables directly by getting 
a non const reference to the directory and filename instance variables. This 
makes it impossible to control all of the times the FileSpec object is modified 
so we can clear cached member variables like m_resolved and with an upcoming 
patch caching if the file is relative or absolute. This patch modifies the APIs 
of FileSpec so no one can modify the directory or filename instance variables 
directly by adding set accessors and by removing the get accessors that are non 
const.

Many clients were using FileSpec::GetCString(...) which returned a unique C 
string from a ConstString'ified version of the result of GetPath() which 
returned a std::string. This caused many locations to use this convenient 
function incorrectly and could cause many strings to be added to the constant 
string pool that didn't need to. Most clients were converted to using 
FileSpec::GetPath().c_str() when possible. Other clients were modified to use 
the newly renamed version of this function which returns an actualy ConstString:

ConstString FileSpec::GetPathAsConstString(bool denormalize = true) const;

This avoids the issue where people were getting an already uniqued "const char 
*" that came from a ConstString only to put the "const char *" back into a 
"ConstString" object. By returning the ConstString instead of a "const char *" 
clients can be more efficient with the result.

The patch:
- Removes the non const GetDirectory() and GetFilename() get accessors
- Adds set accessors to replace the above functions: SetDirectory() and 
SetFilename().
- Adds ClearDirectory() and ClearFilename() to replace usage of the 
FileSpec::GetDirectory().Clear()/FileSpec::GetFilename().Clear() call sites
- Fixed all incorrect usage of FileSpec::GetCString() to use 
FileSpec::GetPath().c_str() where appropriate, and updated other call sites 
that wanted a ConstString to use the newly returned ConstString appropriately 
and efficiently.

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

Added: 


Modified: 
lldb/include/lldb/Utility/FileSpec.h
lldb/source/API/SBFileSpec.cpp
lldb/source/API/SBLaunchInfo.cpp
lldb/source/API/SBPlatform.cpp
lldb/source/API/SBReproducer.cpp
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Commands/CommandObjectLog.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Expression/FunctionCaller.cpp
lldb/source/Expression/REPL.cpp
lldb/source/Host/common/FileAction.cpp
lldb/source/Host/common/FileSystem.cpp
lldb/source/Host/common/HostInfoBase.cpp
lldb/source/Host/linux/HostInfoLinux.cpp
lldb/source/Host/macosx/objcxx/Host.mm
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
lldb/source/Host/posix/FileSystemPosix.cpp
lldb/source/Host/posix/HostInfoPosix.cpp
lldb/source/Host/windows/FileSystem.cpp
lldb/source/Host/windows/ProcessLauncherWindows.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp


[Lldb-commits] [PATCH] D130549: [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute.

2022-07-28 Thread Shoaib Meenai via Phabricator via lldb-commits
smeenai accepted this revision.
smeenai added a comment.
This revision is now accepted and ready to land.

FWIW, I've usually seen people just recommit directly instead of going through 
another review. Accepting this since it was already reviewed last time and the 
only changes are buildbot fixes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130549

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


[Lldb-commits] [PATCH] D130549: [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute.

2022-07-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

FYI: I have built this on mac and on my linux machine, so I know both mac and 
linux build, and we know windows builds now too


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130549

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


[Lldb-commits] [PATCH] D126359: [LLDB] Add basic floating point ops to IR interpreter

2022-07-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/test/API/lang/c/fpeval/main.c:3-4
+{
+double a = 42.0;
+double b = 2.0;
+return 0;  Set break point at this line.

labath wrote:
> kpdev42 wrote:
> > clayborg wrote:
> > > We should be testing "float" and "long double" as well to verify those 
> > > work.
> > Long double is not supported by this patch, but can be added. However long 
> > double is platform dependent type, so it makes no sense at all comparing 
> > JIT and interpreted results
> I think that was Greg's point. Interpreted and JITted results should provide 
> the same results even for platform dependent types. llvm's APFloat should 
> know enough about the individual types in order to emulate the operations 
> correctly, and lldb should know enough about the target in order to create 
> the appropriate APFloat instance.
Indeed. and if we are going to replace the float/double/long double 
interpretation, APFloat can handle that all as we must get the types from the 
ASTContext for the triple that has the right types anyway so this should be 
easy to make work. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126359

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


[Lldb-commits] [PATCH] D130549: [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute.

2022-07-28 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D130549#3683617 , @smeenai wrote:

> In D130549#3683423 , @clayborg 
> wrote:
>
>> Ping. This was accepted before but I had Buildbot issues. Those should all 
>> be resolved in this updated patch after a revert.
>
> Sorry for the delay. I can confirm this builds correctly for Windows now.

Great! Can someone accept the patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130549

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


[Lldb-commits] [PATCH] D112374: [clang] Implement ElaboratedType sugaring for types written bare

2022-07-28 Thread Matheus Izvekov via Phabricator via lldb-commits
mizvekov added a comment.

In D112374#3684722 , @hans wrote:

> Here's an example where I think this regressed a Clang diagnostic. Consider:

Consider this simple extension of this example, to show how this general 
problem already existed: https://godbolt.org/z/n6nGhejTc

  template  struct Template { Template(int x) {} };
  
  struct S1 {
struct Baz {
  struct Foo;
};
typedef Template Typedef;
  };
  
  struct S2 {
struct Baz {
  struct Foo;
};
typedef Template Typedef;
  };
  
  typedef S1::Typedef Bar;
  Bar f;

Prints: `error: no matching constructor for initialization of 'Bar' (aka 
'Template')`

You still don't know which `Foo` this refers to, because you don't know which 
`Baz` it is either.

This patch fixed the inconsistency where we printed the bare `Foo` with the 
synthetic nested name, but printed `Baz::Foo` as written.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112374

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


[Lldb-commits] [PATCH] D112374: [clang] Implement ElaboratedType sugaring for types written bare

2022-07-28 Thread Matheus Izvekov via Phabricator via lldb-commits
mizvekov added a comment.

In D112374#3684722 , @hans wrote:

> The problem is that just based on `Template` it's not clear whether it's 
> `S1::Foo` or `S2::Foo` that's referred to.

The logic in the diagnostic here ended up doing a silent single step desugar 
through a typedef in the 'aka'.

I think the danger of doing that as you exemplify is that, if you don't know 
what context the printed type belongs to, then it's hard to make sense of the 
meaning of what was written.

If we have to step through a sugar node which carries context, like type 
aliases / using types and such, perhaps we should go straight for the canonical 
type instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112374

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


[Lldb-commits] [PATCH] D112374: [clang] Implement ElaboratedType sugaring for types written bare

2022-07-28 Thread Hans Wennborg via Phabricator via lldb-commits
hans added a comment.

Here's an example where I think this regressed a Clang diagnostic. Consider:

  template  struct Template { Template(int x) {} };
  
  struct S1 {
struct Foo;
typedef Template Typedef;
  };
  
  struct S2 {
struct Foo;
typedef Template Typedef;
  };
  
  typedef S1::Typedef Bar;
  Bar f;

before this change, Clang would say:

  /tmp/a.cc:14:5: error: no matching constructor for initialization of 'Bar' 
(aka 'Template')
  Bar f;
  ^

however, after this change it says:

  /tmp/a.cc:14:5: error: no matching constructor for initialization of 'Bar' 
(aka 'Template')
  Bar f;
  ^

The problem is that just based on `Template` it's not clear whether it's 
`S1::Foo` or `S2::Foo` that's referred to.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112374

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


[Lldb-commits] [PATCH] D130686: [LLDB][RISCV] Add DWARF Registers

2022-07-28 Thread Emmmer S via Phabricator via lldb-commits
Emmmer updated this revision to Diff 448294.
Emmmer added a comment.

Add missing `Alternate Frame Return Column`


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

https://reviews.llvm.org/D130686

Files:
  lldb/source/Utility/RISCV_DWARF_Registers.h

Index: lldb/source/Utility/RISCV_DWARF_Registers.h
===
--- /dev/null
+++ lldb/source/Utility/RISCV_DWARF_Registers.h
@@ -0,0 +1,132 @@
+//===-- RISCV_DWARF_Registers.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 LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
+#define LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
+
+#include "lldb/lldb-private.h"
+
+namespace riscv_dwarf {
+
+enum {
+  dwarf_gpr_x0 = 0,
+  dwarf_gpr_x1,
+  dwarf_gpr_x2,
+  dwarf_gpr_x3,
+  dwarf_gpr_x4,
+  dwarf_gpr_x5,
+  dwarf_gpr_x6,
+  dwarf_gpr_x7,
+  dwarf_gpr_x8,
+  dwarf_gpr_x9,
+  dwarf_gpr_x10,
+  dwarf_gpr_x11,
+  dwarf_gpr_x12,
+  dwarf_gpr_x13,
+  dwarf_gpr_x14,
+  dwarf_gpr_x15,
+  dwarf_gpr_x16,
+  dwarf_gpr_x17,
+  dwarf_gpr_x18,
+  dwarf_gpr_x19,
+  dwarf_gpr_x20,
+  dwarf_gpr_x21,
+  dwarf_gpr_x22,
+  dwarf_gpr_x23,
+  dwarf_gpr_x24,
+  dwarf_gpr_x25,
+  dwarf_gpr_x26,
+  dwarf_gpr_x27,
+  dwarf_gpr_x28,
+  dwarf_gpr_x29,
+  dwarf_gpr_x30,
+  dwarf_gpr_x31 = 31,
+
+  dwarf_fpr_f0 = 32,
+  dwarf_fpr_f1,
+  dwarf_fpr_f2,
+  dwarf_fpr_f3,
+  dwarf_fpr_f4,
+  dwarf_fpr_f5,
+  dwarf_fpr_f6,
+  dwarf_fpr_f7,
+  dwarf_fpr_f8,
+  dwarf_fpr_f9,
+  dwarf_fpr_f10,
+  dwarf_fpr_f11,
+  dwarf_fpr_f12,
+  dwarf_fpr_f13,
+  dwarf_fpr_f14,
+  dwarf_fpr_f15,
+  dwarf_fpr_f16,
+  dwarf_fpr_f17,
+  dwarf_fpr_f18,
+  dwarf_fpr_f19,
+  dwarf_fpr_f20,
+  dwarf_fpr_f21,
+  dwarf_fpr_f22,
+  dwarf_fpr_f23,
+  dwarf_fpr_f24,
+  dwarf_fpr_f25,
+  dwarf_fpr_f26,
+  dwarf_fpr_f27,
+  dwarf_fpr_f28,
+  dwarf_fpr_f29,
+  dwarf_fpr_f30,
+  dwarf_fpr_f31 = 63,
+
+  // alternate frame return column
+  dwarf_alt_fr_col = 64,
+
+  dwarf_v0 = 96,
+  dwarf_v1,
+  dwarf_v2,
+  dwarf_v3,
+  dwarf_v4,
+  dwarf_v5,
+  dwarf_v6,
+  dwarf_v7,
+  dwarf_v8,
+  dwarf_v9,
+  dwarf_v10,
+  dwarf_v11,
+  dwarf_v12,
+  dwarf_v13,
+  dwarf_v14,
+  dwarf_v15,
+  dwarf_v16,
+  dwarf_v17,
+  dwarf_v18,
+  dwarf_v19,
+  dwarf_v20,
+  dwarf_v21,
+  dwarf_v22,
+  dwarf_v23,
+  dwarf_v24,
+  dwarf_v25,
+  dwarf_v26,
+  dwarf_v27,
+  dwarf_v28,
+  dwarf_v29,
+  dwarf_v30,
+  dwarf_v31 = 127,
+  dwarf_first_csr = 4096,
+  dwarf_last_csr = 8191,
+
+  // register name alias
+  dwarf_gpr_ra = dwarf_gpr_x1,
+  dwarf_gpr_sp = dwarf_gpr_x2,
+  dwarf_gpr_fp = dwarf_gpr_x8,
+
+  // mock pc regnum
+  dwarf_gpr_pc = UINT32_MAX,
+};
+
+} // namespace riscv_dwarf
+
+#endif // LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread H. Vetinari via Phabricator via lldb-commits
h-vetinari added a comment.

It may be worth calling out that this is about C++17 core language and not the 
standard library?

libstdcxx only finished C++17 support in GCC 12, and libcxx is still missing 
various pieces even today (much less for Clang 5).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130686: [LLDB][RISCV] Add DWARF Registers

2022-07-28 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.

I couldn't find a definition for  `Alternate Frame Return Column`. Perhaps it's 
this "alternate link register" I see elsewhere that's used for calling 
compressed code functions? Seems like a thing you could easily add later if 
needed.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130686

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Corentin Jabot via Phabricator via lldb-commits
cor3ntin accepted this revision.
cor3ntin added a comment.

Thanks a lot for working on this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Tobias Hieta via Phabricator via lldb-commits
thieta updated this revision to Diff 448262.
thieta added a comment.

Fixed unintended indentation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

Files:
  bolt/runtime/CMakeLists.txt
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/CheckCompilerVersion.cmake
  llvm/docs/CodingStandards.rst
  llvm/docs/ReleaseNotes.rst

Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -47,6 +47,18 @@
 Update on required toolchains to build LLVM
 ---
 
+LLVM is now built with C++17 by default. This means C++17 can be used in
+the code base.
+
+The previous "soft" toolchain requirements have now been changed to "hard".
+This means that the the following versions are now required to build LLVM
+and there is no way to supress this error.
+
+* GCC >= 7.1
+* Clang >= 5.0
+* Apple Clang >= 9.3
+* Visual Studio 2019 >= 16.7
+
 Changes to the LLVM IR
 --
 
Index: llvm/docs/CodingStandards.rst
===
--- llvm/docs/CodingStandards.rst
+++ llvm/docs/CodingStandards.rst
@@ -53,7 +53,7 @@
 C++ Standard Versions
 -
 
-Unless otherwise documented, LLVM subprojects are written using standard C++14
+Unless otherwise documented, LLVM subprojects are written using standard C++17
 code and avoid unnecessary vendor-specific extensions.
 
 Nevertheless, we restrict ourselves to features which are available in the
@@ -63,7 +63,7 @@
 Each toolchain provides a good reference for what it accepts:
 
 * Clang: https://clang.llvm.org/cxx_status.html
-* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx14
+* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx17
 * MSVC: https://msdn.microsoft.com/en-us/library/hh567368.aspx
 
 
Index: llvm/cmake/modules/CheckCompilerVersion.cmake
===
--- llvm/cmake/modules/CheckCompilerVersion.cmake
+++ llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -4,21 +4,19 @@
 
 include(CheckCXXSourceCompiles)
 
-set(GCC_MIN 5.1)
+set(GCC_MIN 7.1)
 set(GCC_SOFT_ERROR 7.1)
-set(CLANG_MIN 3.5)
+set(CLANG_MIN 5.0)
 set(CLANG_SOFT_ERROR 5.0)
-set(APPLECLANG_MIN 6.0)
+set(APPLECLANG_MIN 9.3)
 set(APPLECLANG_SOFT_ERROR 9.3)
 
 # https://en.wikipedia.org/wiki/Microsoft_Visual_C#Internal_version_numbering
-# _MSC_VER == 1920 MSVC++ 14.20 Visual Studio 2019 Version 16.0
 # _MSC_VER == 1927 MSVC++ 14.27 Visual Studio 2019 Version 16.7
-set(MSVC_MIN 19.20)
+set(MSVC_MIN 19.27)
 set(MSVC_SOFT_ERROR 19.27)
 
-# Map the above GCC versions to dates: https://gcc.gnu.org/develop.html#timeline
-set(GCC_MIN_DATE 20150422)
+set(LIBSTDCXX_MIN 7)
 set(LIBSTDCXX_SOFT_ERROR 7)
 
 
@@ -76,22 +74,14 @@
 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
-# Test for libstdc++ version of at least 4.8 by checking for _ZNKSt17bad_function_call4whatEv.
-# Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
 check_cxx_source_compiles("
 #include 
 #if defined(__GLIBCXX__)
-#if __GLIBCXX__ < ${GCC_MIN_DATE}
+#if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < ${LIBSTDCXX_MIN}
 #error Unsupported libstdc++ version
 #endif
 #endif
-#if defined(__GLIBCXX__)
-extern const char _ZNKSt17bad_function_call4whatEv[];
-const char *chk = _ZNKSt17bad_function_call4whatEv;
-#else
-const char *chk = \"\";
-#endif
-int main() { ++chk; return 0; }
+int main() { return 0; }
 "
   LLVM_LIBSTDCXX_MIN)
 if(NOT LLVM_LIBSTDCXX_MIN)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -58,7 +58,7 @@
 # Must go after project(..)
 include(GNUInstallDirs)
 
-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 if (CYGWIN)
   # Cygwin is a bit stricter and lack things like 'strdup', 'stricmp', etc in
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -20,7 +20,7 @@
 if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 
-  set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
   set(CMAKE_CXX_STANDARD_REQUIRED YES)
   set(CMAKE_CXX_EXTENSIONS NO)
 endif()
Index: lld/CMakeLists.txt
===
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -11,7 +11,7 @@
 

[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Tobias Hieta via Phabricator via lldb-commits
thieta added a comment.

In D130689#3684334 , @ChuanqiXu wrote:

> So it is free that developers want to use some C++17 features in a small 
> amount of code, right?

As soon as this land C++ 17 should be free to use everywhere yeah!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Tobias Hieta via Phabricator via lldb-commits
thieta added a comment.

In D130689#3684360 , @barannikov88 
wrote:

> There are a few places (primarily in ADT and Support) that check __cplusplus 
> > 201402. Do they need to be cleaned up?

Sounds good - but maybe that can be addressed in a separate diff unless they 
make the build fail after this change?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Tobias Hieta via Phabricator via lldb-commits
thieta updated this revision to Diff 448261.
thieta added a comment.

Address some old comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

Files:
  bolt/runtime/CMakeLists.txt
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/CheckCompilerVersion.cmake
  llvm/docs/CodingStandards.rst
  llvm/docs/ReleaseNotes.rst

Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -47,6 +47,18 @@
 Update on required toolchains to build LLVM
 ---
 
+LLVM is now built with C++17 by default. This means C++17 can be used in
+the code base.
+
+The previous "soft" toolchain requirements have now been changed to "hard".
+This means that the the following versions are now required to build LLVM
+and there is no way to supress this error.
+
+* GCC >= 7.1
+* Clang >= 5.0
+* Apple Clang >= 9.3
+* Visual Studio 2019 >= 16.7
+
 Changes to the LLVM IR
 --
 
Index: llvm/docs/CodingStandards.rst
===
--- llvm/docs/CodingStandards.rst
+++ llvm/docs/CodingStandards.rst
@@ -53,7 +53,7 @@
 C++ Standard Versions
 -
 
-Unless otherwise documented, LLVM subprojects are written using standard C++14
+Unless otherwise documented, LLVM subprojects are written using standard C++17
 code and avoid unnecessary vendor-specific extensions.
 
 Nevertheless, we restrict ourselves to features which are available in the
@@ -63,7 +63,7 @@
 Each toolchain provides a good reference for what it accepts:
 
 * Clang: https://clang.llvm.org/cxx_status.html
-* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx14
+* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx17
 * MSVC: https://msdn.microsoft.com/en-us/library/hh567368.aspx
 
 
Index: llvm/cmake/modules/CheckCompilerVersion.cmake
===
--- llvm/cmake/modules/CheckCompilerVersion.cmake
+++ llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -4,21 +4,19 @@
 
 include(CheckCXXSourceCompiles)
 
-set(GCC_MIN 5.1)
+set(GCC_MIN 7.1)
 set(GCC_SOFT_ERROR 7.1)
-set(CLANG_MIN 3.5)
+set(CLANG_MIN 5.0)
 set(CLANG_SOFT_ERROR 5.0)
-set(APPLECLANG_MIN 6.0)
+set(APPLECLANG_MIN 9.3)
 set(APPLECLANG_SOFT_ERROR 9.3)
 
 # https://en.wikipedia.org/wiki/Microsoft_Visual_C#Internal_version_numbering
-# _MSC_VER == 1920 MSVC++ 14.20 Visual Studio 2019 Version 16.0
 # _MSC_VER == 1927 MSVC++ 14.27 Visual Studio 2019 Version 16.7
-set(MSVC_MIN 19.20)
+set(MSVC_MIN 19.27)
 set(MSVC_SOFT_ERROR 19.27)
 
-# Map the above GCC versions to dates: https://gcc.gnu.org/develop.html#timeline
-set(GCC_MIN_DATE 20150422)
+set(LIBSTDCXX_MIN 7)
 set(LIBSTDCXX_SOFT_ERROR 7)
 
 
@@ -76,23 +74,15 @@
 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
 set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
-# Test for libstdc++ version of at least 4.8 by checking for _ZNKSt17bad_function_call4whatEv.
-# Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
 check_cxx_source_compiles("
-#include 
-#if defined(__GLIBCXX__)
-#if __GLIBCXX__ < ${GCC_MIN_DATE}
-#error Unsupported libstdc++ version
-#endif
-#endif
-#if defined(__GLIBCXX__)
-extern const char _ZNKSt17bad_function_call4whatEv[];
-const char *chk = _ZNKSt17bad_function_call4whatEv;
-#else
-const char *chk = \"\";
-#endif
-int main() { ++chk; return 0; }
-"
+  #include 
+  #if defined(__GLIBCXX__)
+  #if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < ${LIBSTDCXX_MIN}
+  #error Unsupported libstdc++ version
+  #endif
+  #endif
+  int main() { return 0; }
+  "
   LLVM_LIBSTDCXX_MIN)
 if(NOT LLVM_LIBSTDCXX_MIN)
   message(FATAL_ERROR "libstdc++ version must be at least ${GCC_MIN}.")
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -58,7 +58,7 @@
 # Must go after project(..)
 include(GNUInstallDirs)
 
-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 if (CYGWIN)
   # Cygwin is a bit stricter and lack things like 'strdup', 'stricmp', etc in
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -20,7 +20,7 @@
 if(LLDB_BUILT_STANDALONE)
   include(LLDBStandalone)
 
-  set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+  set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
   set(CMAKE_CXX_STANDARD_REQUIRED YES)
   set(CMAKE_CXX_EXTENSIONS NO)
 

[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Sergei Barannikov via Phabricator via lldb-commits
barannikov88 added a comment.

There are a few places (primarily in ADT and Support) that check __cplusplus > 
201402. Do they need to be cleaned up?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Mehdi AMINI via Phabricator via lldb-commits
mehdi_amini added a comment.

In D130689#3684333 , @thieta wrote:

> In D130689#3684330 , @mehdi_amini 
> wrote:
>
>> What does it mean exactly? We can't use **anything** C++17 without writing 
>> it in the coding standards?
>> I'm not sure it'll be manageable: how do you see this playing out?
>
> Probably poorly worded - what I was trying to convey is that if we want to 
> use a C++17 feature that's really impactful on the syntax/readability we 
> should probably consider recommending ways to use it in the coding standards, 
> similar to our guidelines on using for() loops 
> (https://llvm.org/docs/CodingStandards.html#use-range-based-for-loops-wherever-possible)
>  or the auto keyword 
> (https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable).

Makes sense, thanks! Let's just update the wording to convey this and this all 
looks good to me :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Daniel Bertalan via Phabricator via lldb-commits
BertalanD added inline comments.



Comment at: llvm/cmake/modules/CheckCompilerVersion.cmake:79-80
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x")
 # Test for libstdc++ version of at least 4.8 by checking for 
_ZNKSt17bad_function_call4whatEv.
 # Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 
and up).
 check_cxx_source_compiles("

This comment should be updated too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread James Henderson via Phabricator via lldb-commits
jhenderson accepted this revision.
jhenderson added a comment.
This revision is now accepted and ready to land.

In D130689#3684330 , @mehdi_amini 
wrote:

> Nice, LGTM, thanks for driving this!
>
>> Remember that if we want to adopt some new feature in a bigger way it should 
>> be discussed and added to the CodingStandard document.
>
> What does it mean exactly? We can't use **anything** C++17 without writing it 
> in the coding standards?
> I'm not sure it'll be manageable: how do you see this playing out?

Based on the release note, I don't think that was what was intended, although I 
am curious to understand what //was// intended!

Looks good to me anyway (but get more buy-in, perhaps a new Discourse post too, 
not just an update on the existing thread, since new threads get emailed out to 
more people).




Comment at: llvm/cmake/modules/CheckCompilerVersion.cmake:20
 
 # Map the above GCC versions to dates: 
https://gcc.gnu.org/develop.html#timeline
+set(LIBSTDCXX_MIN 7)

This comment seems out-of-date now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Chuanqi Xu via Phabricator via lldb-commits
ChuanqiXu added a comment.

In D130689#3684333 , @thieta wrote:

> In D130689#3684330 , @mehdi_amini 
> wrote:
>
>> What does it mean exactly? We can't use **anything** C++17 without writing 
>> it in the coding standards?
>> I'm not sure it'll be manageable: how do you see this playing out?
>
> Probably poorly worded - what I was trying to convey is that if we want to 
> use a C++17 feature that's really impactful on the syntax/readability we 
> should probably consider recommending ways to use it in the coding standards, 
> similar to our guidelines on using for() loops 
> (https://llvm.org/docs/CodingStandards.html#use-range-based-for-loops-wherever-possible)
>  or the auto keyword 
> (https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable).

So it is free that developers want to use some C++17 features in a small amount 
of code, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Tobias Hieta via Phabricator via lldb-commits
thieta added a comment.

In D130689#3684330 , @mehdi_amini 
wrote:

> What does it mean exactly? We can't use **anything** C++17 without writing it 
> in the coding standards?
> I'm not sure it'll be manageable: how do you see this playing out?

Probably poorly worded - what I was trying to convey is that if we want to use 
a C++17 feature that's really impactful on the syntax/readability we should 
probably consider recommending ways to use it in the coding standards, similar 
to our guidelines on using for() loops 
(https://llvm.org/docs/CodingStandards.html#use-range-based-for-loops-wherever-possible)
 or the auto keyword 
(https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Mehdi AMINI via Phabricator via lldb-commits
mehdi_amini added a comment.
Herald added a subscriber: JDevlieghere.

Nice, LGTM, thanks for driving this!

> Remember that if we want to adopt some new feature in a bigger way it should 
> be discussed and added to the CodingStandard document.

What does it mean exactly? We can't use **anything** C++17 without writing it 
in the coding standards?
I'm not sure it'll be manageable: how do you see this playing out?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130689

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


[Lldb-commits] [PATCH] D130689: [LLVM] Update C++ standard to 17

2022-07-28 Thread Tobias Hieta via Phabricator via lldb-commits
thieta created this revision.
thieta added reviewers: mehdi_amini, jyknight, jhenderson, hans, tstellar, 
cor3ntin, MaskRay.
Herald added subscribers: ayermolo, StephenFan, mgorny.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: All.
thieta requested review of this revision.
Herald added subscribers: lldb-commits, cfe-commits, yota9.
Herald added projects: clang, LLDB, LLVM.

Also make the soft toolchain requirements hard. This allows
us to use C++17 features in LLVM now. Remember that if we want
to adopt some new feature in a bigger way it should be discussed
and added to the CodingStandard document.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130689

Files:
  bolt/runtime/CMakeLists.txt
  clang/CMakeLists.txt
  lld/CMakeLists.txt
  lldb/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/CheckCompilerVersion.cmake
  llvm/docs/CodingStandards.rst
  llvm/docs/ReleaseNotes.rst

Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -47,6 +47,18 @@
 Update on required toolchains to build LLVM
 ---
 
+LLVM is now built with C++17 by default. This means C++17 can be used in
+the code base.
+
+The previous "soft" toolchain requirements have now been changed to "hard".
+This means that the the following versions are now required to build LLVM
+and there is no way to supress this error.
+
+* GCC >= 7.1
+* Clang >= 5.0
+* Apple Clang >= 9.3
+* Visual Studio 2019 >= 16.7
+
 Changes to the LLVM IR
 --
 
Index: llvm/docs/CodingStandards.rst
===
--- llvm/docs/CodingStandards.rst
+++ llvm/docs/CodingStandards.rst
@@ -53,7 +53,7 @@
 C++ Standard Versions
 -
 
-Unless otherwise documented, LLVM subprojects are written using standard C++14
+Unless otherwise documented, LLVM subprojects are written using standard C++17
 code and avoid unnecessary vendor-specific extensions.
 
 Nevertheless, we restrict ourselves to features which are available in the
@@ -63,7 +63,7 @@
 Each toolchain provides a good reference for what it accepts:
 
 * Clang: https://clang.llvm.org/cxx_status.html
-* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx14
+* GCC: https://gcc.gnu.org/projects/cxx-status.html#cxx17
 * MSVC: https://msdn.microsoft.com/en-us/library/hh567368.aspx
 
 
Index: llvm/cmake/modules/CheckCompilerVersion.cmake
===
--- llvm/cmake/modules/CheckCompilerVersion.cmake
+++ llvm/cmake/modules/CheckCompilerVersion.cmake
@@ -4,21 +4,21 @@
 
 include(CheckCXXSourceCompiles)
 
-set(GCC_MIN 5.1)
+set(GCC_MIN 7.1)
 set(GCC_SOFT_ERROR 7.1)
-set(CLANG_MIN 3.5)
+set(CLANG_MIN 5.0)
 set(CLANG_SOFT_ERROR 5.0)
-set(APPLECLANG_MIN 6.0)
+set(APPLECLANG_MIN 9.3)
 set(APPLECLANG_SOFT_ERROR 9.3)
 
 # https://en.wikipedia.org/wiki/Microsoft_Visual_C#Internal_version_numbering
 # _MSC_VER == 1920 MSVC++ 14.20 Visual Studio 2019 Version 16.0
 # _MSC_VER == 1927 MSVC++ 14.27 Visual Studio 2019 Version 16.7
-set(MSVC_MIN 19.20)
+set(MSVC_MIN 19.27)
 set(MSVC_SOFT_ERROR 19.27)
 
 # Map the above GCC versions to dates: https://gcc.gnu.org/develop.html#timeline
-set(GCC_MIN_DATE 20150422)
+set(LIBSTDCXX_MIN 7)
 set(LIBSTDCXX_SOFT_ERROR 7)
 
 
@@ -79,20 +79,14 @@
 # Test for libstdc++ version of at least 4.8 by checking for _ZNKSt17bad_function_call4whatEv.
 # Note: We should check _GLIBCXX_RELEASE when possible (i.e., for GCC 7.1 and up).
 check_cxx_source_compiles("
-#include 
-#if defined(__GLIBCXX__)
-#if __GLIBCXX__ < ${GCC_MIN_DATE}
-#error Unsupported libstdc++ version
-#endif
-#endif
-#if defined(__GLIBCXX__)
-extern const char _ZNKSt17bad_function_call4whatEv[];
-const char *chk = _ZNKSt17bad_function_call4whatEv;
-#else
-const char *chk = \"\";
-#endif
-int main() { ++chk; return 0; }
-"
+  #include 
+  #if defined(__GLIBCXX__)
+  #if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < ${LIBSTDCXX_MIN}
+  #error Unsupported libstdc++ version
+  #endif
+  #endif
+  int main() { return 0; }
+  "
   LLVM_LIBSTDCXX_MIN)
 if(NOT LLVM_LIBSTDCXX_MIN)
   message(FATAL_ERROR "libstdc++ version must be at least ${GCC_MIN}.")
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -58,7 +58,7 @@
 # Must go after project(..)
 include(GNUInstallDirs)
 
-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
 set(CMAKE_CXX_STANDARD_REQUIRED YES)
 if (CYGWIN)
   # Cygwin is a bit stricter and lack things like 'strdup', 'stricmp', etc in
Index: lldb/CMakeLists.txt
===
--- 

[Lldb-commits] [PATCH] D130686: [LLDB][RISCV] Add DWARF Registers

2022-07-28 Thread Emmmer S via Phabricator via lldb-commits
Emmmer created this revision.
Emmmer added reviewers: craig.topper, MaskRay, DavidSpickett, labath.
Emmmer added a project: LLDB.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, 
frasercrmck, evandro, luismarques, apazos, sameer.abuasal, JDevlieghere, 
s.egerton, Jim, benna, psnobl, 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.
Emmmer requested review of this revision.
Herald added subscribers: lldb-commits, pcwang-thead, eopXD.

According to RISC-V DWARF Specification 

 add RISCV DWARF Registers.

Don't worry about the difference between riscv32 and riscv64, they just have 
different bytes of registers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130686

Files:
  lldb/source/Utility/RISCV_DWARF_Registers.h

Index: lldb/source/Utility/RISCV_DWARF_Registers.h
===
--- /dev/null
+++ lldb/source/Utility/RISCV_DWARF_Registers.h
@@ -0,0 +1,129 @@
+//===-- RISCV_DWARF_Registers.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 LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
+#define LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
+
+#include "lldb/lldb-private.h"
+
+namespace riscv_dwarf {
+
+enum {
+  dwarf_gpr_x0 = 0,
+  dwarf_gpr_x1,
+  dwarf_gpr_x2,
+  dwarf_gpr_x3,
+  dwarf_gpr_x4,
+  dwarf_gpr_x5,
+  dwarf_gpr_x6,
+  dwarf_gpr_x7,
+  dwarf_gpr_x8,
+  dwarf_gpr_x9,
+  dwarf_gpr_x10,
+  dwarf_gpr_x11,
+  dwarf_gpr_x12,
+  dwarf_gpr_x13,
+  dwarf_gpr_x14,
+  dwarf_gpr_x15,
+  dwarf_gpr_x16,
+  dwarf_gpr_x17,
+  dwarf_gpr_x18,
+  dwarf_gpr_x19,
+  dwarf_gpr_x20,
+  dwarf_gpr_x21,
+  dwarf_gpr_x22,
+  dwarf_gpr_x23,
+  dwarf_gpr_x24,
+  dwarf_gpr_x25,
+  dwarf_gpr_x26,
+  dwarf_gpr_x27,
+  dwarf_gpr_x28,
+  dwarf_gpr_x29,
+  dwarf_gpr_x30,
+  dwarf_gpr_x31 = 31,
+
+  dwarf_fpr_f0 = 32,
+  dwarf_fpr_f1,
+  dwarf_fpr_f2,
+  dwarf_fpr_f3,
+  dwarf_fpr_f4,
+  dwarf_fpr_f5,
+  dwarf_fpr_f6,
+  dwarf_fpr_f7,
+  dwarf_fpr_f8,
+  dwarf_fpr_f9,
+  dwarf_fpr_f10,
+  dwarf_fpr_f11,
+  dwarf_fpr_f12,
+  dwarf_fpr_f13,
+  dwarf_fpr_f14,
+  dwarf_fpr_f15,
+  dwarf_fpr_f16,
+  dwarf_fpr_f17,
+  dwarf_fpr_f18,
+  dwarf_fpr_f19,
+  dwarf_fpr_f20,
+  dwarf_fpr_f21,
+  dwarf_fpr_f22,
+  dwarf_fpr_f23,
+  dwarf_fpr_f24,
+  dwarf_fpr_f25,
+  dwarf_fpr_f26,
+  dwarf_fpr_f27,
+  dwarf_fpr_f28,
+  dwarf_fpr_f29,
+  dwarf_fpr_f30,
+  dwarf_fpr_f31 = 63,
+
+  dwarf_v0 = 96,
+  dwarf_v1,
+  dwarf_v2,
+  dwarf_v3,
+  dwarf_v4,
+  dwarf_v5,
+  dwarf_v6,
+  dwarf_v7,
+  dwarf_v8,
+  dwarf_v9,
+  dwarf_v10,
+  dwarf_v11,
+  dwarf_v12,
+  dwarf_v13,
+  dwarf_v14,
+  dwarf_v15,
+  dwarf_v16,
+  dwarf_v17,
+  dwarf_v18,
+  dwarf_v19,
+  dwarf_v20,
+  dwarf_v21,
+  dwarf_v22,
+  dwarf_v23,
+  dwarf_v24,
+  dwarf_v25,
+  dwarf_v26,
+  dwarf_v27,
+  dwarf_v28,
+  dwarf_v29,
+  dwarf_v30,
+  dwarf_v31 = 127,
+  dwarf_first_csr = 4096,
+  dwarf_last_csr = 8191,
+
+  // register name alias
+  dwarf_gpr_ra = dwarf_gpr_x1,
+  dwarf_gpr_sp = dwarf_gpr_x2,
+  dwarf_gpr_fp = dwarf_gpr_x8,
+
+  // mock pc regnum
+  dwarf_gpr_pc = UINT32_MAX,
+};
+
+} // namespace riscv_dwarf
+
+#endif // LLDB_SOURCE_UTILITY_RISCV_DWARF_REGISTERS_H
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits