[Lldb-commits] [PATCH] D158391: [lldb][debugserver] Fix build after libcxx removed generic char_traits implementation

2023-08-21 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Which was done in https://reviews.llvm.org/D157058. This follows the fix
for lldb-server in https://reviews.llvm.org/D157589.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158391

Files:
  lldb/tools/debugserver/source/RNBRemote.cpp


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -2585,7 +2585,7 @@
   // fail value. If it does, return this instead in case some of
   // the registers are not available on the current system.
   if (reg->nub_info.size > 0) {
-std::basic_string zeros(reg->nub_info.size, '\0');
+std::vector zeros(reg->nub_info.size, '\0');
 append_hex_value(ostrm, zeros.data(), zeros.size(), false);
   }
 }
@@ -4219,7 +4219,7 @@
 ostrm << "";
   } else if (reg_entry->nub_info.reg == (uint32_t)-1) {
 if (reg_entry->nub_info.size > 0) {
-  std::basic_string zeros(reg_entry->nub_info.size, '\0');
+  std::vector zeros(reg_entry->nub_info.size, '\0');
   append_hex_value(ostrm, zeros.data(), zeros.size(), false);
 }
   } else {


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -2585,7 +2585,7 @@
   // fail value. If it does, return this instead in case some of
   // the registers are not available on the current system.
   if (reg->nub_info.size > 0) {
-std::basic_string zeros(reg->nub_info.size, '\0');
+std::vector zeros(reg->nub_info.size, '\0');
 append_hex_value(ostrm, zeros.data(), zeros.size(), false);
   }
 }
