Re: [Lldb-commits] [lldb] 3bea730 - [lldb] Fix compilation with gcc-6.5

2021-06-16 Thread Chandler Carruth via lldb-commits
On Tue, Jun 15, 2021 at 4:29 PM Tom Stellard  wrote:

> On 6/15/21 4:28 PM, Chandler Carruth wrote:
> > +Tom Stellard  - Could this get
> cherry-picked into 12.0.N for the next point release? Without it, LLDB in
> the 12 release doesn't build with GCC <= 6.5 which the docs indicate is
> supposed to work.
> >
>
> Can you file a bug for this?
>

Sure https://bugs.llvm.org/show_bug.cgi?id=50732

>
> -Tom
>
> > On Wed, Mar 31, 2021 at 11:45 PM Pavel Labath via lldb-commits <
> lldb-commits@lists.llvm.org > wrote:
> >
> >
> > Author: Pavel Labath
> > Date: 2021-04-01T08:44:50+02:00
> > New Revision: 3bea7306e8669f94bacafae68748a9139cfc0b98
> >
> > URL:
> https://github.com/llvm/llvm-project/commit/3bea7306e8669f94bacafae68748a9139cfc0b98
> <
> https://github.com/llvm/llvm-project/commit/3bea7306e8669f94bacafae68748a9139cfc0b98
> >
> > DIFF:
> https://github.com/llvm/llvm-project/commit/3bea7306e8669f94bacafae68748a9139cfc0b98.diff
> <
> https://github.com/llvm/llvm-project/commit/3bea7306e8669f94bacafae68748a9139cfc0b98.diff
> >
> >
> > LOG: [lldb] Fix compilation with gcc-6.5
> >
> > This fixes (works around) two errors with gcc-6.5.
> > - in the RegisterContext_x86 files, gcc is unable to synthesize a
> >default constructor -- it thinks it needs to initialize the
> virtual
> >base class, even though said classes are abstract. I fix that by
> >providing a dummy constructor.
> > - In ReproducerInstrumentationTest, it is not able to deduce that the
> >TestingRegistry class is movable (it contains a map of unique
> >pointers). I change the type from Optional to
> >unique_ptr >(copying/moving a polymorphic type is not a very good idea in any
> >case).
> >
> > Added:
> >
> >
> > Modified:
> >  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
> >
> lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
> >
> lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
> >  lldb/unittests/Utility/ReproducerInstrumentationTest.cpp
> >
> > Removed:
> >
> >
> >
> >
>  
> 
> > diff  --git
> a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
> b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
> > index dfd0106837853..7d5ea575269dc 100644
> > --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
> > +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
> > @@ -58,6 +58,12 @@ class NativeRegisterContextLinux
> > virtual llvm::Optional GetMmapData() { return
> llvm::None; }
> >
> >   protected:
> > +  // NB: This constructor is here only because gcc<=6.5 requires a
> virtual base
> > +  // class initializer on abstract class (even though it is never
> used). It can
> > +  // be deleted once we move to gcc>=7.0.
> > +  NativeRegisterContextLinux(NativeThreadProtocol &thread)
> > +  : NativeRegisterContextRegisterInfo(thread, nullptr) {}
> > +
> > lldb::ByteOrder GetByteOrder() const;
> >
> > virtual Status ReadRegisterRaw(uint32_t reg_index, RegisterValue
> ®_value);
> >
> > diff  --git
> a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
> b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
> > index c197d70825b4b..bd4b168f4964e 100644
> > ---
> a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
> > +++
> b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
> > @@ -292,6 +292,8 @@
> NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64(
> >   const ArchSpec &target_arch, NativeThreadProtocol
> &native_thread)
> >   : NativeRegisterContextRegisterInfo(
> > native_thread, CreateRegisterInfoInterface(target_arch)),
> > +  NativeRegisterContextLinux(native_thread),
> > +  NativeRegisterContextDBReg_x86(native_thread),
> > m_xstate_type(XStateType::Invalid), m_ymm_set(), m_mpx_set(),
> > m_reg_info(), m_gpr_x86_64() {
> > // Set up data about ranges of valid registers.
> >
> > diff  --git
> a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
> b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
> > index c0c6ce29eab53..a4ed8bfb97eaf 100644
> > ---
> a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
> > +++
> b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
> > @@ -16,6 +16,12 @@ namespace lldb_private {
> >   class NativeRegisterContextDBReg_x86
> >   : public virtual NativeRegisterContextRegisterInfo {
> >   public:
> > +  // NB: This constructor is here only because gcc<=

[Lldb-commits] [lldb] 3b7795a - [lldb] vwprintw -> vw_printw in IOHandlerCursesGUI

2021-06-16 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-06-16T13:14:08+02:00
New Revision: 3b7795aeceb153b04493c5ba93e707e39afbe41f

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

LOG: [lldb] vwprintw -> vw_printw in IOHandlerCursesGUI

`vwprintw` is (in theory) using the `arargs.h` va_list while `vw_printw` is
using the `stdarg.h` va_list. It seems these days they can be used
interchangeably but `vwprintw` is marked as deprecated.

Added: 


Modified: 
lldb/source/Core/IOHandlerCursesGUI.cpp

Removed: 




diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 3aa1b21ee5c4d..bd29d280c53f7 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -461,7 +461,7 @@ class Window {
   void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))) {
 va_list args;
 va_start(args, format);
-vwprintw(m_window, format, args);
+vw_printw(m_window, format, args);
 va_end(args);
   }
 



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


[Lldb-commits] [lldb] 59d5886 - [lldb] Require Clang 8 for gpubnames test

2021-06-16 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-06-16T14:07:03+02:00
New Revision: 59d58863bc0ea72a396aa9b08a7a5cb3f29e75b6

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

LOG: [lldb] Require Clang 8 for gpubnames test

This test is using -gpubnames which is only available since Clang 8. The
original Clang 7 requirement was based on the availability of
-accel-tables=Dwarf (which the test initially used before being changed to
-gpubnames in commit 15a6df52efaa7 ).

Added: 


Modified: 
lldb/test/API/lang/c/forward/TestForwardDeclaration.py

Removed: 




diff  --git a/lldb/test/API/lang/c/forward/TestForwardDeclaration.py 
b/lldb/test/API/lang/c/forward/TestForwardDeclaration.py
index f8f8a46d8a299..3dc3acee34b9a 100644
--- a/lldb/test/API/lang/c/forward/TestForwardDeclaration.py
+++ b/lldb/test/API/lang/c/forward/TestForwardDeclaration.py
@@ -58,7 +58,7 @@ def test(self):
 @no_debug_info_test
 @skipIfDarwin
 @skipIf(compiler=no_match("clang"))
-@skipIf(compiler_version=["<", "7.0"])
+@skipIf(compiler_version=["<", "8.0"])
 @expectedFailureAll(oslist=["windows"])
 def test_debug_names(self):
 """Test that we are able to find complete types when using DWARF v5



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


[Lldb-commits] [PATCH] D101361: [LLDB] Support AArch64/Linux watchpoint on tagged addresses

2021-06-16 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

Since you landed the underlying ABI patch, looking at this again.

Seems like no comments on the BSD side, in which case to be safe we could just 
have the default `FixWatchpointHitAddress` make no changes. Then remove TBI and 
PAC for AArch64 Linux, no surprises that way.

Also should the test case include signing the pointer? Though it is a shame to 
limit it to only systems with PAC, it is part of what we're testing for so I 
think it should be included.
(I looked at the nop space instructions but they're only for signing 
instruction pointers)


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

https://reviews.llvm.org/D101361

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


[Lldb-commits] [PATCH] D104379: [lldb] Remove redundant calls to set eReturnStatusFailed

2021-06-16 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Since https://reviews.llvm.org/D103701 AppendError<...>
sets this for you.

This change includes all of the non-command uses.

Some uses remain where it's either tricky to reason about
the logic, or they aren't paired with AppendError calls.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104379

Files:
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/Breakpoint/BreakpointIDList.cpp
  lldb/source/Interpreter/CommandAlias.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Interpreter/Options.cpp
  lldb/source/Interpreter/ScriptInterpreter.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp

Index: lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
===
--- lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -809,7 +809,6 @@
StructuredDataDarwinLog::GetStaticPluginName())) {
   result.AppendError("failed to get StructuredDataPlugin for "
  "the process");
-  result.SetStatus(eReturnStatusFailed);
 }
 StructuredDataDarwinLog &plugin =
 *static_cast(plugin_sp.get());
@@ -833,7 +832,6 @@
 // Report results.
 if (!error.Success()) {
   result.AppendError(error.AsCString());
-  result.SetStatus(eReturnStatusFailed);
   // Our configuration failed, so we're definitely disabled.
   plugin.SetEnabled(false);
 } else {
Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -880,7 +880,6 @@
 if (argc > 0) {
   result.AppendErrorWithFormat("'%s' take no arguments, only options",
m_cmd_name.c_str());
-  result.SetStatus(eReturnStatusFailed);
   return false;
 }
 SetDefaultOptionsIfNoneAreSet();
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
@@ -5246,7 +5246,6 @@
"amount to be transferred when "
"reading/writing",
m_cmd_name.c_str());
-  result.SetStatus(eReturnStatusFailed);
   return false;
 }
 
@@ -5287,7 +5286,6 @@
   result.AppendErrorWithFormat(
   "'%s' takes a one or more packet content arguments",
   m_cmd_name.c_str());
-  result.SetStatus(eReturnStatusFailed);
   return false;
 }
 
@@ -5337,7 +5335,6 @@
 if (command.empty()) {
   result.AppendErrorWithFormat("'%s' takes a command string argument",
m_cmd_name.c_str());
-  result.SetStatus(eReturnStatusFailed);
   return false;
 }
 
Index: lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
===
--- lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -910,7 +910,6 @@
   if (!m_command_byte.GetOptionValue().OptionWasSet()) {
 result.AppendError(
 "the --command option must be set to a valid command byte");
-result.SetStatus(eReturnStatusFailed);
   } else {
 const uint64_t command_byte =
 m_command_byte.GetOptionValue().GetUInt64Value(0);
@@ -933,7 +932,6 @@
"even number of ASCII hex "
"characters: '%s'",
ascii_hex_bytes_cstr);
-  result.SetStatus(eReturnStatusFailed);
   return false;
 }
 payload_bytes.resize(ascii_hex_bytes_cstr_len / 2);
@@ -943,7 +941,6 @@
"ASCII hex characters (no "
"spaces or hex prefixes): '%s'",
ascii_hex_bytes_cstr);
-  result.SetStatus(eReturnStatusFailed);
   return false;
 }
   }
@@ -970,30 +96

[Lldb-commits] [PATCH] D104379: [lldb] Remove redundant calls to set eReturnStatusFailed

2021-06-16 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a reviewer: teemperor.
DavidSpickett added a comment.
Herald added a subscriber: JDevlieghere.

There'll be a part 2 once this has passed the bots, which will cover all the 
`CommandObject*` files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104379

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


[Lldb-commits] [PATCH] D104380: [lldb] Set return object failed status even if error string is empty

2021-06-16 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The idea is now that AppendError<...> will set eReturnStatusFailed
for you so you don't have to call SetStatus again.

Previously if the error message was empty, the status wouldn't
be set.

I don't think there are any sitautions where the message is in
fact empty but it potentially could be depending on where
we get the string from.

So let's set the status up front then return early if the message is empty.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104380

Files:
  lldb/source/Interpreter/CommandReturnObject.cpp


Index: lldb/source/Interpreter/CommandReturnObject.cpp
===
--- lldb/source/Interpreter/CommandReturnObject.cpp
+++ lldb/source/Interpreter/CommandReturnObject.cpp
@@ -98,9 +98,9 @@
 }
 
 void CommandReturnObject::AppendError(llvm::StringRef in_string) {
+  SetStatus(eReturnStatusFailed);
   if (in_string.empty())
 return;
-  SetStatus(eReturnStatusFailed);
   error(GetErrorStream()) << in_string.rtrim() << '\n';
 }
 
@@ -113,6 +113,7 @@
 }
 
 void CommandReturnObject::SetError(llvm::StringRef error_str) {
+  SetStatus(eReturnStatusFailed);
   if (error_str.empty())
 return;
 
@@ -123,10 +124,10 @@
 // append "\n" to the end of it.
 
 void CommandReturnObject::AppendRawError(llvm::StringRef in_string) {
+  SetStatus(eReturnStatusFailed);
   if (in_string.empty())
 return;
   GetErrorStream() << in_string;
-  SetStatus(eReturnStatusFailed);
 }
 
 void CommandReturnObject::SetStatus(ReturnStatus status) { m_status = status; }


Index: lldb/source/Interpreter/CommandReturnObject.cpp
===
--- lldb/source/Interpreter/CommandReturnObject.cpp
+++ lldb/source/Interpreter/CommandReturnObject.cpp
@@ -98,9 +98,9 @@
 }
 
 void CommandReturnObject::AppendError(llvm::StringRef in_string) {
+  SetStatus(eReturnStatusFailed);
   if (in_string.empty())
 return;
-  SetStatus(eReturnStatusFailed);
   error(GetErrorStream()) << in_string.rtrim() << '\n';
 }
 
@@ -113,6 +113,7 @@
 }
 
 void CommandReturnObject::SetError(llvm::StringRef error_str) {
+  SetStatus(eReturnStatusFailed);
   if (error_str.empty())
 return;
 
@@ -123,10 +124,10 @@
 // append "\n" to the end of it.
 
 void CommandReturnObject::AppendRawError(llvm::StringRef in_string) {
+  SetStatus(eReturnStatusFailed);
   if (in_string.empty())
 return;
   GetErrorStream() << in_string;
-  SetStatus(eReturnStatusFailed);
 }
 
 void CommandReturnObject::SetStatus(ReturnStatus status) { m_status = status; }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104379: [lldb] Remove redundant calls to set eReturnStatusFailed

2021-06-16 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added inline comments.



Comment at: 
lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp:835
 if (!error.Success()) {
   result.AppendError(error.AsCString());
-  result.SetStatus(eReturnStatusFailed);

https://reviews.llvm.org/D104380 should address calls like this one. Where we 
append something that could be empty.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104379

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


[Lldb-commits] [PATCH] D104380: [lldb] Set return object failed status even if error string is empty

2021-06-16 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

At least on the test suite on Linux that branch is anyway never taken, so LGTM. 
Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104380

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


[Lldb-commits] [PATCH] D104379: [lldb] Remove redundant calls to set eReturnStatusFailed

2021-06-16 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM and passes on macOS and Linux for me. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104379

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


Re: [Lldb-commits] [lldb] 3bea730 - [lldb] Fix compilation with gcc-6.5

2021-06-16 Thread Tom Stellard via lldb-commits

On 6/15/21 4:28 PM, Chandler Carruth wrote:

+Tom Stellard  - Could this get cherry-picked into 
12.0.N for the next point release? Without it, LLDB in the 12 release doesn't build with 
GCC <= 6.5 which the docs indicate is supposed to work.



Can you file a bug for this?

-Tom


On Wed, Mar 31, 2021 at 11:45 PM Pavel Labath via lldb-commits 
mailto:lldb-commits@lists.llvm.org>> wrote:


Author: Pavel Labath
Date: 2021-04-01T08:44:50+02:00
New Revision: 3bea7306e8669f94bacafae68748a9139cfc0b98

URL: 
https://github.com/llvm/llvm-project/commit/3bea7306e8669f94bacafae68748a9139cfc0b98 

DIFF: 
https://github.com/llvm/llvm-project/commit/3bea7306e8669f94bacafae68748a9139cfc0b98.diff
 


LOG: [lldb] Fix compilation with gcc-6.5

This fixes (works around) two errors with gcc-6.5.
- in the RegisterContext_x86 files, gcc is unable to synthesize a
   default constructor -- it thinks it needs to initialize the virtual
   base class, even though said classes are abstract. I fix that by
   providing a dummy constructor.
- In ReproducerInstrumentationTest, it is not able to deduce that the
   TestingRegistry class is movable (it contains a map of unique
   pointers). I change the type from Optional to
   unique_ptr GetMmapData() { return llvm::None; }

  protected:
+  // NB: This constructor is here only because gcc<=6.5 requires a virtual 
base
+  // class initializer on abstract class (even though it is never used). 
It can
+  // be deleted once we move to gcc>=7.0.
+  NativeRegisterContextLinux(NativeThreadProtocol &thread)
+      : NativeRegisterContextRegisterInfo(thread, nullptr) {}
+
    lldb::ByteOrder GetByteOrder() const;

    virtual Status ReadRegisterRaw(uint32_t reg_index, RegisterValue 
®_value);

diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
index c197d70825b4b..bd4b168f4964e 100644
--- 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -292,6 +292,8 @@ 
NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64(
      const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
      : NativeRegisterContextRegisterInfo(
            native_thread, CreateRegisterInfoInterface(target_arch)),
+      NativeRegisterContextLinux(native_thread),
+      NativeRegisterContextDBReg_x86(native_thread),
        m_xstate_type(XStateType::Invalid), m_ymm_set(), m_mpx_set(),
        m_reg_info(), m_gpr_x86_64() {
    // Set up data about ranges of valid registers.

diff  --git 
a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h 
b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
index c0c6ce29eab53..a4ed8bfb97eaf 100644
--- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
+++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
@@ -16,6 +16,12 @@ namespace lldb_private {
  class NativeRegisterContextDBReg_x86
      : public virtual NativeRegisterContextRegisterInfo {
  public:
+  // NB: This constructor is here only because gcc<=6.5 requires a virtual 
base
+  // class initializer on abstract class (even though it is never used). 
It can
+  // be deleted once we move to gcc>=7.0.
+  NativeRegisterContextDBReg_x86(NativeThreadProtocol &thread)
+      : NativeRegisterContextRegisterInfo(thread, nullptr) {}
+
    Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override;

    Status GetWatchpointHitIndex(uint32_t &wp_index,

diff  --git a/lldb/unittests/Utility/ReproducerInstrumentationTest.cpp 
b/lldb/unittests/Utility/ReproducerInstrumentationTest.cpp
index e9f6fcf34e17f..ce259c5969e09 100644
--- a/lldb/unittests/Utility/ReproducerInstrumentationTest.cpp
+++ b/lldb/unittests/Utility/ReproducerInstrumentationTest.cpp
@@ -50,7 +50,7 @@ class TestingRegistry : public Registry {
    TestingRegistry();
  };

-static llvm::Optional g_registry;
+static std::unique_ptr g_registry;
  static llvm::Optional g_serializer;
  static llvm::Optional g_deserializer;

@@ -75,13 +75,13 @@ inline TestInstrumentationData 
GetTestInstrumentationData() {
  class TestInstrumentationDataRAII {
  public:
    TestInstrumentationDataRAII(llvm::raw_string_ostream &os) {
-    g_registry.emplace();
+    g_registry = std::make_unique();
      g_serializer.emplace(os);
      g_deserializer.reset();
    }

    TestInstrumentationDataRAII(

[Lldb-commits] [PATCH] D104395: [LLDB][GUI] Add initial forms support

2021-06-16 Thread Omar Emara via Phabricator via lldb-commits
OmarEmaraDev created this revision.
OmarEmaraDev added a reviewer: clayborg.
Herald added a reviewer: teemperor.
OmarEmaraDev requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch adds initial support for forms and dialogs for the LLDB GUI.
The current supported form elements are Text, Integer, Boolean, and
Choices.

A new window delegate FormWindowDelegate was added to represent the
dialog window that contains the form. The window takes a FormDelegate as
an input.

FormDelegate is an abstract class than have a default implementation for
the drawing and char handing methods, while it require the
FormDelegateSubmit method to be defined, which contains the main dialog
submitting routine and can set error message as needed. In constructor
of the FormDelegate, the necessary fields are added using the provided
factory methods for fields. The returned field delegate can be used to
retrieve the information that the fields contains.

A field is defined by a FieldDelegate and implements the char handing
and drawing as needed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104395

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp

Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -392,6 +392,12 @@
   void Box(chtype v_char = ACS_VLINE, chtype h_char = ACS_HLINE) {
 ::box(m_window, v_char, h_char);
   }
+  void VerticalLine(int n, chtype v_char = ACS_VLINE) {
+::wvline(m_window, v_char, n);
+  }
+  void HorizontalLine(int n, chtype h_char = ACS_HLINE) {
+::whline(m_window, h_char, n);
+  }
   void Clear() { ::wclear(m_window); }
   void Erase() { ::werase(m_window); }
   Rect GetBounds() const {
@@ -423,14 +429,19 @@
 ::wbkgd(m_window, COLOR_PAIR(color_pair_idx));
   }
 
-  void PutCStringTruncated(int right_pad, const char *s, int len = -1) {
-int bytes_left = GetWidth() - GetCursorX();
+  void PutCStringTruncatedWidth(int right_pad, const char *s, int width,
+int len = -1) {
+int bytes_left = width - GetCursorX();
 if (bytes_left > right_pad) {
   bytes_left -= right_pad;
   ::waddnstr(m_window, s, len < 0 ? bytes_left : std::min(bytes_left, len));
 }
   }
 
+  void PutCStringTruncated(int right_pad, const char *s, int len = -1) {
+PutCStringTruncatedWidth(right_pad, s, GetWidth(), len);
+  }
+
   void MoveWindow(const Point &origin) {
 const bool moving_window = origin != GetParentOrigin();
 if (m_is_subwin && moving_window) {
@@ -674,6 +685,35 @@
   AttributeOff(attr);
   }
 
+  void DrawBox(const Rect &bounds, chtype v_char = ACS_VLINE,
+   chtype h_char = ACS_HLINE) {
+MoveCursor(bounds.origin.x, bounds.origin.y);
+VerticalLine(bounds.size.height);
+HorizontalLine(bounds.size.width);
+PutChar(ACS_ULCORNER);
+
+MoveCursor(bounds.origin.x + bounds.size.width - 1, bounds.origin.y);
+VerticalLine(bounds.size.height);
+PutChar(ACS_URCORNER);
+
+MoveCursor(bounds.origin.x, bounds.origin.y + bounds.size.height - 1);
+HorizontalLine(bounds.size.width);
+PutChar(ACS_LLCORNER);
+
+MoveCursor(bounds.origin.x + bounds.size.width - 1,
+   bounds.origin.y + bounds.size.height - 1);
+PutChar(ACS_LRCORNER);
+  }
+
+  void DrawTitledBox(const Rect &bounds, const char *title,
+ chtype v_char = ACS_VLINE, chtype h_char = ACS_HLINE) {
+DrawBox(bounds, v_char, h_char);
+MoveCursor(bounds.origin.x + 2, bounds.origin.y);
+PutChar('[');
+PutCString(title);
+PutChar(']');
+  }
+
   virtual void Draw(bool force) {
 if (m_delegate_sp && m_delegate_sp->WindowDelegateDraw(*this, force))
   return;
@@ -869,6 +909,540 @@
   const Window &operator=(const Window &) = delete;
 };
 
+/
+// Forms
+/
+
+class FieldDelegate {
+public:
+  virtual ~FieldDelegate() = default;
+
+  virtual Rect FieldDelegateGetBounds() = 0;
+
+  virtual void FieldDelegateDraw(Window &window, bool is_active) = 0;
+
+  virtual HandleCharResult FieldDelegateHandleChar(int key) {
+return eKeyNotHandled;
+  }
+};
+
+typedef std::shared_ptr FieldDelegateSP;
+
+class TextFieldDelegate : public FieldDelegate {
+public:
+  TextFieldDelegate(const char *label, int width, Point origin,
+const char *content)
+  : m_label(label), m_width(width), m_origin(origin), m_content(content),
+m_cursor_position(0), m_first_visibile_char(0) {
+assert(m_width > 2);
+  }
+
+  // Get the bounding box of the field. The text field has a height of 3, 2
+  // lines for borders and 1 for the content.
+  Rect FieldDelegateGetBounds() override {
+return Rect(m_origin, Size(m_width, 3));
+  }
+
+  // Get the start X position of the content in window space, without the
+  // borders.
+  int GetX() { return 

[Lldb-commits] [PATCH] D104395: [LLDB][GUI] Add initial forms support

2021-06-16 Thread Omar Emara via Phabricator via lldb-commits
OmarEmaraDev added a comment.
Herald added a subscriber: JDevlieghere.

An example form:

F17429353: 20210616-174753.mp4 <https://reviews.llvm.org/F17429353>

  class TestFormDelegate : public FormDelegate {
  public:
TestFormDelegate() {
  m_path_field = AddTextField("Path", 20, Point(4, 2), "/tmp/a.out");
  m_number_field = AddIntegerField("Number", 20, Point(4, 5), 5);
  m_bool_field = AddBooleanField("Boolean", Point(5, 8), true);
  std::vector choices;
  choices.push_back(std::string("Choice 1"));
  choices.push_back(std::string("Choice 2"));
  choices.push_back(std::string("Choice 3"));
  choices.push_back(std::string("Choice 4"));
  choices.push_back(std::string("Choice 5"));
  m_choices_field = AddChoicesField("Choices", 20, 5, Point(30, 2), 
choices);
}
  
bool FormDelegateSubmit() override {
  std::string path = m_path_field->GetText();
  int number = m_number_field->GetInteger();
  bool boolean = m_bool_field->GetBoolean();
  
  // Do something with the data.
  
  if (everything_is_correct)
return true;
  
  if (there_is_an_error) {
m_has_error = true;
m_error =
std::string("An error occured! Check the validity of the inputs.");
return false;
  }
}
  
  protected:
TextFieldDelegate *m_path_field;
IntegerFieldDelegate *m_number_field;
BooleanFieldDelegate *m_bool_field;
ChoicesFieldDelegate *m_choices_field;
  };


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104395

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


[Lldb-commits] [PATCH] D104404: Change PathMappingList::RemapPath to return an optional result (NFC)

2021-06-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: JDevlieghere, shafik, jingham.
aprantl requested review of this revision.

This is an NFC modernization refactoring that replaces the combination of a 
bool return + reference argument, with an Optional return value.


https://reviews.llvm.org/D104404

Files:
  lldb/include/lldb/Target/PathMappingList.h
  lldb/source/Core/Module.cpp
  lldb/source/Target/PathMappingList.cpp


Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -145,18 +145,16 @@
 
 bool PathMappingList::RemapPath(ConstString path,
 ConstString &new_path) const {
-  std::string remapped;
-  if (RemapPath(path.GetStringRef(), remapped)) {
-new_path.SetString(remapped);
+  if (auto remapped = RemapPath(path.GetStringRef())) {
+new_path.SetString(remapped->GetPath());
 return true;
   }
   return false;
 }
 
-bool PathMappingList::RemapPath(llvm::StringRef path,
-std::string &new_path) const {
+llvm::Optional PathMappingList::RemapPath(llvm::StringRef path) 
const{
   if (m_pairs.empty() || path.empty())
-return false;
+return {};
   LazyBool path_is_relative = eLazyBoolCalculate;
   for (const auto &it : m_pairs) {
 auto prefix = it.first.GetStringRef();
@@ -177,10 +175,9 @@
 }
 FileSpec remapped(it.second.GetStringRef());
 remapped.AppendPathComponent(path);
-new_path = remapped.GetPath();
-return true;
+return remapped;
   }
-  return false;
+  return {};
 }
 
 bool PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) 
const {
Index: lldb/source/Core/Module.cpp
===
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -1604,7 +1604,11 @@
 bool Module::RemapSourceFile(llvm::StringRef path,
  std::string &new_path) const {
   std::lock_guard guard(m_mutex);
-  return m_source_mappings.RemapPath(path, new_path);
+  if (auto remapped = m_source_mappings.RemapPath(path)) {
+new_path = remapped->GetPath();
+return true;
+  }
+  return false;
 }
 
 void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, llvm::StringRef 
sysroot) {
Index: lldb/include/lldb/Target/PathMappingList.h
===
--- lldb/include/lldb/Target/PathMappingList.h
+++ lldb/include/lldb/Target/PathMappingList.h
@@ -72,13 +72,9 @@
   /// \param[in] path
   /// The original source file path to try and remap.
   ///
-  /// \param[out] new_path
-  /// The newly remapped filespec that is may or may not exist.
-  ///
   /// \return
-  /// /b true if \a path was successfully located and \a new_path
-  /// is filled in with a new source path, \b false otherwise.
-  bool RemapPath(llvm::StringRef path, std::string &new_path) const;
+  /// The remapped filespec that may or may not exist on disk.
+  llvm::Optional RemapPath(llvm::StringRef path) const;
   bool RemapPath(const char *, std::string &) const = delete;
 
   bool ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const;


Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -145,18 +145,16 @@
 
 bool PathMappingList::RemapPath(ConstString path,
 ConstString &new_path) const {
-  std::string remapped;
-  if (RemapPath(path.GetStringRef(), remapped)) {
-new_path.SetString(remapped);
+  if (auto remapped = RemapPath(path.GetStringRef())) {
+new_path.SetString(remapped->GetPath());
 return true;
   }
   return false;
 }
 
-bool PathMappingList::RemapPath(llvm::StringRef path,
-std::string &new_path) const {
+llvm::Optional PathMappingList::RemapPath(llvm::StringRef path) const{
   if (m_pairs.empty() || path.empty())
-return false;
+return {};
   LazyBool path_is_relative = eLazyBoolCalculate;
   for (const auto &it : m_pairs) {
 auto prefix = it.first.GetStringRef();
@@ -177,10 +175,9 @@
 }
 FileSpec remapped(it.second.GetStringRef());
 remapped.AppendPathComponent(path);
-new_path = remapped.GetPath();
-return true;
+return remapped;
   }
-  return false;
+  return {};
 }
 
 bool PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const {
Index: lldb/source/Core/Module.cpp
===
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -1604,7 +1604,11 @@
 bool Module::RemapSourceFile(llvm::StringRef path,
  std::string &new_path) const {
   std::lock_guard guard(m_mutex);
-  return m_source_mappings.RemapPath(path, new_path);
+  

[Lldb-commits] [PATCH] D104405: Change PathMappingList::FindFile to return an optional result (NFC)

2021-06-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: JDevlieghere, shafik, jingham.
aprantl requested review of this revision.

This is an NFC modernization refactoring that replaces the combination of a 
bool return + reference argument, with an Optional return value.


https://reviews.llvm.org/D104405

Files:
  lldb/include/lldb/Target/PathMappingList.h
  lldb/source/Core/Module.cpp
  lldb/source/Target/PathMappingList.cpp


Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -145,18 +145,16 @@
 
 bool PathMappingList::RemapPath(ConstString path,
 ConstString &new_path) const {
-  std::string remapped;
-  if (RemapPath(path.GetStringRef(), remapped)) {
-new_path.SetString(remapped);
+  if (auto remapped = RemapPath(path.GetStringRef())) {
+new_path.SetString(remapped->GetPath());
 return true;
   }
   return false;
 }
 
-bool PathMappingList::RemapPath(llvm::StringRef path,
-std::string &new_path) const {
+llvm::Optional PathMappingList::RemapPath(llvm::StringRef path) 
const{
   if (m_pairs.empty() || path.empty())
-return false;
+return {};
   LazyBool path_is_relative = eLazyBoolCalculate;
   for (const auto &it : m_pairs) {
 auto prefix = it.first.GetStringRef();
@@ -177,10 +175,9 @@
 }
 FileSpec remapped(it.second.GetStringRef());
 remapped.AppendPathComponent(path);
-new_path = remapped.GetPath();
-return true;
+return remapped;
   }
-  return false;
+  return {};
 }
 
 bool PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) 
const {
Index: lldb/source/Core/Module.cpp
===
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -1604,7 +1604,11 @@
 bool Module::RemapSourceFile(llvm::StringRef path,
  std::string &new_path) const {
   std::lock_guard guard(m_mutex);
-  return m_source_mappings.RemapPath(path, new_path);
+  if (auto remapped = m_source_mappings.RemapPath(path)) {
+new_path = remapped->GetPath();
+return true;
+  }
+  return false;
 }
 
 void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, llvm::StringRef 
sysroot) {
Index: lldb/include/lldb/Target/PathMappingList.h
===
--- lldb/include/lldb/Target/PathMappingList.h
+++ lldb/include/lldb/Target/PathMappingList.h
@@ -72,13 +72,9 @@
   /// \param[in] path
   /// The original source file path to try and remap.
   ///
-  /// \param[out] new_path
-  /// The newly remapped filespec that is may or may not exist.
-  ///
   /// \return
-  /// /b true if \a path was successfully located and \a new_path
-  /// is filled in with a new source path, \b false otherwise.
-  bool RemapPath(llvm::StringRef path, std::string &new_path) const;
+  /// The remapped filespec that may or may not exist on disk.
+  llvm::Optional RemapPath(llvm::StringRef path) const;
   bool RemapPath(const char *, std::string &) const = delete;
 
   bool ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const;


Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -145,18 +145,16 @@
 
 bool PathMappingList::RemapPath(ConstString path,
 ConstString &new_path) const {
-  std::string remapped;
-  if (RemapPath(path.GetStringRef(), remapped)) {
-new_path.SetString(remapped);
+  if (auto remapped = RemapPath(path.GetStringRef())) {
+new_path.SetString(remapped->GetPath());
 return true;
   }
   return false;
 }
 
-bool PathMappingList::RemapPath(llvm::StringRef path,
-std::string &new_path) const {
+llvm::Optional PathMappingList::RemapPath(llvm::StringRef path) const{
   if (m_pairs.empty() || path.empty())
-return false;
+return {};
   LazyBool path_is_relative = eLazyBoolCalculate;
   for (const auto &it : m_pairs) {
 auto prefix = it.first.GetStringRef();
@@ -177,10 +175,9 @@
 }
 FileSpec remapped(it.second.GetStringRef());
 remapped.AppendPathComponent(path);
-new_path = remapped.GetPath();
-return true;
+return remapped;
   }
-  return false;
+  return {};
 }
 
 bool PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const {
Index: lldb/source/Core/Module.cpp
===
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -1604,7 +1604,11 @@
 bool Module::RemapSourceFile(llvm::StringRef path,
  std::string &new_path) const {
   std::lock_guard guard(m_mutex);
-  return m_source_mappings.RemapPath(path, new_path);
+  

[Lldb-commits] [PATCH] D104406: Express PathMappingList::FindFile() in terms of PathMappingList.h::RemapPath() (NFC)

2021-06-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: jingham, shafik, JDevlieghere, labath.
aprantl requested review of this revision.

This patch replaces the function body FindFile() with a call to RemapPath(), 
since the two functions implement the same functionality.


https://reviews.llvm.org/D104406

Files:
  lldb/source/Target/PathMappingList.cpp


Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -193,49 +193,11 @@
   return false;
 }
 
-llvm::Optional
-PathMappingList::FindFile(const FileSpec &orig_spec) const {
-  FileSpec new_spec;
-  if (m_pairs.empty())
-return {};
-  
-  std::string orig_path = orig_spec.GetPath();
-
-  if (orig_path.empty())
-return {};
-  
-  bool orig_is_relative = orig_spec.IsRelative();
-
-  for (auto entry : m_pairs) {
-llvm::StringRef orig_ref(orig_path);
-llvm::StringRef prefix_ref = entry.first.GetStringRef();
-if (orig_ref.size() < prefix_ref.size())
-  continue;
-// We consider a relative prefix or one of just "." to
-// mean "only apply to relative paths".
-bool prefix_is_relative = false;
-
-if (prefix_ref == ".") {
-  prefix_is_relative = true;
-  // Remove the "." since it will have been removed from the
-  // FileSpec paths already.
-  prefix_ref = prefix_ref.drop_front();
-} else {
-  FileSpec prefix_spec(prefix_ref, FileSpec::Style::native);
-  prefix_is_relative = prefix_spec.IsRelative();
-}
-if (prefix_is_relative != orig_is_relative)
-  continue;
+llvm::Optional PathMappingList::FindFile(const FileSpec &orig_spec) 
const {
+  if (auto remapped = RemapPath(orig_spec.GetPath()))
+if (FileSystem::Instance().Exists(*remapped))
+  return remapped;
 
-if (orig_ref.consume_front(prefix_ref)) {
-  new_spec.SetFile(entry.second.GetCString(), FileSpec::Style::native);
-  new_spec.AppendPathComponent(orig_ref);
-  if (FileSystem::Instance().Exists(new_spec))
-return new_spec;
-}
-  }
-  
-  new_spec.Clear();
   return {};
 }
 


Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -193,49 +193,11 @@
   return false;
 }
 
-llvm::Optional
-PathMappingList::FindFile(const FileSpec &orig_spec) const {
-  FileSpec new_spec;
-  if (m_pairs.empty())
-return {};
-  
-  std::string orig_path = orig_spec.GetPath();
-
-  if (orig_path.empty())
-return {};
-  
-  bool orig_is_relative = orig_spec.IsRelative();
-
-  for (auto entry : m_pairs) {
-llvm::StringRef orig_ref(orig_path);
-llvm::StringRef prefix_ref = entry.first.GetStringRef();
-if (orig_ref.size() < prefix_ref.size())
-  continue;
-// We consider a relative prefix or one of just "." to
-// mean "only apply to relative paths".
-bool prefix_is_relative = false;
-
-if (prefix_ref == ".") {
-  prefix_is_relative = true;
-  // Remove the "." since it will have been removed from the
-  // FileSpec paths already.
-  prefix_ref = prefix_ref.drop_front();
-} else {
-  FileSpec prefix_spec(prefix_ref, FileSpec::Style::native);
-  prefix_is_relative = prefix_spec.IsRelative();
-}
-if (prefix_is_relative != orig_is_relative)
-  continue;
+llvm::Optional PathMappingList::FindFile(const FileSpec &orig_spec) const {
+  if (auto remapped = RemapPath(orig_spec.GetPath()))
+if (FileSystem::Instance().Exists(*remapped))
+  return remapped;
 
-if (orig_ref.consume_front(prefix_ref)) {
-  new_spec.SetFile(entry.second.GetCString(), FileSpec::Style::native);
-  new_spec.AppendPathComponent(orig_ref);
-  if (FileSystem::Instance().Exists(new_spec))
-return new_spec;
-}
-  }
-  
-  new_spec.Clear();
   return {};
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104407: Improve path remapping in cross-debugging scenarios

2021-06-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: jingham, labath, shafik, JDevlieghere.
aprantl requested review of this revision.

This patch implements a slight improvement when debugging across platforms and 
remapping source paths that are in a non-native format. See the unit test for 
examples.

rdar://79205675


https://reviews.llvm.org/D104407

Files:
  lldb/source/Target/PathMappingList.cpp
  lldb/unittests/Target/PathMappingListTest.cpp

Index: lldb/unittests/Target/PathMappingListTest.cpp
===
--- lldb/unittests/Target/PathMappingListTest.cpp
+++ lldb/unittests/Target/PathMappingListTest.cpp
@@ -6,9 +6,9 @@
 //
 //===--===//
 
-#include "llvm/ADT/ArrayRef.h"
 #include "lldb/Target/PathMappingList.h"
 #include "lldb/Utility/FileSpec.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "gtest/gtest.h"
 #include 
 
@@ -19,6 +19,8 @@
   FileSpec original;
   FileSpec remapped;
   Matches(const char *o, const char *r) : original(o), remapped(r) {}
+  Matches(const char *o, llvm::sys::path::Style style, const char *r)
+  : original(o, style), remapped(r) {}
 };
 } // namespace
 
@@ -112,3 +114,27 @@
   };
   TestPathMappings(map, matches, fails);
 }
+
+#ifndef _WIN32
+TEST(PathMappingListTest, CrossPlatformTests) {
+  PathMappingList map;
+  map.Append(ConstString(R"(C:\old)"), ConstString("/new"), false);
+  Matches matches[] = {
+{R"(C:\old)", llvm::sys::path::Style::windows, "/new"},
+{R"(C:\old\)", llvm::sys::path::Style::windows, "/new"},
+{R"(C:\old\foo\.)", llvm::sys::path::Style::windows, "/new/foo"},
+{R"(C:\old\foo.c)", llvm::sys::path::Style::windows, "/new/foo.c"},
+{R"(C:\old\foo.c\.)", llvm::sys::path::Style::windows, "/new/foo.c"},
+{R"(C:\old\.\foo.c)", llvm::sys::path::Style::windows, "/new/foo.c"},
+  };
+  ConstString fails[] = {
+ConstString("/foo"),
+ConstString("/"),
+ConstString("foo.c"),
+ConstString("./foo.c"),
+ConstString("../foo.c"),
+ConstString("../bar/foo.c"),
+  };
+  TestPathMappings(map, matches, fails);
+}
+#endif
Index: lldb/source/Target/PathMappingList.cpp
===
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -151,6 +151,19 @@
   }
   return false;
 }
+ 
+/// Append components to path, applying style.
+static void AppendPathComponents(FileSpec &path, llvm::StringRef components,
+ llvm::sys::path::Style style) {
+auto component = llvm::sys::path::begin(components, style);
+auto e = llvm::sys::path::end(components);
+if (component != e &&
+llvm::sys::path::is_separator(*component->data(), style))
+  ++component;
+for (; component != e; ++component)
+  path.AppendPathComponent(*component);
+}
+
 
 llvm::Optional PathMappingList::RemapPath(llvm::StringRef path) const{
   if (m_pairs.empty() || path.empty())
@@ -174,7 +187,9 @@
 continue;
 }
 FileSpec remapped(it.second.GetStringRef());
-remapped.AppendPathComponent(path);
+auto orig_style = FileSpec::GuessPathStyle(prefix).getValueOr(
+llvm::sys::path::Style::native);
+AppendPathComponents(remapped, path, orig_style);
 return remapped;
   }
   return {};
@@ -186,8 +201,11 @@
   for (const auto &it : m_pairs) {
 if (!path_ref.consume_front(it.second.GetStringRef()))
   continue;
-fixed.SetFile(it.first.GetStringRef(), FileSpec::Style::native);
-fixed.AppendPathComponent(path_ref);
+auto orig = it.first.GetStringRef();
+auto orig_style = FileSpec::GuessPathStyle(orig).getValueOr(
+llvm::sys::path::Style::native);
+fixed.SetFile(orig, orig_style);
+AppendPathComponents(fixed, path_ref, orig_style);
 return true;
   }
   return false;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104413: Fixed use of -o and -k in LLDB under Windows when statically compiled with vcruntime.

2021-06-16 Thread Levon Ter-Grigoryan via Phabricator via lldb-commits
PatriosTheGreat created this revision.
PatriosTheGreat added reviewers: teemperor, jarin.
PatriosTheGreat requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Right now if the LLDB is compiled under the windows with static vcruntime 
library, the -o and -k commands will not work.

The problem is that the LLDB create FILE* in lldb.exe and pass it to 
liblldb.dll which is an object from CRT.
Since the CRT is statically linked each of these module has its own copy of the 
CRT with it's own global state and the LLDB should not share CRT objects 
between them.

In this change I moved the logic of creating FILE* out of commands stream from 
Driver class to SBDebugger.
To do this I added new method: SBError SBDebugger::SetInputStream(SBStream 
&stream)

Command to build the LLDB:
cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb;libcxx"  
-DLLVM_USE_CRT_RELEASE="MT" -DLLVM_USE_CRT_MINSIZEREL="MT" 
-DLLVM_USE_CRT_RELWITHDEBINFO="MT" -DP
YTHON_HOME:FILEPATH=C:/Python38 -DCMAKE_C_COMPILER:STRING=cl.exe 
-DCMAKE_CXX_COMPILER:STRING=cl.exe ../llvm

Command which will fail:
lldb.exe -o help

See discord discussion for more details: 
https://discord.com/channels/636084430946959380/636732809708306432/854629125398724628
This revision is for the further discussion.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104413

Files:
  lldb/include/lldb/API/SBDebugger.h
  lldb/source/API/SBDebugger.cpp
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -23,7 +23,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
@@ -42,14 +41,6 @@
 #include 
 #include 
 
-// Includes for pipe()
-#if defined(_WIN32)
-#include 
-#include 
-#else
-#include 
-#endif
-
 #if !defined(__APPLE__)
 #include "llvm/Support/DataTypes.h"
 #endif
@@ -400,60 +391,6 @@
   return error;
 }
 
-static inline int OpenPipe(int fds[2], std::size_t size) {
-#ifdef _WIN32
-  return _pipe(fds, size, O_BINARY);
-#else
-  (void)size;
-  return pipe(fds);
-#endif
-}
-
-static ::FILE *PrepareCommandsForSourcing(const char *commands_data,
-  size_t commands_size) {
-  enum PIPES { READ, WRITE }; // Indexes for the read and write fds
-  int fds[2] = {-1, -1};
-
-  if (OpenPipe(fds, commands_size) != 0) {
-WithColor::error()
-<< "can't create pipe file descriptors for LLDB commands\n";
-return nullptr;
-  }
-
-  ssize_t nrwr = write(fds[WRITE], commands_data, commands_size);
-  if (size_t(nrwr) != commands_size) {
-WithColor::error()
-<< format(
-   "write(%i, %p, %" PRIu64
-   ") failed (errno = %i) when trying to open LLDB commands pipe",
-   fds[WRITE], static_cast(commands_data),
-   static_cast(commands_size), errno)
-<< '\n';
-llvm::sys::Process::SafelyCloseFileDescriptor(fds[READ]);
-llvm::sys::Process::SafelyCloseFileDescriptor(fds[WRITE]);
-return nullptr;
-  }
-
-  // Close the write end of the pipe, so that the command interpreter will exit
-  // when it consumes all the data.
-  llvm::sys::Process::SafelyCloseFileDescriptor(fds[WRITE]);
-
-  // Open the read file descriptor as a FILE * that we can return as an input
-  // handle.
-  ::FILE *commands_file = fdopen(fds[READ], "rb");
-  if (commands_file == nullptr) {
-WithColor::error() << format("fdopen(%i, \"rb\") failed (errno = %i) "
- "when trying to open LLDB commands pipe",
- fds[READ], errno)
-   << '\n';
-llvm::sys::Process::SafelyCloseFileDescriptor(fds[READ]);
-return nullptr;
-  }
-
-  // 'commands_file' now owns the read descriptor.
-  return commands_file;
-}
-
 std::string EscapeString(std::string arg) {
   std::string::size_type pos = 0;
   while ((pos = arg.find_first_of("\"\\", pos)) != std::string::npos) {
@@ -583,21 +520,15 @@
   // Check if we have any data in the commands stream, and if so, save it to a
   // temp file
   // so we can then run the command interpreter using the file contents.
-  const char *commands_data = commands_stream.GetData();
-  const size_t commands_size = commands_stream.GetSize();
-
   bool go_interactive = true;
-  if ((commands_data != nullptr) && (commands_size != 0u)) {
-FILE *commands_file =
-PrepareCommandsForSourcing(commands_data, commands_size);
-
-if (commands_file == nullptr) {
-  // We should have already printed an error in PrepareCommandsForSourcing.
+  if ((commands_stream.GetData() != nullptr) &&
+  (commands_stream.GetSize() != 0u)) {
+SBError error = m_debugger.SetInputStream(c

[Lldb-commits] [PATCH] D102757: [lldb] Remove non address bits when looking up memory regions

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



Comment at: lldb/source/Target/Process.cpp:5854
+  if (auto abi = GetABI()) {
+// TODO: can we always assume data addresses here?
+load_addr = abi->FixDataAddress(load_addr);

Yes this is ok for now as both Data and Code masks are same in case of Linux. 
If anything changes in future we ll take care of that at that time. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102757

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


[Lldb-commits] [PATCH] D104422: [trace] Add a TraceCursor class

2021-06-16 Thread walter erquinigo via Phabricator via lldb-commits
wallace created this revision.
wallace added reviewers: clayborg, vsk.
wallace requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

As a follow up of D103588 , I'm reinitiating 
the discussion with a new proposal for traversing instructions in a trace which 
uses the feedback gotten in that diff.

See the embedded documentation in TraceCursor for more information. The idea is 
to offer an OOP way to traverse instructions exposing a minimal interface that 
makes no assumptions on:

- the number of instructions in the trace (i.e. having indices for instructions 
might be impractical for gigantic intel-pt traces, as it would require to 
decode the entire trace). This renders the use of indices to point to 
instructions impractical. Traces are big and expensive, and the consumer should 
try to do look linear lookups (forwards and/or backwards) and avoid random 
accesses (the API could be extended though, but for now I want to dicard that 
funcionality and leave the API extensible if needed).
- the way the instructions are represented internally by each Trace plug-in. 
They could be mmap'ed from a file, exist in plain vector or generated on the 
fly as the user requests the data.
- the actual data structure used internally for each plug-in. Ideas like having 
a struct TraceInstruction have been discarded because that would make the 
plug-in follow a certain data type, which might be costly. Instead, the user 
can ask the cursor for each independent property of the instruction it's 
pointing at.

The way to get a cursor is to ask Trace.h for the end or being cursor or a 
thread's trace.

There are some benefits of this approach:

- there's little cost to create a cursor, and this allows for lazily decoding a 
trace as the user requests data.
- each trace plug-in could decide how to cache the instructions it generates. 
For example, if a trace is small, it might decide to keep everything in memory, 
or if the trace is massive, it might decide to keep around the last thousands 
of instructions to speed up local searches.
- a cursor can outlive a stop point, which makes trace comparison for live 
processes feasible. An application of this is to compare profiling data of two 
runs of the same function, which should be doable with intel pt.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104422

Files:
  lldb/include/lldb/Target/Trace.h
  lldb/include/lldb/Target/TraceCursor.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/include/lldb/lldb-forward.h

Index: lldb/include/lldb/lldb-forward.h
===
--- lldb/include/lldb/lldb-forward.h
+++ lldb/include/lldb/lldb-forward.h
@@ -229,6 +229,7 @@
 class ThreadSpec;
 class ThreadPostMortemTrace;
 class Trace;
+class TraceCursor;
 class TraceSessionFileParser;
 class Type;
 class TypeAndOrName;
@@ -441,6 +442,7 @@
 typedef std::weak_ptr ThreadPlanWP;
 typedef std::shared_ptr ThreadPlanTracerSP;
 typedef std::shared_ptr TraceSP;
+typedef std::shared_ptr TraceCursorSP;
 typedef std::shared_ptr TypeSP;
 typedef std::weak_ptr TypeWP;
 typedef std::shared_ptr TypeCategoryImplSP;
Index: lldb/include/lldb/lldb-enumerations.h
===
--- lldb/include/lldb/lldb-enumerations.h
+++ lldb/include/lldb/lldb-enumerations.h
@@ -958,6 +958,22 @@
   eExpressionEvaluationComplete
 };
 
+/// Architecture-agnostic categorization of instructions. Useful for doing
+/// analysis on traces.
+FLAGS_ENUM(TraceInstructionType){
+/// Any instruction not listed below.
+eTraceInstructionTypeNormal = (1u << 1),
+/// This includes both conditional and unconditional jumps.
+eTraceInstructionTypeJump = (1u << 2),
+/// This represents a call to a function.
+eTraceInstructionTypeCall = (1u << 3),
+/// This represents a return from a function.
+eTraceInstructionTypeReturn = (1u << 4),
+/// Helper mask to include anything above.
+eTraceInstructionTypeAny = (0xu)};
+
+LLDB_MARK_AS_BITMASK_ENUM(TraceInstructionType)
+
 /// Watchpoint Kind.
 ///
 /// Indicates what types of events cause the watchpoint to fire. Used by Native
Index: lldb/include/lldb/Target/TraceCursor.h
===
--- /dev/null
+++ lldb/include/lldb/Target/TraceCursor.h
@@ -0,0 +1,102 @@
+//===-- TraceCursor.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_TARGET_TRACE_CURSOR_H
+#define LLDB_TARGET_TRACE_CURSOR_H
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// Class used for iterating ov

[Lldb-commits] [lldb] f9aba9a - Move the definition of LLVM_SUPPORT_XCODE_SIGNPOSTS into llvm-config.h

2021-06-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2021-06-16T14:40:37-07:00
New Revision: f9aba9a5afe09788eceb9879aa5c3ad345e0f1e9

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

LOG: Move the definition of LLVM_SUPPORT_XCODE_SIGNPOSTS into llvm-config.h

since it is now used by a public header file (Signposts.h).
This fixes the standalone LLDB build.

Added: 


Modified: 
lldb/include/lldb/Utility/Timer.h
llvm/include/llvm/Config/config.h.cmake
llvm/include/llvm/Config/llvm-config.h.cmake
llvm/include/llvm/Support/Signposts.h
llvm/lib/Support/Signposts.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Timer.h 
b/lldb/include/lldb/Utility/Timer.h
index 4696a80319a98..c70c180494266 100644
--- a/lldb/include/lldb/Utility/Timer.h
+++ b/lldb/include/lldb/Utility/Timer.h
@@ -9,7 +9,6 @@
 #ifndef LLDB_UTILITY_TIMER_H
 #define LLDB_UTILITY_TIMER_H
 
-#include "llvm/Config/config.h"
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/Chrono.h"
 #include "llvm/Support/Signposts.h"

diff  --git a/llvm/include/llvm/Config/config.h.cmake 
b/llvm/include/llvm/Config/config.h.cmake
index c7db4a21cb135..8d58ec9d665b3 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -350,9 +350,6 @@
 /* Define to the default GlobalISel coverage file prefix */
 #cmakedefine LLVM_GISEL_COV_PREFIX "${LLVM_GISEL_COV_PREFIX}"
 
-/* Whether Timers signpost passes in Xcode Instruments */
-#cmakedefine01 LLVM_SUPPORT_XCODE_SIGNPOSTS
-
 #cmakedefine HAVE_PROC_PID_RUSAGE 1
 
 #endif

diff  --git a/llvm/include/llvm/Config/llvm-config.h.cmake 
b/llvm/include/llvm/Config/llvm-config.h.cmake
index 9916635489e4f..4e7e2e9e39d9f 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -97,4 +97,8 @@
 /* Define if the xar_open() function is supported on this platform. */
 #cmakedefine LLVM_HAVE_LIBXAR ${LLVM_HAVE_LIBXAR}
 
+/* Whether Timers signpost passes in Xcode Instruments */
+#cmakedefine01 LLVM_SUPPORT_XCODE_SIGNPOSTS
+
+
 #endif

diff  --git a/llvm/include/llvm/Support/Signposts.h 
b/llvm/include/llvm/Support/Signposts.h
index 6a656fb2e899f..bc6abba0a0e11 100644
--- a/llvm/include/llvm/Support/Signposts.h
+++ b/llvm/include/llvm/Support/Signposts.h
@@ -18,7 +18,7 @@
 #define LLVM_SUPPORT_SIGNPOSTS_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
 #include 
 
 #if LLVM_SUPPORT_XCODE_SIGNPOSTS

diff  --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp
index efa283c0ade51..49a0b16baa026 100644
--- a/llvm/lib/Support/Signposts.cpp
+++ b/llvm/lib/Support/Signposts.cpp
@@ -13,7 +13,7 @@
 #if LLVM_SUPPORT_XCODE_SIGNPOSTS
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Mutex.h"
-#endif // if LLVM_SUPPORT_XCODE_SIGNPOSTS
+#endif
 
 using namespace llvm;
 



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


[Lldb-commits] [PATCH] D104423: [WebAssembly] Rename event to tag

2021-06-16 Thread Heejin Ahn via Phabricator via lldb-commits
aheejin created this revision.
aheejin added reviewers: tlively, sbc100.
Herald added subscribers: wingo, ecnelises, rupprecht, sunfish, hiraditya, 
jgravelle-google, dschuff.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
aheejin requested review of this revision.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.

We recently decided to change 'event' to 'tag', and to 'event section'
to 'tag section', out of the rationale that the section contains a
generalized tag that references a type, which may be used for something
other than exceptions, and the name 'event' can be confusing in the web
context. See https://github.com/WebAssembly/exception-handling/pull/161.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104423

Files:
  lld/include/lld/Common/LLVM.h
  lld/test/wasm/Inputs/event-section1.ll
  lld/test/wasm/Inputs/event-section2.ll
  lld/test/wasm/Inputs/tag-section1.ll
  lld/test/wasm/Inputs/tag-section2.ll
  lld/test/wasm/event-section.ll
  lld/test/wasm/tag-section.ll
  lld/wasm/InputChunks.cpp
  lld/wasm/InputElement.h
  lld/wasm/InputFiles.cpp
  lld/wasm/InputFiles.h
  lld/wasm/MarkLive.cpp
  lld/wasm/OutputSections.cpp
  lld/wasm/SymbolTable.cpp
  lld/wasm/SymbolTable.h
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/SyntheticSections.cpp
  lld/wasm/SyntheticSections.h
  lld/wasm/Writer.cpp
  lld/wasm/WriterUtils.cpp
  lld/wasm/WriterUtils.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/BinaryFormat/WasmRelocs.def
  llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
  llvm/include/llvm/MC/MCSymbolWasm.h
  llvm/include/llvm/Object/Wasm.h
  llvm/include/llvm/ObjectYAML/WasmYAML.h
  llvm/lib/BinaryFormat/Wasm.cpp
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/RelocationResolver.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/ObjectYAML/WasmEmitter.cpp
  llvm/lib/ObjectYAML/WasmYAML.cpp
  llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/test/CodeGen/WebAssembly/exception.ll
  llvm/test/CodeGen/WebAssembly/null-streamer.ll
  llvm/test/MC/WebAssembly/annotations.s
  llvm/test/MC/WebAssembly/basic-assembly.s
  llvm/test/MC/WebAssembly/event-section-decoding.ll
  llvm/test/MC/WebAssembly/event-section.ll
  llvm/test/MC/WebAssembly/tag-section-decoding.ll
  llvm/test/MC/WebAssembly/tag-section.ll
  llvm/test/ObjectYAML/wasm/event_section.yaml
  llvm/tools/llvm-readobj/WasmDumper.cpp
  llvm/tools/obj2yaml/wasm2yaml.cpp

Index: llvm/tools/obj2yaml/wasm2yaml.cpp
===
--- llvm/tools/obj2yaml/wasm2yaml.cpp
+++ llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -132,7 +132,7 @@
   case wasm::WASM_SYMBOL_TYPE_FUNCTION:
   case wasm::WASM_SYMBOL_TYPE_GLOBAL:
   case wasm::WASM_SYMBOL_TYPE_TABLE:
-  case wasm::WASM_SYMBOL_TYPE_EVENT:
+  case wasm::WASM_SYMBOL_TYPE_TAG:
 Info.ElementIndex = Symbol.ElementIndex;
 break;
   case wasm::WASM_SYMBOL_TYPE_SECTION:
@@ -238,9 +238,9 @@
   Im.GlobalImport.Type = Import.Global.Type;
   Im.GlobalImport.Mutable = Import.Global.Mutable;
   break;
-case wasm::WASM_EXTERNAL_EVENT:
-  Im.EventImport.Attribute = Import.Event.Attribute;
-  Im.EventImport.SigIndex = Import.Event.SigIndex;
+case wasm::WASM_EXTERNAL_TAG:
+  Im.TagImport.Attribute = Import.Tag.Attribute;
+  Im.TagImport.SigIndex = Import.Tag.SigIndex;
   break;
 case wasm::WASM_EXTERNAL_TABLE:
   // FIXME: Currently we always output an index of 0 for any imported
@@ -280,16 +280,16 @@
   S = std::move(MemorySec);
   break;
 }
-case wasm::WASM_SEC_EVENT: {
-  auto EventSec = std::make_unique();
-  for (auto &Event : Obj.events()) {
-WasmYAML::Event E;
-E.Index = Event.Index;
-E.Attribute = Event.Type.Attribute;
-E.SigIndex = Event.Type.SigIndex;
-EventSec->Events.push_back(E);
+case wasm::WASM_SEC_TAG: {
+  auto TagSec = std::make_unique();
+  for (auto &Tag : Obj.tags()) {
+WasmYAML::Tag T;
+T.Index = Tag.Index;
+T.Attribute = Tag.Type.Attribute;
+T.SigIndex = Tag.Type.SigIndex;
+TagSec->Tags.push_back

[Lldb-commits] [PATCH] D104423: [WebAssembly] Rename event to tag

2021-06-16 Thread Heejin Ahn via Phabricator via lldb-commits
aheejin planned changes to this revision.
aheejin added a comment.
Herald added a subscriber: JDevlieghere.

Oh, forgot to fix comments... will fix soon


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104423

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


[Lldb-commits] [PATCH] D104423: [WebAssembly] Rename event to tag

2021-06-16 Thread Heejin Ahn via Phabricator via lldb-commits
aheejin updated this revision to Diff 352570.
aheejin added a comment.

Update comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104423

Files:
  lld/include/lld/Common/LLVM.h
  lld/test/wasm/Inputs/event-section1.ll
  lld/test/wasm/Inputs/event-section2.ll
  lld/test/wasm/Inputs/tag-section1.ll
  lld/test/wasm/Inputs/tag-section2.ll
  lld/test/wasm/event-section.ll
  lld/test/wasm/tag-section.ll
  lld/wasm/InputChunks.cpp
  lld/wasm/InputElement.h
  lld/wasm/InputFiles.cpp
  lld/wasm/InputFiles.h
  lld/wasm/MarkLive.cpp
  lld/wasm/OutputSections.cpp
  lld/wasm/SymbolTable.cpp
  lld/wasm/SymbolTable.h
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/SyntheticSections.cpp
  lld/wasm/SyntheticSections.h
  lld/wasm/Writer.cpp
  lld/wasm/WriterUtils.cpp
  lld/wasm/WriterUtils.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/BinaryFormat/WasmRelocs.def
  llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
  llvm/include/llvm/MC/MCSymbolWasm.h
  llvm/include/llvm/Object/Wasm.h
  llvm/include/llvm/ObjectYAML/WasmYAML.h
  llvm/lib/BinaryFormat/Wasm.cpp
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/RelocationResolver.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/ObjectYAML/WasmEmitter.cpp
  llvm/lib/ObjectYAML/WasmYAML.cpp
  llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/test/CodeGen/WebAssembly/exception.ll
  llvm/test/CodeGen/WebAssembly/null-streamer.ll
  llvm/test/MC/WebAssembly/annotations.s
  llvm/test/MC/WebAssembly/basic-assembly.s
  llvm/test/MC/WebAssembly/event-section-decoding.ll
  llvm/test/MC/WebAssembly/event-section.ll
  llvm/test/MC/WebAssembly/tag-section-decoding.ll
  llvm/test/MC/WebAssembly/tag-section.ll
  llvm/test/ObjectYAML/wasm/event_section.yaml
  llvm/tools/llvm-readobj/WasmDumper.cpp
  llvm/tools/obj2yaml/wasm2yaml.cpp

Index: llvm/tools/obj2yaml/wasm2yaml.cpp
===
--- llvm/tools/obj2yaml/wasm2yaml.cpp
+++ llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -132,7 +132,7 @@
   case wasm::WASM_SYMBOL_TYPE_FUNCTION:
   case wasm::WASM_SYMBOL_TYPE_GLOBAL:
   case wasm::WASM_SYMBOL_TYPE_TABLE:
-  case wasm::WASM_SYMBOL_TYPE_EVENT:
+  case wasm::WASM_SYMBOL_TYPE_TAG:
 Info.ElementIndex = Symbol.ElementIndex;
 break;
   case wasm::WASM_SYMBOL_TYPE_SECTION:
@@ -238,9 +238,9 @@
   Im.GlobalImport.Type = Import.Global.Type;
   Im.GlobalImport.Mutable = Import.Global.Mutable;
   break;
-case wasm::WASM_EXTERNAL_EVENT:
-  Im.EventImport.Attribute = Import.Event.Attribute;
-  Im.EventImport.SigIndex = Import.Event.SigIndex;
+case wasm::WASM_EXTERNAL_TAG:
+  Im.TagImport.Attribute = Import.Tag.Attribute;
+  Im.TagImport.SigIndex = Import.Tag.SigIndex;
   break;
 case wasm::WASM_EXTERNAL_TABLE:
   // FIXME: Currently we always output an index of 0 for any imported
@@ -280,16 +280,16 @@
   S = std::move(MemorySec);
   break;
 }
-case wasm::WASM_SEC_EVENT: {
-  auto EventSec = std::make_unique();
-  for (auto &Event : Obj.events()) {
-WasmYAML::Event E;
-E.Index = Event.Index;
-E.Attribute = Event.Type.Attribute;
-E.SigIndex = Event.Type.SigIndex;
-EventSec->Events.push_back(E);
+case wasm::WASM_SEC_TAG: {
+  auto TagSec = std::make_unique();
+  for (auto &Tag : Obj.tags()) {
+WasmYAML::Tag T;
+T.Index = Tag.Index;
+T.Attribute = Tag.Type.Attribute;
+T.SigIndex = Tag.Type.SigIndex;
+TagSec->Tags.push_back(T);
   }
-  S = std::move(EventSec);
+  S = std::move(TagSec);
   break;
 }
 case wasm::WASM_SEC_GLOBAL: {
Index: llvm/tools/llvm-readobj/WasmDumper.cpp
===
--- llvm/tools/llvm-readobj/WasmDumper.cpp
+++ llvm/tools/llvm-readobj/WasmDumper.cpp
@@ -23,8 +23,8 @@
 static const EnumEntry WasmSymbolTypes[] = {
 #define ENUM_ENTRY(X)  \
   { #X, wasm::WASM_SYMBOL_TYPE_##X }
-ENUM_ENTRY(FUNCTION), ENUM_ENTRY(DATA),  ENUM_ENTRY(GLOBAL),

[Lldb-commits] [PATCH] D104423: [WebAssembly] Rename event to tag

2021-06-16 Thread Heejin Ahn via Phabricator via lldb-commits
aheejin updated this revision to Diff 352571.
aheejin added a comment.

Typo fixes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104423

Files:
  lld/include/lld/Common/LLVM.h
  lld/test/wasm/Inputs/event-section1.ll
  lld/test/wasm/Inputs/event-section2.ll
  lld/test/wasm/Inputs/tag-section1.ll
  lld/test/wasm/Inputs/tag-section2.ll
  lld/test/wasm/event-section.ll
  lld/test/wasm/tag-section.ll
  lld/wasm/InputChunks.cpp
  lld/wasm/InputElement.h
  lld/wasm/InputFiles.cpp
  lld/wasm/InputFiles.h
  lld/wasm/MarkLive.cpp
  lld/wasm/OutputSections.cpp
  lld/wasm/SymbolTable.cpp
  lld/wasm/SymbolTable.h
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/SyntheticSections.cpp
  lld/wasm/SyntheticSections.h
  lld/wasm/Writer.cpp
  lld/wasm/WriterUtils.cpp
  lld/wasm/WriterUtils.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/BinaryFormat/WasmRelocs.def
  llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
  llvm/include/llvm/MC/MCSymbolWasm.h
  llvm/include/llvm/Object/Wasm.h
  llvm/include/llvm/ObjectYAML/WasmYAML.h
  llvm/lib/BinaryFormat/Wasm.cpp
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/RelocationResolver.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/ObjectYAML/WasmEmitter.cpp
  llvm/lib/ObjectYAML/WasmYAML.cpp
  llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/test/CodeGen/WebAssembly/exception.ll
  llvm/test/CodeGen/WebAssembly/null-streamer.ll
  llvm/test/MC/WebAssembly/annotations.s
  llvm/test/MC/WebAssembly/basic-assembly.s
  llvm/test/MC/WebAssembly/event-section-decoding.ll
  llvm/test/MC/WebAssembly/event-section.ll
  llvm/test/MC/WebAssembly/tag-section-decoding.ll
  llvm/test/MC/WebAssembly/tag-section.ll
  llvm/test/ObjectYAML/wasm/event_section.yaml
  llvm/tools/llvm-readobj/WasmDumper.cpp
  llvm/tools/obj2yaml/wasm2yaml.cpp

Index: llvm/tools/obj2yaml/wasm2yaml.cpp
===
--- llvm/tools/obj2yaml/wasm2yaml.cpp
+++ llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -132,7 +132,7 @@
   case wasm::WASM_SYMBOL_TYPE_FUNCTION:
   case wasm::WASM_SYMBOL_TYPE_GLOBAL:
   case wasm::WASM_SYMBOL_TYPE_TABLE:
-  case wasm::WASM_SYMBOL_TYPE_EVENT:
+  case wasm::WASM_SYMBOL_TYPE_TAG:
 Info.ElementIndex = Symbol.ElementIndex;
 break;
   case wasm::WASM_SYMBOL_TYPE_SECTION:
@@ -238,9 +238,9 @@
   Im.GlobalImport.Type = Import.Global.Type;
   Im.GlobalImport.Mutable = Import.Global.Mutable;
   break;
-case wasm::WASM_EXTERNAL_EVENT:
-  Im.EventImport.Attribute = Import.Event.Attribute;
-  Im.EventImport.SigIndex = Import.Event.SigIndex;
+case wasm::WASM_EXTERNAL_TAG:
+  Im.TagImport.Attribute = Import.Tag.Attribute;
+  Im.TagImport.SigIndex = Import.Tag.SigIndex;
   break;
 case wasm::WASM_EXTERNAL_TABLE:
   // FIXME: Currently we always output an index of 0 for any imported
@@ -280,16 +280,16 @@
   S = std::move(MemorySec);
   break;
 }
-case wasm::WASM_SEC_EVENT: {
-  auto EventSec = std::make_unique();
-  for (auto &Event : Obj.events()) {
-WasmYAML::Event E;
-E.Index = Event.Index;
-E.Attribute = Event.Type.Attribute;
-E.SigIndex = Event.Type.SigIndex;
-EventSec->Events.push_back(E);
+case wasm::WASM_SEC_TAG: {
+  auto TagSec = std::make_unique();
+  for (auto &Tag : Obj.tags()) {
+WasmYAML::Tag T;
+T.Index = Tag.Index;
+T.Attribute = Tag.Type.Attribute;
+T.SigIndex = Tag.Type.SigIndex;
+TagSec->Tags.push_back(T);
   }
-  S = std::move(EventSec);
+  S = std::move(TagSec);
   break;
 }
 case wasm::WASM_SEC_GLOBAL: {
Index: llvm/tools/llvm-readobj/WasmDumper.cpp
===
--- llvm/tools/llvm-readobj/WasmDumper.cpp
+++ llvm/tools/llvm-readobj/WasmDumper.cpp
@@ -23,8 +23,8 @@
 static const EnumEntry WasmSymbolTypes[] = {
 #define ENUM_ENTRY(X)  \
   { #X, wasm::WASM_SYMBOL_TYPE_##X }
-ENUM_ENTRY(FUNCTION), ENUM_ENTRY(DATA),  ENUM_ENTRY(GLOBAL),
-  

[Lldb-commits] [PATCH] D103626: [lldb][AArch64] Remove non address bits from memory read arguments

2021-06-16 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid requested changes to this revision.
omjavaid added a comment.
This revision now requires changes to proceed.

This doesnt build ... you need to include #include "lldb/Target/ABI.h" in 
lldb/source/Commands/CommandObjectMemory.cpp




Comment at: 
lldb/test/API/linux/aarch64/tagged_memory_read/TestAArch64LinuxTaggedMemoryRead.py:22
+@skipUnlessPlatform(["linux"])
+def test_mte_regions(self):
+if not self.isAArch64PAuth():

May be consider renaming this test case.



Comment at: 
lldb/test/API/linux/aarch64/tagged_memory_read/TestAArch64LinuxTaggedMemoryRead.py:23
+def test_mte_regions(self):
+if not self.isAArch64PAuth():
+self.skipTest('Target must support pointer authentication.')

This condition will always be true because we havent yet connected to remote 
platform.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103626

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


[Lldb-commits] [PATCH] D103626: [lldb][AArch64] Remove non address bits from memory read arguments

2021-06-16 Thread Peter Collingbourne via Phabricator via lldb-commits
pcc added a comment.

In D103626#2796554 , @DavidSpickett 
wrote:

> The side effect here is that you do "memory read " and you see 
> untagged addresses for the lines. It's not really that confusing but maybe 
> something we should make a general decision about.
>
> Same thing applies to the previous "memory region" patch.
>
>   (lldb) p ptr1
>   (char *) $1 = 0x344dfcb0 ""
>   (lldb) memory read ptr1
>   0xfcb0: f0 05 40 00 00 00 00 00 00 00 00 00 00 00 00 00  
> ..@.
>   0xfcc0: e0 fc ff ff ff ff 00 00 54 f0 e7 f7 ff ff 00 00  
> T...
>   (lldb) memory region ptr1
>   [0xfffdf000-0x0001) rw- [stack]
>
> Personally it doesn't bother me, but then again I know what all the upper 
> bits are doing anyway.

In Android tombstones we display the memory tag inline with the address, e.g.

  memory near x8 ([anon:scudo:primary]):
  0079fd11a1d0    
  0079fd11a1e0 84e400020402 37ecb699a1b3  .7..
  0f79fd11a1f0    
  0f79fd11a200    
  0079fd11a210    
  0079fd11a220    
  0079fd11a230    
  0079fd11a240    
  0079fd11a250    
  0079fd11a260    
  0079fd11a270    
  0079fd11a280    
  0079fd11a290    
  0079fd11a2a0    
  0079fd11a2b0    
  0079fd11a2c0    

Maybe this is something worth considering for LLDB memory dumps?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103626

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


[Lldb-commits] [PATCH] D104422: [trace] Add a TraceCursor class

2021-06-16 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/include/lldb/Target/Trace.h:224
+  /// failed to load, an \a llvm::Error is returned.
+  virtual llvm::Expected GetThreadEndCursor(
+  Thread &thread,

If the trace cursor contains an error, do we need llvm::Expected here? Maybe 
return a std::unique_ptr since the cursor can indicate any errors. 
I am assuming you did a shared pointer to make it easier to eventually push 
this into the lldb::SB API? a unique pointer works great for the SBAPI and no 
one will ever need a shared reference to one of these.



Comment at: lldb/include/lldb/Target/Trace.h:226-227
+  Thread &thread,
+  lldb::TraceInstructionType filter = lldb::eTraceInstructionTypeAny,
+  bool ignore_errors = false) = 0;
+

We don' t need these arguments right? These are only needed for the 
TraceCursor::Next(...) and TraceCursor::Prev(...) right?



Comment at: lldb/include/lldb/Target/Trace.h:231
+  /// instruction instead.
+  virtual llvm::Expected GetThreadBeginCursor(
+  Thread &thread,

Ditto, return std::unique_ptr?



Comment at: lldb/include/lldb/Target/Trace.h:233-234
+  Thread &thread,
+  lldb::TraceInstructionType filter = lldb::eTraceInstructionTypeAny,
+  bool ignore_errors = false) = 0;
+

We don' t need these arguments right? These are only needed for the 
TraceCursor::Next(...) and TraceCursor::Prev(...) right?



Comment at: lldb/include/lldb/Target/Trace.h:235
+  bool ignore_errors = false) = 0;
+
   /// Get the number of available instructions in the trace of the given 
thread.

Should there just be a single Trace::GetCursor() and then we can just add some 
more TraceInstructionType bits? My thinking is the cursor would always return 
an end cursor and we could do something like:
```
std::unique_ptr end_cursor_up = trace-GetCursor(thread);
std::unique_ptr begin_cursor_up = trace-GetCursor(thread);
begin_cursor_up->Prev(eTraceInstructionTypeBegin);
```





Comment at: lldb/include/lldb/Target/TraceCursor.h:39
+///
+class TraceCursor {
+public:

I am assuming all function calls need to be pure virtual here so that each 
plug-in can subclass this?



Comment at: lldb/include/lldb/Target/TraceCursor.h:61
+  /// Similar to \a TraceCursor::Next(), but moves backwards chronologically.
+  bool Prev();
+

Do we not need the filter and ignore errors arguments for this as well?



Comment at: lldb/include/lldb/Target/TraceCursor.h:72-75
+  /// \return
+  /// \b true if the cursor is pointing to an error in the trace. The 
actual
+  /// error message can be gotten by calling \a TraceCursor::GetError().
+  bool IsError();

Do we need this if we have GetError?



Comment at: lldb/include/lldb/Target/TraceCursor.h:79
+  /// \b nullptr if the cursor is not pointing to an error in the trace.
+  /// Otherwise return an error message describing the issue.
+  const char *GetError();

What is the intended ownership of this string? If this object would own it, 
maybe add a "std::string m_error;" member variable to this class to store any 
error strings.



Comment at: lldb/include/lldb/Target/TraceCursor.h:88
+  /// \return
+  /// The size in bytes of the instruction. If the cursor points to an 
error
+  /// in the trace, return \b 0.

describe what the size means a bit better? Is the size of instructions going to 
be larger if we go to the next Jump or call?



Comment at: lldb/include/lldb/lldb-enumerations.h:963
+/// analysis on traces.
+FLAGS_ENUM(TraceInstructionType){
+/// Any instruction not listed below.

Maybe "TraceCursorGranularity"? the "Type" suffix seems to indicate individual 
types



Comment at: lldb/include/lldb/lldb-enumerations.h:964-965
+FLAGS_ENUM(TraceInstructionType){
+/// Any instruction not listed below.
+eTraceInstructionTypeNormal = (1u << 1),
+/// This includes both conditional and unconditional jumps.





Comment at: lldb/include/lldb/lldb-enumerations.h:966-967
+eTraceInstructionTypeNormal = (1u << 1),
+/// This includes both conditional and unconditional jumps.
+eTraceInstructionTypeJump = (1u << 2),
+/// This represents a call to a function.

Maybe have two things for branches? Something like:
```
/// Any branch instruction even if the branch is conditional and not taken.
eTraceInstructionTypeBranch,
/// Only branches that are taken and cause the control flow to change.
eTraceInstructionTypeBranchTaken,
```
This might help avoid multiple calls to the cursor if the user doesn't need to 
worry about branches that aren't taken (like when single stepping maybe?)


[Lldb-commits] [PATCH] D104423: [WebAssembly] Rename event to tag

2021-06-16 Thread Heejin Ahn via Phabricator via lldb-commits
aheejin updated this revision to Diff 352590.
aheejin added a comment.

clang-tidy fix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104423

Files:
  lld/include/lld/Common/LLVM.h
  lld/test/wasm/Inputs/event-section1.ll
  lld/test/wasm/Inputs/event-section2.ll
  lld/test/wasm/Inputs/tag-section1.ll
  lld/test/wasm/Inputs/tag-section2.ll
  lld/test/wasm/event-section.ll
  lld/test/wasm/tag-section.ll
  lld/wasm/InputChunks.cpp
  lld/wasm/InputElement.h
  lld/wasm/InputFiles.cpp
  lld/wasm/InputFiles.h
  lld/wasm/MarkLive.cpp
  lld/wasm/OutputSections.cpp
  lld/wasm/SymbolTable.cpp
  lld/wasm/SymbolTable.h
  lld/wasm/Symbols.cpp
  lld/wasm/Symbols.h
  lld/wasm/SyntheticSections.cpp
  lld/wasm/SyntheticSections.h
  lld/wasm/Writer.cpp
  lld/wasm/WriterUtils.cpp
  lld/wasm/WriterUtils.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  llvm/include/llvm/BinaryFormat/Wasm.h
  llvm/include/llvm/BinaryFormat/WasmRelocs.def
  llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
  llvm/include/llvm/MC/MCSymbolWasm.h
  llvm/include/llvm/Object/Wasm.h
  llvm/include/llvm/ObjectYAML/WasmYAML.h
  llvm/lib/BinaryFormat/Wasm.cpp
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Object/RelocationResolver.cpp
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/lib/ObjectYAML/WasmEmitter.cpp
  llvm/lib/ObjectYAML/WasmYAML.cpp
  llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
  llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
  llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
  llvm/test/CodeGen/WebAssembly/exception.ll
  llvm/test/CodeGen/WebAssembly/null-streamer.ll
  llvm/test/MC/WebAssembly/annotations.s
  llvm/test/MC/WebAssembly/basic-assembly.s
  llvm/test/MC/WebAssembly/event-section-decoding.ll
  llvm/test/MC/WebAssembly/event-section.ll
  llvm/test/MC/WebAssembly/tag-section-decoding.ll
  llvm/test/MC/WebAssembly/tag-section.ll
  llvm/test/ObjectYAML/wasm/event_section.yaml
  llvm/tools/llvm-readobj/WasmDumper.cpp
  llvm/tools/obj2yaml/wasm2yaml.cpp

Index: llvm/tools/obj2yaml/wasm2yaml.cpp
===
--- llvm/tools/obj2yaml/wasm2yaml.cpp
+++ llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -132,7 +132,7 @@
   case wasm::WASM_SYMBOL_TYPE_FUNCTION:
   case wasm::WASM_SYMBOL_TYPE_GLOBAL:
   case wasm::WASM_SYMBOL_TYPE_TABLE:
-  case wasm::WASM_SYMBOL_TYPE_EVENT:
+  case wasm::WASM_SYMBOL_TYPE_TAG:
 Info.ElementIndex = Symbol.ElementIndex;
 break;
   case wasm::WASM_SYMBOL_TYPE_SECTION:
@@ -238,9 +238,9 @@
   Im.GlobalImport.Type = Import.Global.Type;
   Im.GlobalImport.Mutable = Import.Global.Mutable;
   break;
-case wasm::WASM_EXTERNAL_EVENT:
-  Im.EventImport.Attribute = Import.Event.Attribute;
-  Im.EventImport.SigIndex = Import.Event.SigIndex;
+case wasm::WASM_EXTERNAL_TAG:
+  Im.TagImport.Attribute = Import.Tag.Attribute;
+  Im.TagImport.SigIndex = Import.Tag.SigIndex;
   break;
 case wasm::WASM_EXTERNAL_TABLE:
   // FIXME: Currently we always output an index of 0 for any imported
@@ -280,16 +280,16 @@
   S = std::move(MemorySec);
   break;
 }
-case wasm::WASM_SEC_EVENT: {
-  auto EventSec = std::make_unique();
-  for (auto &Event : Obj.events()) {
-WasmYAML::Event E;
-E.Index = Event.Index;
-E.Attribute = Event.Type.Attribute;
-E.SigIndex = Event.Type.SigIndex;
-EventSec->Events.push_back(E);
+case wasm::WASM_SEC_TAG: {
+  auto TagSec = std::make_unique();
+  for (auto &Tag : Obj.tags()) {
+WasmYAML::Tag T;
+T.Index = Tag.Index;
+T.Attribute = Tag.Type.Attribute;
+T.SigIndex = Tag.Type.SigIndex;
+TagSec->Tags.push_back(T);
   }
-  S = std::move(EventSec);
+  S = std::move(TagSec);
   break;
 }
 case wasm::WASM_SEC_GLOBAL: {
Index: llvm/tools/llvm-readobj/WasmDumper.cpp
===
--- llvm/tools/llvm-readobj/WasmDumper.cpp
+++ llvm/tools/llvm-readobj/WasmDumper.cpp
@@ -23,8 +23,8 @@
 static const EnumEntry WasmSymbolTypes[] = {
 #define ENUM_ENTRY(X)  \
   { #X, wasm::WASM_SYMBOL_TYPE_##X }
-ENUM_ENTRY(FUNCTION), ENUM_ENTRY(DATA),  ENUM_ENTRY(GLOBAL),

[Lldb-commits] [PATCH] D104395: [LLDB][GUI] Add initial forms support

2021-06-16 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Looks very nice.

A few things to consider here, and I am open to everyone's opinion here, did 
you consider implementing each field as a Window? It seems that a lot of the 
window code is duplicated, DrawBox for one. I know we would need to make 
modifications to the Window class if this, but just something to think about. 
It might be more trouble that it is worth.

Another question I have is if we want a box around each field and do we want 
the user to be able to select the exact location of each item? Right now we can 
make a nice UI with almost window like fields, but I worry that if we have a 
lot of fields and they don't fit in the window, how complex it the scrolling 
code going to be? Another way would be to make a list of fields. And you add 
them in the order you want them to show up in the list. There could be no boxes 
around each field in this case and the window could look more like a list in 
this case. I will try and show with some ASCII art what I was thinking:

  /\
  | Path: /tmp/a.out   |
  | Number: 1234   |
  | Boolean: true  |
  | Choices: Choice 1  |
  ||
  |  [ SUBMIT ]|
  \/

This might make it easier to implement scrolling if there are too many entries 
to fit on the screen.

Future things we can add would include:

- a field grouping field that would not take any input, but it would allow 
fields to be grouped into sections
- subclasses of the text field that allow for things like paths which might 
auto complete and allow only files or directories to be selected based on 
constructor args
- an array of a specific kind of fields, like for program arguments that would 
take a FieldDelegate and allow for a list to be created




Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:432-440
+  void PutCStringTruncatedWidth(int right_pad, const char *s, int width,
+int len = -1) {
+int bytes_left = width - GetCursorX();
 if (bytes_left > right_pad) {
   bytes_left -= right_pad;
   ::waddnstr(m_window, s, len < 0 ? bytes_left : std::min(bytes_left, 
len));
 }

move this below function below PutCStringTruncated so that PutCStringTruncated 
doesn't appear to be edited.



Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:713
+PutChar('[');
+PutCString(title);
+PutChar(']');

Do we need to use PutCStringTruncated here just in case?



Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:935-937
+  : m_label(label), m_width(width), m_origin(origin), m_content(content),
+m_cursor_position(0), m_first_visibile_char(0) {
+assert(m_width > 2);

"m_content(content):" will crash if content is NULL.



Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:962
+
+  int GetContentLength() { return (int)m_content.length(); }
+

Does this need to be an integer? Can we return "size_t"?



Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:1060
+  // Returns the text content of the field.
+  std::string GetText() { return m_content; }
+

Return const reference to avoid copy. If use wants to copy it, they can assign 
to a local



Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:1108
+  window.AttributeOn(A_REVERSE);
+window.PutChar(m_content ? 'X' : ' ');
+if (is_active)

We could use ACS_DIAMOND or ACS_BULLET? Check it out and see how it looks?



Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:1120
+switch (key) {
+case ' ':
+  ToggleContent();

enter or return key as well? or is that saved for submit in the main window?



Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:1442
+  // The index of the selected field. This can be equal to the number of 
fields,
+  // in which case, it denotes that the button is selected.
+  int m_selected_field_index;

The submit button?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104395

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


[Lldb-commits] [lldb] 42e2a90 - Relax language comparison when matching up C++ forward decls with definitions

2021-06-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2021-06-16T18:21:43-07:00
New Revision: 42e2a90684196d6ffadf785e98ea5de0876b4a3e

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

LOG: Relax language comparison when matching up C++ forward decls with 
definitions

when dealing with -gmodules debug info.

This fixes the bot failures on Darwin.

A recent clang change (presumably https://reviews.llvm.org/D104291)
introduced a bug where .pcm files would identify themselves as
DW_LANG_C_plus_plus, but the .o that references them would identify as
DW_LANG_C_plus_plus_14. While that bug needs to be fixed, too, it
shows that the current strict comparison also isn't meaningful.

rdar://79423225

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 45c40c1c0c9ed..6035b5714261a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -157,7 +157,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const 
SymbolContext &sc,
 
   // The type in the Clang module must have the same language as the current 
CU.
   LanguageSet languages;
-  languages.Insert(SymbolFileDWARF::GetLanguage(*die.GetCU()));
+  languages.Insert(SymbolFileDWARF::GetLanguageFamily(*die.GetCU()));
   llvm::DenseSet searched_symbol_files;
   clang_module_sp->GetSymbolFile()->FindTypes(decl_context, languages,
   searched_symbol_files, 
pcm_types);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 494622fdd24ee..ca02d64709e89 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2412,7 +2412,7 @@ void SymbolFileDWARF::FindTypes(
 return;
 
   m_index->GetTypes(name, [&](DWARFDIE die) {
-if (!languages[GetLanguage(*die.GetCU())])
+if (!languages[GetLanguageFamily(*die.GetCU())])
   return true;
 
 llvm::SmallVector die_context;
@@ -3886,3 +3886,10 @@ LanguageType 
SymbolFileDWARF::LanguageTypeFromDWARF(uint64_t val) {
 LanguageType SymbolFileDWARF::GetLanguage(DWARFUnit &unit) {
   return LanguageTypeFromDWARF(unit.GetDWARFLanguageType());
 }
+
+LanguageType SymbolFileDWARF::GetLanguageFamily(DWARFUnit &unit) {
+  auto lang = (llvm::dwarf::SourceLanguage)unit.GetDWARFLanguageType();
+  if (llvm::dwarf::isCPlusPlus(lang))
+lang = DW_LANG_C_plus_plus;
+  return LanguageTypeFromDWARF(lang);
+}

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 85dc383e22681..d9feeef549edf 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -317,6 +317,8 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
   static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val);
 
   static lldb::LanguageType GetLanguage(DWARFUnit &unit);
+  /// Same as GetLanguage() but reports all C++ versions as C++ (no version).
+  static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit);
 
 protected:
   typedef llvm::DenseMap



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


[Lldb-commits] [PATCH] D103500: [trace][intel-pt] Create basic SB API

2021-06-16 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

a few nits!




Comment at: lldb/include/lldb/API/SBTarget.h:847
+  /// \return
+  ///   The trace object. It might be undefined.
+  lldb::SBTrace GetTrace();

rephrase the "It might be undefined.". Maybe "The returned SBTrace object might 
not be valid, check with a call to "bool SBTrace::IsValid();" to check."



Comment at: lldb/include/lldb/Target/Trace.h:256
+  virtual llvm::Error Start(
+  const std::vector &tids,
+  StructuredData::ObjectSP configuration = StructuredData::ObjectSP()) = 0;

ArrayRef?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103500

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


[Lldb-commits] [PATCH] D104422: [trace] Add a TraceCursor class

2021-06-16 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 352605.
wallace added a comment.

- Simplified Trace.h by simply having lldb::TraceCursorUP GetCursor, as 
suggested.
- Improved the documentation including a sample code.
- Added methods to quickly move the trace to the beginning or the end.
- Renamed TraceInstructionType to TraceInstructionControlFlowType. I'm not 
happy with the long name though. I didn't stick to the granularity name because 
it's useful to know the control flow information of the current instruction, 
e.g. you might be traversing the instructions one by one but you want to log 
whenever you see a call.
- Also added a dummy "end of trace" invalid instruction. It helps iterating 
making sure that only the wanted instructions are seen. The other option, which 
I don't like, is to point to the last actual instruction of the trace, which 
might not be what the user wants and they would need to make a additional check 
for it before the loop.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104422

Files:
  lldb/include/lldb/Target/Trace.h
  lldb/include/lldb/Target/TraceCursor.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/include/lldb/lldb-forward.h

Index: lldb/include/lldb/lldb-forward.h
===
--- lldb/include/lldb/lldb-forward.h
+++ lldb/include/lldb/lldb-forward.h
@@ -229,6 +229,7 @@
 class ThreadSpec;
 class ThreadPostMortemTrace;
 class Trace;
+class TraceCursor;
 class TraceSessionFileParser;
 class Type;
 class TypeAndOrName;
@@ -441,6 +442,7 @@
 typedef std::weak_ptr ThreadPlanWP;
 typedef std::shared_ptr ThreadPlanTracerSP;
 typedef std::shared_ptr TraceSP;
+typedef std::unique_ptr TraceCursorUP;
 typedef std::shared_ptr TypeSP;
 typedef std::weak_ptr TypeWP;
 typedef std::shared_ptr TypeCategoryImplSP;
Index: lldb/include/lldb/lldb-enumerations.h
===
--- lldb/include/lldb/lldb-enumerations.h
+++ lldb/include/lldb/lldb-enumerations.h
@@ -958,6 +958,25 @@
   eExpressionEvaluationComplete
 };
 
+/// Architecture-agnostic categorization of instructions for traversing the
+/// control flow of a trace.
+///
+/// A single instruction can match one or more of these categories.
+FLAGS_ENUM(TraceCursorInstructionType){
+/// Any instruction.
+eTraceCursorInstructionTypeInstruction = (1u << 1),
+/// A conditional or unconditional branch/jump.
+eTraceCursorInstructionTypeBranch = (1u << 2),
+/// A conditional or unconditional branch/jump that changed
+/// the control flow of the program.
+eTraceCursorInstructionTypeTakenBranch = (1u << 3),
+/// A next call to a function.
+eTraceCursorInstructionTypeCall = (1u << 4),
+/// A return from a function.
+eTraceCursorInstructionTypeReturn = (1u << 5)}
+
+LLDB_MARK_AS_BITMASK_ENUM(TraceCursorInstructionType)
+
 /// Watchpoint Kind.
 ///
 /// Indicates what types of events cause the watchpoint to fire. Used by Native
Index: lldb/include/lldb/Target/TraceCursor.h
===
--- /dev/null
+++ lldb/include/lldb/Target/TraceCursor.h
@@ -0,0 +1,137 @@
+//===-- TraceCursor.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_TARGET_TRACE_CURSOR_H
+#define LLDB_TARGET_TRACE_CURSOR_H
+
+#include "lldb/lldb-private.h"
+
+namespace lldb_private {
+
+/// Class used for iterating over the instructions of a thread's trace.
+///
+/// This class attempts to be a generic interface for accessing the instructions
+/// of the trace so that each Trace plug-in can reconstruct, represent and store
+/// the instruction data in an flexible way that is efficient for the given
+/// technology.
+///
+/// Live processes:
+///  In the case of a live process trace, an instance of a \a TraceCursor should
+///  point to the trace at the moment it was collected. If the process is later
+///  resumed and new trace data is collected, that should leave that old cursor
+///  unaffected.
+///
+/// Errors in the trace:
+///  As there could be errors when reconstructing the instructions of a trace,
+///  these errors are represented as failed instructions, and the cursor can
+///  point at them. The consumer should invoke \a TraceCursor::GetError() to
+///  check if the cursor is pointing to either a valid instruction or an error.
+///
+/// Instructions:
+///  A \a TraceCursor always points to a specific instruction or error in the
+///  trace.
+///
+///  The Trace initially points to a dummy invalid instruction error signaling
+///  the end of a trace, similar to a C++ collections'

[Lldb-commits] [PATCH] D104437: Add test for functions with extended characters.

2021-06-16 Thread Neal via Phabricator via lldb-commits
nealsid created this revision.
nealsid added a reviewer: LLDB.
nealsid requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This small patch adds a test for functions & lldb commands with unicode 
characters in them.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104437

Files:
  lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
  lldb/test/Shell/Breakpoint/unicode-function-name.test


Index: lldb/test/Shell/Breakpoint/unicode-function-name.test
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/unicode-function-name.test
@@ -0,0 +1,11 @@
+# RUN: %build% %p/Inputs/unicode-function-name.c --nodefaultlib -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+
+break set -n Δ
+# CHECK: Breakpoint 1:
+
+run
+# CHECK: Process {{[0-9]+}} stopped
+
+print ΔΔ
+# CHECK: (int) $0 = 5
\ No newline at end of file
Index: lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
@@ -0,0 +1,6 @@
+int Δ(int ΔΔ) { return ΔΔ; }
+
+int main(int argc, char *argv[]) {
+  int x = Δ(5);
+  return 0;
+}


Index: lldb/test/Shell/Breakpoint/unicode-function-name.test
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/unicode-function-name.test
@@ -0,0 +1,11 @@
+# RUN: %build% %p/Inputs/unicode-function-name.c --nodefaultlib -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+
+break set -n Δ
+# CHECK: Breakpoint 1:
+
+run
+# CHECK: Process {{[0-9]+}} stopped
+
+print ΔΔ
+# CHECK: (int) $0 = 5
\ No newline at end of file
Index: lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
@@ -0,0 +1,6 @@
+int Δ(int ΔΔ) { return ΔΔ; }
+
+int main(int argc, char *argv[]) {
+  int x = Δ(5);
+  return 0;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104437: Add test for functions with extended characters.

2021-06-16 Thread Neal via Phabricator via lldb-commits
nealsid updated this revision to Diff 352612.
nealsid added a comment.
Herald added a subscriber: JDevlieghere.

Add newline.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104437

Files:
  lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
  lldb/test/Shell/Breakpoint/unicode-function-name.test


Index: lldb/test/Shell/Breakpoint/unicode-function-name.test
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/unicode-function-name.test
@@ -0,0 +1,11 @@
+# RUN: %build% %p/Inputs/unicode-function-name.c --nodefaultlib -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+
+break set -n Δ
+# CHECK: Breakpoint 1:
+
+run
+# CHECK: Process {{[0-9]+}} stopped
+
+print ΔΔ
+# CHECK: (int) $0 = 5
Index: lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
@@ -0,0 +1,6 @@
+int Δ(int ΔΔ) { return ΔΔ; }
+
+int main(int argc, char *argv[]) {
+  int x = Δ(5);
+  return 0;
+}


Index: lldb/test/Shell/Breakpoint/unicode-function-name.test
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/unicode-function-name.test
@@ -0,0 +1,11 @@
+# RUN: %build% %p/Inputs/unicode-function-name.c --nodefaultlib -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+
+break set -n Δ
+# CHECK: Breakpoint 1:
+
+run
+# CHECK: Process {{[0-9]+}} stopped
+
+print ΔΔ
+# CHECK: (int) $0 = 5
Index: lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/Inputs/unicode-function-name.c
@@ -0,0 +1,6 @@
+int Δ(int ΔΔ) { return ΔΔ; }
+
+int main(int argc, char *argv[]) {
+  int x = Δ(5);
+  return 0;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104423: [WebAssembly] Rename event to tag

2021-06-16 Thread Thomas Lively via Phabricator via lldb-commits
tlively accepted this revision.
tlively added a comment.
This revision is now accepted and ready to land.

LGTM! My only comments are about wording in some of the code comments.




Comment at: lld/wasm/Symbols.h:419
+// attribute and a type. Currently the attribute can only specify that the tag
+// is for the exception.
 //





Comment at: lld/wasm/Symbols.h:421
 //
-// Event tags are values to distinguish different events. For exceptions, they
-// can be used to distinguish different language's exceptions, i.e., all C++
-// exceptions have the same tag. Wasm can generate code capable of doing
-// different handling actions based on the tag of caught exceptions.
+// In exception handling, tags are values to distinguish different exceptions.
+// For exceptions, they can be used to distinguish different language's





Comment at: lld/wasm/Symbols.h:422
+// In exception handling, tags are values to distinguish different exceptions.
+// For exceptions, they can be used to distinguish different language's
+// exceptions, i.e., all C++ exceptions have the same tag. Wasm can generate





Comment at: lld/wasm/Symbols.h:423-425
+// exceptions, i.e., all C++ exceptions have the same tag. Wasm can generate
+// code capable of doing different handling actions based on the tag of caught
+// exceptions.





Comment at: lld/wasm/Symbols.h:427
 //
-// A single EventSymbol object represents a single tag. C++ exception event
-// symbol is a weak symbol generated in every object file in which exceptions
-// are used, and has name '__cpp_exception' for linking.
-class EventSymbol : public Symbol {
+// A single TagSymbol object represents a single tag. C++ exception symbol is a
+// weak symbol generated in every object file in which exceptions are used, and





Comment at: lld/wasm/Symbols.h:429
+// weak symbol generated in every object file in which exceptions are used, and
+// has name '__cpp_exception' for linking.
+class TagSymbol : public Symbol {





Comment at: lld/wasm/SyntheticSections.h:176
+// contains information on what kind of tag it is (e.g. exception) and the type
+// of values contained in a single tag object. (In wasm, a tag can contain
 // multiple values of primitive types. But for C++ exceptions, we just throw a




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104423

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


[Lldb-commits] [PATCH] D104422: [trace] Add a TraceCursor class

2021-06-16 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/include/lldb/Target/TraceCursor.h:39-40
+///
+///  The Trace initially points to a dummy invalid instruction error signaling
+///  the end of a trace, similar to a C++ collections' end iterator.
+///

Should the TraceCursor point to the last instruction more like a begin() STL 
call?



Comment at: lldb/include/lldb/Target/TraceCursor.h:87
+  /// Force the cursor to point to the end of the trace.
+  virtual void ResetToEnd() = 0;
+

SeekToEnd()?



Comment at: lldb/include/lldb/Target/TraceCursor.h:90
+  /// Force the cursor to point to the first (i.e. oldest) item of the trace.
+  virtual void ResetToBegin() = 0;
+

SeekToStart()? SeekToBegin()?



Comment at: lldb/include/lldb/Target/TraceCursor.h:116-117
+  /// \return
+  /// The size in bytes of the instruction opcode the cursor is pointing 
at.
+  /// If the cursor points to an error in the trace, return \b 0.
+  virtual size_t GetInstructionSize() = 0;

Do we even need the instruction size in this cursor class interface? Clients 
can easily grab an instruction from GetLoadAddress() and do that themselves?



Comment at: lldb/include/lldb/Target/TraceCursor.h:130
+  /// The stop ID when the cursor was created.
+  ssize_t m_stop_id = -1;
+  /// The trace that owns this cursor.

Zero is the invalid stop ID.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104422

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