@@ -4219,7 +4219,7 @@
 ostrm << "";
   } else if (reg_entry->nub_info.reg == (uint32_t)-1) {
 if (reg_entry->nub_info.size > 0) {
-  std::basic_string zeros(reg_entry->nub_info.size, '\0');
+  std::vector zeros(reg_entry->nub_info.size, '\0');
   append_hex_value(ostrm, zeros.data(), zeros.size(), false);
 }
   } else {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D158391: [lldb][debugserver] Fix build after libcxx removed generic char_traits implementation

2023-08-21 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo accepted this revision.
mstorsjo added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158391

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


[Lldb-commits] [lldb] 7549cde - [lldb][debugserver] Fix build after libcxx removed generic char_traits implementation

2023-08-21 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-08-21T07:50:03Z
New Revision: 7549cde6bd5243570da8480c8580674a30024a71

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

LOG: [lldb][debugserver] Fix build after libcxx removed generic char_traits 
implementation

Which was done in https://reviews.llvm.org/D157058. This follows the fix
for lldb-server in https://reviews.llvm.org/D157589.

Reviewed By: mstorsjo

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

Added: 


Modified: 
lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/RNBRemote.cpp 
b/lldb/tools/debugserver/source/RNBRemote.cpp
index 68ac61aab434df..ea039101bb541b 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -2585,7 +2585,7 @@ void register_value_in_hex_fixed_width(std::ostream 
&ostrm, nub_process_t pid,
   // fail value. If it does, return this instead in case some of
   // the registers are not available on the current system.
   if (reg->nub_info.size > 0) {
-std::basic_string zeros(reg->nub_info.size, '\0');
+std::vector zeros(reg->nub_info.size, '\0');
 append_hex_value(ostrm, zeros.data(), zeros.size(), false);
   }
 }
@@ -4219,7 +4219,7 @@ rnb_err_t RNBRemote::HandlePacket_p(const char *p) {
 ostrm << "";
   } else if (reg_entry->nub_info.reg == (uint32_t)-1) {
 if (reg_entry->nub_info.size > 0) {
-  std::basic_string zeros(reg_entry->nub_info.size, '\0');
+  std::vector zeros(reg_entry->nub_info.size, '\0');
   append_hex_value(ostrm, zeros.data(), zeros.size(), false);
 }
   } else {



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


[Lldb-commits] [PATCH] D158391: [lldb][debugserver] Fix build after libcxx removed generic char_traits implementation

2023-08-21 Thread David Spickett via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7549cde6bd52: [lldb][debugserver] Fix build after libcxx 
removed generic char_traits… (authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158391

Files:
  lldb/tools/debugserver/source/RNBRemote.cpp


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -2585,7 +2585,7 @@
   // fail value. If it does, return this instead in case some of
   // the registers are not available on the current system.
   if (reg->nub_info.size > 0) {
-std::basic_string zeros(reg->nub_info.size, '\0');
+std::vector zeros(reg->nub_info.size, '\0');
 append_hex_value(ostrm, zeros.data(), zeros.size(), false);
   }
 }
@@ -4219,7 +4219,7 @@
 ostrm << "";
   } else if (reg_entry->nub_info.reg == (uint32_t)-1) {
 if (reg_entry->nub_info.size > 0) {
-  std::basic_string zeros(reg_entry->nub_info.size, '\0');
+  std::vector zeros(reg_entry->nub_info.size, '\0');
   append_hex_value(ostrm, zeros.data(), zeros.size(), false);
 }
   } else {


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -2585,7 +2585,7 @@
   // fail value. If it does, return this instead in case some of
   // the registers are not available on the current system.
   if (reg->nub_info.size > 0) {
-std::basic_string zeros(reg->nub_info.size, '\0');
+std::vector zeros(reg->nub_info.size, '\0');
 append_hex_value(ostrm, zeros.data(), zeros.size(), false);
   }
 }
@@ -4219,7 +4219,7 @@
 ostrm << "";
   } else if (reg_entry->nub_info.reg == (uint32_t)-1) {
 if (reg_entry->nub_info.size > 0) {
-  std::basic_string zeros(reg_entry->nub_info.size, '\0');
+  std::vector zeros(reg_entry->nub_info.size, '\0');
   append_hex_value(ostrm, zeros.data(), zeros.size(), false);
 }
   } else {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D158391: [lldb][debugserver] Fix build after libcxx removed generic char_traits implementation

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

I was going to wait for some Mac specific reviewer too but it's simple and the 
Green Dragon bots should verify it well enough.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158391

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


[Lldb-commits] [PATCH] D158010: [lldb] Allow synthetic providers in C++ and fix linking problems

2023-08-21 Thread Lily Orth-Smith via Phabricator via lldb-commits
electriclilies added a comment.

@jingham Any other changes I should make? Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158010

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


[Lldb-commits] [lldb] 58fe7b7 - [lldb] Change UnixSignals::GetSignalAsCString to GetSignalAsStringRef

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

Author: Alex Langford
Date: 2023-08-21T12:44:17-07:00
New Revision: 58fe7b751dc4a611a013a7708c1c0cac159b5f1e

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

LOG: [lldb] Change UnixSignals::GetSignalAsCString to GetSignalAsStringRef

This is in preparation to remove the uses of ConstString from
UnixSignals.

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

Added: 


Modified: 
lldb/include/lldb/Target/UnixSignals.h
lldb/source/API/SBUnixSignals.cpp
lldb/source/Commands/CommandObjectProcess.cpp

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/StopInfo.cpp
lldb/source/Target/UnixSignals.cpp
lldb/unittests/Signals/UnixSignalsTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/UnixSignals.h 
b/lldb/include/lldb/Target/UnixSignals.h
index 7b6060b9343c82..550a56a00060f2 100644
--- a/lldb/include/lldb/Target/UnixSignals.h
+++ b/lldb/include/lldb/Target/UnixSignals.h
@@ -30,7 +30,7 @@ class UnixSignals {
 
   virtual ~UnixSignals();
 
-  const char *GetSignalAsCString(int32_t signo) const;
+  llvm::StringRef GetSignalAsStringRef(int32_t signo) const;
 
   std::string
   GetSignalDescription(int32_t signo,

diff  --git a/lldb/source/API/SBUnixSignals.cpp 
b/lldb/source/API/SBUnixSignals.cpp
index 7cccbaff1d2fe1..519881b186e45d 100644
--- a/lldb/source/API/SBUnixSignals.cpp
+++ b/lldb/source/API/SBUnixSignals.cpp
@@ -66,7 +66,7 @@ const char *SBUnixSignals::GetSignalAsCString(int32_t signo) 
const {
   LLDB_INSTRUMENT_VA(this, signo);
 
   if (auto signals_sp = GetSP())
-return ConstString(signals_sp->GetSignalAsCString(signo)).GetCString();
+return ConstString(signals_sp->GetSignalAsStringRef(signo)).GetCString();
 
   return nullptr;
 }

diff  --git a/lldb/source/Commands/CommandObjectProcess.cpp 
b/lldb/source/Commands/CommandObjectProcess.cpp
index ab047ee926c992..cbf2652dae1ef1 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -1178,7 +1178,7 @@ class CommandObjectProcessSignal : public 
CommandObjectParsed {
 UnixSignalsSP signals = m_exe_ctx.GetProcessPtr()->GetUnixSignals();
 int signo = signals->GetFirstSignalNumber();
 while (signo != LLDB_INVALID_SIGNAL_NUMBER) {
-  request.TryCompleteCurrentArg(signals->GetSignalAsCString(signo));
+  request.TryCompleteCurrentArg(signals->GetSignalAsStringRef(signo));
   signo = signals->GetNextSignalNumber(signo);
 }
   }
@@ -1635,13 +1635,13 @@ class CommandObjectProcessHandle : public 
CommandObjectParsed {
 str.Printf("===  =  =  ==\n");
   }
 
-  void PrintSignal(Stream &str, int32_t signo, const char *sig_name,
+  void PrintSignal(Stream &str, int32_t signo, llvm::StringRef sig_name,
const UnixSignalsSP &signals_sp) {
 bool stop;
 bool suppress;
 bool notify;
 
-str.Printf("%-11s  ", sig_name);
+str.Format("{0, -11}  ", sig_name);
 if (signals_sp->GetSignalInfo(signo, suppress, stop, notify)) {
   bool pass = !suppress;
   str.Printf("%s  %s  %s", (pass ? "true " : "false"),
@@ -1668,7 +1668,7 @@ class CommandObjectProcessHandle : public 
CommandObjectParsed {
 {
   int32_t signo = signals_sp->GetFirstSignalNumber();
   while (signo != LLDB_INVALID_SIGNAL_NUMBER) {
-PrintSignal(str, signo, signals_sp->GetSignalAsCString(signo),
+PrintSignal(str, signo, signals_sp->GetSignalAsStringRef(signo),
 signals_sp);
 signo = signals_sp->GetNextSignalNumber(signo);
   }

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index 4ffa7faa49424d..391abdae27525f 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -500,7 +500,7 @@ GDBRemoteCommunicationServerPlatform::Handle_jSignalsInfo(
 auto dictionary = std::make_shared();
 
 dictionary->AddIntegerItem("signo", signo);
-dictionary->AddStringItem("name", signals->GetSignalAsCString(signo));
+dictionary->AddStringItem("name", signals->GetSignalAsStringRef(signo));
 
 bool suppress, stop, notify;
 signals->GetSignalInfo(signo, suppress, stop, notify);

diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 68c343903f3dc8..5391187a75a7a2 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/l

[Lldb-commits] [PATCH] D158209: [lldb] Change UnixSignals::GetSignalAsCString to GetSignalAsStringRef

2023-08-21 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG58fe7b751dc4: [lldb] Change UnixSignals::GetSignalAsCString 
to GetSignalAsStringRef (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158209

Files:
  lldb/include/lldb/Target/UnixSignals.h
  lldb/source/API/SBUnixSignals.cpp
  lldb/source/Commands/CommandObjectProcess.cpp
  
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/StopInfo.cpp
  lldb/source/Target/UnixSignals.cpp
  lldb/unittests/Signals/UnixSignalsTest.cpp

Index: lldb/unittests/Signals/UnixSignalsTest.cpp
===
--- lldb/unittests/Signals/UnixSignalsTest.cpp
+++ lldb/unittests/Signals/UnixSignalsTest.cpp
@@ -84,7 +84,7 @@
 
   bool should_suppress = false, should_stop = false, should_notify = false;
   int32_t signo = 4;
-  std::string name =
+  llvm::StringRef name =
   signals.GetSignalInfo(signo, should_suppress, should_stop, should_notify);
   EXPECT_EQ("SIG4", name);
   EXPECT_EQ(true, should_suppress);
@@ -94,15 +94,14 @@
   EXPECT_EQ(true, signals.GetShouldSuppress(signo));
   EXPECT_EQ(false, signals.GetShouldStop(signo));
   EXPECT_EQ(true, signals.GetShouldNotify(signo));
-  EXPECT_EQ(name, signals.GetSignalAsCString(signo));
+  EXPECT_EQ(name, signals.GetSignalAsStringRef(signo));
 }
 
-TEST(UnixSignalsTest, GetAsCString) {
+TEST(UnixSignalsTest, GetAsStringRef) {
   TestSignals signals;
 
-  ASSERT_EQ(nullptr, signals.GetSignalAsCString(100));
-  std::string name = signals.GetSignalAsCString(16);
-  ASSERT_EQ("SIG16", name);
+  ASSERT_EQ(llvm::StringRef(), signals.GetSignalAsStringRef(100));
+  ASSERT_EQ("SIG16", signals.GetSignalAsStringRef(16));
 }
 
 TEST(UnixSignalsTest, GetAsString) {
Index: lldb/source/Target/UnixSignals.cpp
===
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -131,12 +131,11 @@
   ++m_version;
 }
 
-const char *UnixSignals::GetSignalAsCString(int signo) const {
-  collection::const_iterator pos = m_signals.find(signo);
+llvm::StringRef UnixSignals::GetSignalAsStringRef(int32_t signo) const {
+  const auto pos = m_signals.find(signo);
   if (pos == m_signals.end())
-return nullptr;
-  else
-return pos->second.m_name.GetCString();
+return {};
+  return pos->second.m_name.GetStringRef();
 }
 
 std::string
Index: lldb/source/Target/StopInfo.cpp
===
--- lldb/source/Target/StopInfo.cpp
+++ lldb/source/Target/StopInfo.cpp
@@ -1067,9 +1067,9 @@
   thread_sp->GetProcess()->GetUnixSignals()->GetShouldNotify(m_value);
   if (should_notify) {
 StreamString strm;
-strm.Printf(
-"thread %d received signal: %s", thread_sp->GetIndexID(),
-thread_sp->GetProcess()->GetUnixSignals()->GetSignalAsCString(
+strm.Format(
+"thread {0:d} received signal: {1}", thread_sp->GetIndexID(),
+thread_sp->GetProcess()->GetUnixSignals()->GetSignalAsStringRef(
 m_value));
 Process::ProcessEventData::AddRestartedReason(event_ptr,
   strm.GetData());
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -1125,11 +1125,9 @@
 if (target_sp) {
   ProcessSP process_sp(target_sp->GetProcessSP());
   if (process_sp) {
-const char *signal_cstr = nullptr;
-if (signo)
-  signal_cstr = process_sp->GetUnixSignals()->GetSignalAsCString(signo);
-
-process_sp->SetExitStatus(exit_status, signal_cstr);
+llvm::StringRef signal_str =
+process_sp->GetUnixSignals()->GetSignalAsStringRef(signo);
+process_sp->SetExitStatus(exit_status, signal_str);
   }
 }
 return true;
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3384,10 +3384,10 @@
   stream.Format(DEBUGSERVER_BASENAME " died with an exit status of {0:x8}",
 exit_status);
 else {
-  const char *signal_name =
-  process_sp->GetUnixSignals()->GetSignalAsCString(signo);
+  llvm::StringRef signal_name =
+  process_sp->GetUnixSignals()->GetSignalAsStringRef(signo);
   const char *format_str = DEBUGSERVER_BASENAME " died with signal {0}";
-  if (signal_name)
+  if (!signal_name.empty())
 stream.Fo

[Lldb-commits] [PATCH] D158452: [lldb/crashlog] Fix python version requirement issue

2023-08-21 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib created this revision.
mib added reviewers: JDevlieghere, kastiglione, bulbazord.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

In 21a597c 
, we fixed 
a module loading issue by using the new
`argparse.BooleanOptionalAction`. However, this is only available
starting python 3.9 and causes test failures on bots that don't fulfill
this requirement.

To address that, this patch replaces the use of `BooleanOptionalAction`
by a pair of 2 opposite `store` actions pointing to the same destination
variable.

Signed-off-by: Med Ismail Bennani 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158452

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -1603,14 +1603,29 @@
 help="pause for NSEC seconds for debugger",
 default=0,
 )
+# NOTE: Requires python 3.9
+# arg_parser.add_argument(
+# "--crashed-only",
+# "-c",
+# action=argparse.BooleanOptionalAction,
+# dest="crashed_only",
+# help="only symbolicate the crashed thread",
+# default=True,
+# )
 arg_parser.add_argument(
 "--crashed-only",
 "-c",
-action=argparse.BooleanOptionalAction,
+action="store_true",
 dest="crashed_only",
 help="only symbolicate the crashed thread",
 default=True,
 )
+arg_parser.add_argument(
+"--no-crashed-only",
+action="store_false",
+dest="crashed_only",
+help="do not symbolicate the crashed thread",
+)
 arg_parser.add_argument(
 "--disasm-depth",
 "-d",


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -1603,14 +1603,29 @@
 help="pause for NSEC seconds for debugger",
 default=0,
 )
+# NOTE: Requires python 3.9
+# arg_parser.add_argument(
+# "--crashed-only",
+# "-c",
+# action=argparse.BooleanOptionalAction,
+# dest="crashed_only",
+# help="only symbolicate the crashed thread",
+# default=True,
+# )
 arg_parser.add_argument(
 "--crashed-only",
 "-c",
-action=argparse.BooleanOptionalAction,
+action="store_true",
 dest="crashed_only",
 help="only symbolicate the crashed thread",
 default=True,
 )
+arg_parser.add_argument(
+"--no-crashed-only",
+action="store_false",
+dest="crashed_only",
+help="do not symbolicate the crashed thread",
+)
 arg_parser.add_argument(
 "--disasm-depth",
 "-d",
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D158452: [lldb/crashlog] Fix python version requirement issue

2023-08-21 Thread Alex Langford via Phabricator via lldb-commits
bulbazord accepted this revision.
bulbazord added a comment.
This revision is now accepted and ready to land.

Unfortunate but it makes the most sense for now. Thanks for fixing that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158452

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


[Lldb-commits] [lldb] 446abb5 - [lldb/crashlog] Fix python version requirement issue

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

Author: Med Ismail Bennani
Date: 2023-08-21T21:52:44+01:00
New Revision: 446abb5125f76423232e5d4d3ed116cccfbd8b99

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

LOG: [lldb/crashlog] Fix python version requirement issue

In 21a597c, we fixed a module loading issue by using the new
`argparse.BooleanOptionalAction`. However, this is only available
starting python 3.9 and causes test failures on bots that don't fulfill
this requirement.

To address that, this patch replaces the use of `BooleanOptionalAction`
by a pair of 2 opposite `store` actions pointing to the same destination
variable.

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/examples/python/crashlog.py

Removed: 




diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index efef43045f9c60..cb8008419404c2 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -1603,14 +1603,29 @@ def CreateSymbolicateCrashLogOptions(
 help="pause for NSEC seconds for debugger",
 default=0,
 )
+# NOTE: Requires python 3.9
+# arg_parser.add_argument(
+# "--crashed-only",
+# "-c",
+# action=argparse.BooleanOptionalAction,
+# dest="crashed_only",
+# help="only symbolicate the crashed thread",
+# default=True,
+# )
 arg_parser.add_argument(
 "--crashed-only",
 "-c",
-action=argparse.BooleanOptionalAction,
+action="store_true",
 dest="crashed_only",
 help="only symbolicate the crashed thread",
 default=True,
 )
+arg_parser.add_argument(
+"--no-crashed-only",
+action="store_false",
+dest="crashed_only",
+help="do not symbolicate the crashed thread",
+)
 arg_parser.add_argument(
 "--disasm-depth",
 "-d",



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


[Lldb-commits] [PATCH] D158452: [lldb/crashlog] Fix python version requirement issue

2023-08-21 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG446abb5125f7: [lldb/crashlog] Fix python version requirement 
issue (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158452

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -1603,14 +1603,29 @@
 help="pause for NSEC seconds for debugger",
 default=0,
 )
+# NOTE: Requires python 3.9
+# arg_parser.add_argument(
+# "--crashed-only",
+# "-c",
+# action=argparse.BooleanOptionalAction,
+# dest="crashed_only",
+# help="only symbolicate the crashed thread",
+# default=True,
+# )
 arg_parser.add_argument(
 "--crashed-only",
 "-c",
-action=argparse.BooleanOptionalAction,
+action="store_true",
 dest="crashed_only",
 help="only symbolicate the crashed thread",
 default=True,
 )
+arg_parser.add_argument(
+"--no-crashed-only",
+action="store_false",
+dest="crashed_only",
+help="do not symbolicate the crashed thread",
+)
 arg_parser.add_argument(
 "--disasm-depth",
 "-d",


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -1603,14 +1603,29 @@
 help="pause for NSEC seconds for debugger",
 default=0,
 )
+# NOTE: Requires python 3.9
+# arg_parser.add_argument(
+# "--crashed-only",
+# "-c",
+# action=argparse.BooleanOptionalAction,
+# dest="crashed_only",
+# help="only symbolicate the crashed thread",
+# default=True,
+# )
 arg_parser.add_argument(
 "--crashed-only",
 "-c",
-action=argparse.BooleanOptionalAction,
+action="store_true",
 dest="crashed_only",
 help="only symbolicate the crashed thread",
 default=True,
 )
+arg_parser.add_argument(
+"--no-crashed-only",
+action="store_false",
+dest="crashed_only",
+help="do not symbolicate the crashed thread",
+)
 arg_parser.add_argument(
 "--disasm-depth",
 "-d",
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D158457: [lldb][NFCI] Change return type of UnixSignals::GetSignalInfo

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

There's no reason for GetSignalInfo to return the signal name. All users
of this method only use the return value to determine if the method
succeeded in filling in the output parameters, so let's explicitly make
it a bool instead of a pointer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158457

Files:
  lldb/include/lldb/Target/UnixSignals.h
  lldb/source/Target/UnixSignals.cpp
  lldb/unittests/Signals/UnixSignalsTest.cpp


Index: lldb/unittests/Signals/UnixSignalsTest.cpp
===
--- lldb/unittests/Signals/UnixSignalsTest.cpp
+++ lldb/unittests/Signals/UnixSignalsTest.cpp
@@ -84,9 +84,9 @@
 
   bool should_suppress = false, should_stop = false, should_notify = false;
   int32_t signo = 4;
-  llvm::StringRef name =
+  bool success =
   signals.GetSignalInfo(signo, should_suppress, should_stop, 
should_notify);
-  EXPECT_EQ("SIG4", name);
+  ASSERT_TRUE(success);
   EXPECT_EQ(true, should_suppress);
   EXPECT_EQ(false, should_stop);
   EXPECT_EQ(true, should_notify);
@@ -94,7 +94,6 @@
   EXPECT_EQ(true, signals.GetShouldSuppress(signo));
   EXPECT_EQ(false, signals.GetShouldStop(signo));
   EXPECT_EQ(true, signals.GetShouldNotify(signo));
-  EXPECT_EQ(name, signals.GetSignalAsStringRef(signo));
 }
 
 TEST(UnixSignalsTest, GetAsStringRef) {
Index: lldb/source/Target/UnixSignals.cpp
===
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -237,19 +237,17 @@
   }
 }
 
-const char *UnixSignals::GetSignalInfo(int32_t signo, bool &should_suppress,
-   bool &should_stop,
-   bool &should_notify) const {
-  collection::const_iterator pos = m_signals.find(signo);
+bool UnixSignals::GetSignalInfo(int32_t signo, bool &should_suppress,
+bool &should_stop, bool &should_notify) const {
+  const auto pos = m_signals.find(signo);
   if (pos == m_signals.end())
-return nullptr;
-  else {
-const Signal &signal = pos->second;
-should_suppress = signal.m_suppress;
-should_stop = signal.m_stop;
-should_notify = signal.m_notify;
-return signal.m_name.AsCString("");
-  }
+return false;
+
+  const Signal &signal = pos->second;
+  should_suppress = signal.m_suppress;
+  should_stop = signal.m_stop;
+  should_notify = signal.m_notify;
+  return true;
 }
 
 bool UnixSignals::GetShouldSuppress(int signo) const {
Index: lldb/include/lldb/Target/UnixSignals.h
===
--- lldb/include/lldb/Target/UnixSignals.h
+++ lldb/include/lldb/Target/UnixSignals.h
@@ -43,8 +43,26 @@
 
   int32_t GetSignalNumberFromName(const char *name) const;
 
-  const char *GetSignalInfo(int32_t signo, bool &should_suppress,
-bool &should_stop, bool &should_notify) const;
+  /// Gets the information for a particular signal
+  ///
+  /// GetSignalInfo takes a signal number and populates 3 out parameters
+  /// describing how lldb should react when a particular signal is received in
+  /// the inferior.
+  ///
+  /// \param[in] signo
+  ///   The signal number to get information about.
+  /// \param[out] should_suppress
+  ///   Should we suppress this signal?
+  /// \param[out] should_stop
+  ///   Should we stop if this signal is received?
+  /// \param[out] should_notify
+  ///   Should we notify the user if this signal is received?
+  ///
+  /// \return
+  ///   Returns a boolean value. Returns true if the out parameters were
+  ///   successfully populated, false otherwise.
+  bool GetSignalInfo(int32_t signo, bool &should_suppress, bool &should_stop,
+ bool &should_notify) const;
 
   bool GetShouldSuppress(int32_t signo) const;
 


Index: lldb/unittests/Signals/UnixSignalsTest.cpp
===
--- lldb/unittests/Signals/UnixSignalsTest.cpp
+++ lldb/unittests/Signals/UnixSignalsTest.cpp
@@ -84,9 +84,9 @@
 
   bool should_suppress = false, should_stop = false, should_notify = false;
   int32_t signo = 4;
-  llvm::StringRef name =
+  bool success =
   signals.GetSignalInfo(signo, should_suppress, should_stop, should_notify);
-  EXPECT_EQ("SIG4", name);
+  ASSERT_TRUE(success);
   EXPECT_EQ(true, should_suppress);
   EXPECT_EQ(false, should_stop);
   EXPECT_EQ(true, should_notify);
@@ -94,7 +94,6 @@
   EXPECT_EQ(true, signals.GetShouldSuppress(signo));
   EXPECT_EQ(false, signals.GetShouldStop(signo));
   EXPECT_EQ(true, signals.GetShouldNotify(signo));
-  EXPECT_EQ(name, signals.GetSignalAsStringRef(signo));
 }
 
 TEST(UnixSignalsTest, GetAsString

[Lldb-commits] [PATCH] D158467: [lldb] Link back to the LLVM Project and Developer Policy from the docs

2023-08-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, tonic.
Herald added a subscriber: arphaman.
Herald added a project: All.
JDevlieghere requested review of this revision.

Add backlinks to the LLVM Project and the LLVM Developer Policy from the docs. 
As suggested by Tanya in 
https://discourse.llvm.org/t/rfc-revamping-lldbs-website/72899.


https://reviews.llvm.org/D158467

Files:
  lldb/docs/index.rst


Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -6,8 +6,9 @@
 Welcome to the LLDB documentation!
 
 LLDB is a next generation, high-performance debugger. It is built as a set of
-reusable components which highly leverage existing libraries in the larger LLVM
-Project, such as the Clang expression parser and LLVM disassembler.
+reusable components which highly leverage existing libraries in the larger
+`LLVM Project `_, such as the Clang expression parser and
+LLVM disassembler.
 
 LLDB is the default debugger in Xcode on macOS and supports debugging C,
 Objective-C and C++ on the desktop and iOS devices and simulator.
@@ -163,5 +164,6 @@
Source Code 
Releases 
Discussion Forums 
+   Developer Policy 
Bug Reports 
Code Reviews 


Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -6,8 +6,9 @@
 Welcome to the LLDB documentation!
 
 LLDB is a next generation, high-performance debugger. It is built as a set of
-reusable components which highly leverage existing libraries in the larger LLVM
-Project, such as the Clang expression parser and LLVM disassembler.
+reusable components which highly leverage existing libraries in the larger
+`LLVM Project `_, such as the Clang expression parser and
+LLVM disassembler.
 
 LLDB is the default debugger in Xcode on macOS and supports debugging C,
 Objective-C and C++ on the desktop and iOS devices and simulator.
@@ -163,5 +164,6 @@
Source Code 
Releases 
Discussion Forums 
+   Developer Policy 
Bug Reports 
Code Reviews 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D158457: [lldb][NFCI] Change return type of UnixSignals::GetSignalInfo

2023-08-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158457

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


[Lldb-commits] [PATCH] D158470: [lldb] Add support for recognizing swift mangled names

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

Apple maintains a downstream fork of lldb in order to support swift
debugging. Much of that support is isolated to its own plugins, but some
of it is exposed in more generic code. I would like to take some of
the swift support we have downstream and move it upstream to llvm.org in
an effort to 1) reduce downstream maintenance burden, and 2) work
towards solidifying the process of adding new language suppor to llvm.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158470

Files:
  lldb/include/lldb/Core/Mangled.h
  lldb/source/Core/Mangled.cpp
  lldb/unittests/Core/MangledTest.cpp


Index: lldb/unittests/Core/MangledTest.cpp
===
--- lldb/unittests/Core/MangledTest.cpp
+++ lldb/unittests/Core/MangledTest.cpp
@@ -89,6 +89,24 @@
   EXPECT_STREQ("", the_demangled.GetCString());
 }
 
+TEST(MangledTest, RecognizeSwiftMangledNames) {
+  llvm::StringRef valid_swift_mangled_names[] = {
+  "_TtC4main7MyClass",   // Mangled objc class name
+  "_TtP4main3Foo_",  // Mangld objc protocol name
+  "$s4main3BarCACycfC",  // Mangled name
+  "_$s4main3BarCACycfC", // Mangled name with leading underscore
+  "$S4main3BarCACycfC",  // Older swift mangled name
+  "_$S4main3BarCACycfC", // Older swift mangled name
+ // with leading underscore
+  // Mangled swift filename
+  "@__swiftmacro_4main16FunVariableNames9OptionSetfMm_.swift",
+  };
+
+  for (llvm::StringRef mangled : valid_swift_mangled_names)
+EXPECT_EQ(Mangled::GetManglingScheme(mangled),
+  Mangled::eManglingSchemeSwift);
+}
+
 TEST(MangledTest, BoolConversionOperator) {
   {
 ConstString MangledName("_ZN1a1b1cIiiiEEvm");
Index: lldb/source/Core/Mangled.cpp
===
--- lldb/source/Core/Mangled.cpp
+++ lldb/source/Core/Mangled.cpp
@@ -58,6 +58,24 @@
   if (name.startswith("___Z"))
 return Mangled::eManglingSchemeItanium;
 
+  // Swift's older style of mangling used "_T" as a mangling prefix. This can
+  // lead to false positives with other symbols that just so happen to start
+  // with "_T". To minimize the chance of that happening, we only return true
+  // for select old-style swift mangled names. The known cases are ObjC classes
+  // and protocols. Classes are either prefixed with "_TtC" or "_TtGC".
+  // Protocols are prefixed with "_TtP".
+  if (name.startswith("_TtC") || name.startswith("_TtGC") ||
+  name.startswith("_TtP"))
+return Mangled::eManglingSchemeSwift;
+
+  // Swift 4.2 used "$S" and "_$S".
+  // Swift 5 and onward uses "$s" and "_$s".
+  // Swift also uses "@__swiftmacro_" as a prefix for mangling filenames.
+  if (name.startswith("$S") || name.startswith("_$S") ||
+  name.startswith("$s") || name.startswith("_$s") ||
+  name.startswith("@__swiftmacro_"))
+return Mangled::eManglingSchemeSwift;
+
   return Mangled::eManglingSchemeNone;
 }
 
@@ -228,6 +246,7 @@
 
   case eManglingSchemeRustV0:
   case eManglingSchemeD:
+  case eManglingSchemeSwift:
 // Rich demangling scheme is not supported
 return false;
   }
@@ -265,6 +284,10 @@
   case eManglingSchemeD:
 demangled_name = GetDLangDemangledStr(m_mangled);
 break;
+  case eManglingSchemeSwift:
+// Demangling a swift name requires the swift compiler. This is
+// explicitly unsupported on llvm.org.
+break;
   case eManglingSchemeNone:
 llvm_unreachable("eManglingSchemeNone was handled already");
   }
Index: lldb/include/lldb/Core/Mangled.h
===
--- lldb/include/lldb/Core/Mangled.h
+++ lldb/include/lldb/Core/Mangled.h
@@ -43,7 +43,8 @@
 eManglingSchemeMSVC,
 eManglingSchemeItanium,
 eManglingSchemeRustV0,
-eManglingSchemeD
+eManglingSchemeD,
+eManglingSchemeSwift,
   };
 
   /// Default constructor.


Index: lldb/unittests/Core/MangledTest.cpp
===
--- lldb/unittests/Core/MangledTest.cpp
+++ lldb/unittests/Core/MangledTest.cpp
@@ -89,6 +89,24 @@
   EXPECT_STREQ("", the_demangled.GetCString());
 }
 
+TEST(MangledTest, RecognizeSwiftMangledNames) {
+  llvm::StringRef valid_swift_mangled_names[] = {
+  "_TtC4main7MyClass",   // Mangled objc class name
+  "_TtP4main3Foo_",  // Mangld objc protocol name
+  "$s4main3BarCACycfC",  // Mangled name
+  "_$s4main3BarCACycfC", // Mangled name with leading underscore
+  "$S4main3BarCACycfC",  // Older swift mangled name
+  "_$S4main3BarCACycfC", // Older swift mangled name
+   

[Lldb-commits] [PATCH] D158470: [lldb] Add support for recognizing swift mangled names

2023-08-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Given support for other languages like Rust and D, I think this is reasonable. 
LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158470

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