[Lldb-commits] [PATCH] D105788: [LLDB] Silence warnings from ScriptedProcessPythonInterface.cpp

2021-07-26 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

In D105788#2897981 , @mib wrote:

> Hi @omjavaid , please let me know if you're still seeing the warnings. Thanks.

Yes all warnings fixed now. Thanks for taking care of this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105788

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


[Lldb-commits] [PATCH] D106194: Tests for: D100299: Be lazier about loading .dwo files

2021-07-26 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

@Eric yes, it would be better to merge it with your D100299 
.

In D106194#2894795 , @Eric wrote:

> Instead of echoing into .c files, can we write the tests as .c files? It 
> seems to be a common pattern to use a single source as two sources by 
> compiling twice with different -D flags and then linking;

I agree, thanks for catching that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106194

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


[Lldb-commits] [PATCH] D105470: [lldb] Clear children of ValueObject on value update

2021-07-26 Thread Andy Yankovsky via Phabricator via lldb-commits
werat updated this revision to Diff 361649.
werat added a comment.

[clang-tidy] Always open files using UTF-8 encoding

The encoding used for opening files depends on the OS and might be different
from UTF-8 (e.g. on Windows it can be CP-1252). The documentation files use
UTF-8 and might be incompatible with other encodings. For example, right now
`clang-tools-extra/docs/clang-tidy/checks/abseil-no-internal-dependencies.rst`
has non-ASCII quotes and running `add_new_check.py` fails on Windows, because
it tries to read the file with incompatible encoding.

Use `io.open` for compatibility with both Python 2 and Python 3.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105470

Files:
  lldb/source/Core/ValueObject.cpp
  lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
  lldb/test/API/python_api/value/change_values/main.c


Index: lldb/test/API/python_api/value/change_values/main.c
===
--- lldb/test/API/python_api/value/change_values/main.c
+++ lldb/test/API/python_api/value/change_values/main.c
@@ -8,7 +8,12 @@
   uint32_t  second_val;
   uint64_t  third_val;
 };
-  
+
+struct bar
+{
+  int value;
+};
+
 int main ()
 {
   int val = 100;
@@ -18,6 +23,11 @@
   ptr->second_val = ;
   ptr->third_val = ;
 
+  struct bar _b1 = {.value = 1};
+  struct bar _b2 = {.value = 2};
+  struct bar *b1 = &_b1;
+  struct bar *b2 = &_b2;
+
   // Stop here and set values
   printf ("Val - %d Mine - %d, %d, %llu. Ptr - %d, %d, %llu\n", val, 
   mine.first_val, mine.second_val, mine.third_val,
Index: lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
===
--- lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
+++ lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
@@ -130,6 +130,41 @@
 self.assertEquals(actual_value, 98765,
 "Got the right changed value from ptr->second_val")
 
+# Test updating the children after updating the parent value.
+def test_update_parent_value(parent):
+self.assertEquals(
+parent.GetValue(),
+frame0.FindVariable("b1").GetValue())
+self.assertEquals(parent.GetChildAtIndex(0).GetValue(), "1")
+
+result = parent.SetValueFromCString(
+frame0.FindVariable("b2").GetValue())
+self.assertTrue(result, "Success setting {}".format(parent.name))
+self.assertEquals(
+parent.GetValue(),
+frame0.FindVariable("b2").GetValue())
+self.assertEquals(parent.GetChildAtIndex(0).GetValue(), "2")
+
+# Test for value returned by SBFrame::EvaluateExpression.
+test_update_parent_value(
+frame0.EvaluateExpression("auto $b_0 = b1; $b_0"))
+
+# Test for value _created_ by SBFrame::EvaluateExpression.
+frame0.EvaluateExpression("auto $b_0 = b1")
+test_update_parent_value(
+frame0.FindValue('$b_0', lldb.eValueTypeConstResult))
+
+# Test for value created by SBTarget::CreateValueFromData.
+b1 = frame0.FindVariable("b1")
+b1_size = b1.GetByteSize()
+b1_value = b1.GetValueAsUnsigned()
+b1_addr_bytes = b1_value.to_bytes(b1_size, 'little')
+error = lldb.SBError()
+data = lldb.SBData()
+data.SetData(error, b1_addr_bytes, lldb.eByteOrderLittle, b1_size)
+test_update_parent_value(
+target.CreateValueFromData("b", data, b1.GetType()))
+
 # gcc may set multiple locations for breakpoint
 breakpoint.SetEnabled(False)
 
Index: lldb/source/Core/ValueObject.cpp
===
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -231,6 +231,10 @@
   // We have to clear the value string here so ConstResult children will notice
   // if their values are changed by hand (i.e. with SetValueAsCString).
   ClearUserVisibleData(eClearUserVisibleDataItemsValue);
+  // Children have to be re-computed after updating the parent value.
+  m_flags.m_children_count_valid = false;
+  m_children.Clear();
+  SetSyntheticChildren(lldb::SyntheticChildrenSP());
 }
 
 void ValueObject::ClearDynamicTypeInformation() {


Index: lldb/test/API/python_api/value/change_values/main.c
===
--- lldb/test/API/python_api/value/change_values/main.c
+++ lldb/test/API/python_api/value/change_values/main.c
@@ -8,7 +8,12 @@
   uint32_t  second_val;
   uint64_t  third_val;
 };
-  
+
+struct bar
+{
+  int value;
+};
+
 int main ()
 {
   int val = 100;
@@ -18,6 +23,11 @@
   ptr->second_val = ;
   ptr->third_val = ;
 
+  struct bar _b1 = {.value = 1};
+  struct bar _b2 = {.value = 2};
+  struct

[Lldb-commits] [lldb] b71b250 - [test] Fix PayloadString: in lldb tests

2021-07-26 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2021-07-26T10:00:05-07:00
New Revision: b71b25008f2a746d11ed1db1f49a6461b387cc8a

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

LOG: [test] Fix PayloadString: in lldb tests

Added: 


Modified: 
lldb/test/API/macosx/version_zero/libDylib.dylib.yaml
lldb/test/Shell/ObjectFile/MachO/lc_build_version.yaml
lldb/test/Shell/ObjectFile/MachO/lc_build_version_notools.yaml
lldb/test/Shell/ObjectFile/MachO/lc_version_min.yaml
lldb/test/Shell/ObjectFile/MachO/symtab.yaml

Removed: 




diff  --git a/lldb/test/API/macosx/version_zero/libDylib.dylib.yaml 
b/lldb/test/API/macosx/version_zero/libDylib.dylib.yaml
index a672f49fb4a0c..e0a0133960ef8 100644
--- a/lldb/test/API/macosx/version_zero/libDylib.dylib.yaml
+++ b/lldb/test/API/macosx/version_zero/libDylib.dylib.yaml
@@ -63,7 +63,7 @@ LoadCommands:
   timestamp:   1
   current_version: 0
   compatibility_version: 0
-PayloadString:   '@executable_path/libDylib.dylib'
+Content: '@executable_path/libDylib.dylib'
 ZeroPadBytes:1
   - cmd: LC_DYLD_INFO_ONLY
 cmdsize: 48
@@ -125,7 +125,7 @@ LoadCommands:
   timestamp:   2
   current_version: 83427328
   compatibility_version: 65536
-PayloadString:   '/usr/lib/libSystem.B.dylib'
+Content: '/usr/lib/libSystem.B.dylib'
 ZeroPadBytes:6
   - cmd: LC_FUNCTION_STARTS
 cmdsize: 16

diff  --git a/lldb/test/Shell/ObjectFile/MachO/lc_build_version.yaml 
b/lldb/test/Shell/ObjectFile/MachO/lc_build_version.yaml
index 576af4c225ee9..66245644a9cb3 100644
--- a/lldb/test/Shell/ObjectFile/MachO/lc_build_version.yaml
+++ b/lldb/test/Shell/ObjectFile/MachO/lc_build_version.yaml
@@ -113,7 +113,7 @@ LoadCommands:
   - cmd: LC_LOAD_DYLINKER
 cmdsize: 32
 name:12
-PayloadString:   /usr/lib/dyld
+Content: /usr/lib/dyld
 ZeroPadBytes:7
   - cmd: LC_UUID
 cmdsize: 24
@@ -141,7 +141,7 @@ LoadCommands:
   timestamp:   2
   current_version: 82102276
   compatibility_version: 65536
-PayloadString:   /usr/lib/libSystem.B.dylib
+Content: /usr/lib/libSystem.B.dylib
 ZeroPadBytes:6
   - cmd: LC_FUNCTION_STARTS
 cmdsize: 16

diff  --git a/lldb/test/Shell/ObjectFile/MachO/lc_build_version_notools.yaml 
b/lldb/test/Shell/ObjectFile/MachO/lc_build_version_notools.yaml
index 21aebae764b0f..c45de703739a2 100644
--- a/lldb/test/Shell/ObjectFile/MachO/lc_build_version_notools.yaml
+++ b/lldb/test/Shell/ObjectFile/MachO/lc_build_version_notools.yaml
@@ -112,7 +112,7 @@ LoadCommands:
   - cmd: LC_LOAD_DYLINKER
 cmdsize: 32
 name:12
-PayloadString:   /usr/lib/dyld
+Content: /usr/lib/dyld
 ZeroPadBytes:7
   - cmd: LC_UUID
 cmdsize: 24
@@ -137,7 +137,7 @@ LoadCommands:
   timestamp:   2
   current_version: 82102276
   compatibility_version: 65536
-PayloadString:   /usr/lib/libSystem.B.dylib
+Content: /usr/lib/libSystem.B.dylib
 ZeroPadBytes:6
   - cmd: LC_FUNCTION_STARTS
 cmdsize: 16

diff  --git a/lldb/test/Shell/ObjectFile/MachO/lc_version_min.yaml 
b/lldb/test/Shell/ObjectFile/MachO/lc_version_min.yaml
index 88d3f2814dd9a..227d278000241 100644
--- a/lldb/test/Shell/ObjectFile/MachO/lc_version_min.yaml
+++ b/lldb/test/Shell/ObjectFile/MachO/lc_version_min.yaml
@@ -113,7 +113,7 @@ LoadCommands:
   - cmd: LC_LOAD_DYLINKER
 cmdsize: 32
 name:12
-PayloadString:   /usr/lib/dyld
+Content: /usr/lib/dyld
 ZeroPadBytes:7
   - cmd: LC_UUID
 cmdsize: 24
@@ -136,7 +136,7 @@ LoadCommands:
   timestamp:   2
   current_version: 82102276
   compatibility_version: 65536
-PayloadString:   /usr/lib/libSystem.B.dylib
+Content: /usr/lib/libSystem.B.dylib
 ZeroPadBytes:6
   - cmd: LC_FUNCTION_STARTS
 cmdsize: 16

diff  --git a/lldb/test/Shell/ObjectFile/MachO/symtab.yaml 
b/lldb/test/Shell/ObjectFile/MachO/symtab.yaml
index 9f5e1a02bbc82..6dd221eaa7207 100644
--- a/lldb/test/Shell/ObjectFile/MachO/symtab.yaml
+++ b/lldb/test/Shell/ObjectFile/MachO/symtab.yaml
@@ -247,7 +247,7 @@ LoadCommands:
   - cmd: LC_LOAD_DYLINKER
 cmdsize: 32
 name:12
-PayloadString:   '/usr/lib/dyld'
+Content: '/usr/lib/dyld'
 ZeroPadBytes:7
   - cmd: LC_UUID
 cmdsize: 24
@@ -275,7 +275,7 @@ LoadCommands:
   timestamp:   2
   current_version: 14942208
   compatibilit

[Lldb-commits] [PATCH] D106194: Tests for: D100299: Be lazier about loading .dwo files

2021-07-26 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil abandoned this revision.
jankratochvil added a comment.

It has been merged to D100299 .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106194

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


[Lldb-commits] [PATCH] D106355: [DWARF5] Only fallback to manual index if no entry was found

2021-07-26 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D106355#2903655 , @kimanh wrote:

> Ah, to make sure that I understand it correctly: using `gdb-add-index` would 
> help `ManualDWARFIndex` to generate a `.debug_names`?

No. One could write hypothetical `lldb-add-index` to generate `.debug_names` 
using `ManualDWARFIndex`. There does not exist such tool yet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106355

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


[Lldb-commits] [PATCH] D106553: [LLDB][GUI] Resolve paths in file/directory fields

2021-07-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/source/Core/IOHandlerCursesGUI.cpp:1308
 }
 if (FileSystem::Instance().IsDirectory(file)) {
   SetError("Not a file!");

OmarEmaraDev wrote:
> clayborg wrote:
> > This is checking for a directory, not a file
> Not sure what you mean. It is setting an error if the file was in fact a 
> directory,
Woops! You are right...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106553

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


[Lldb-commits] [lldb] a98f394 - [LLDB][GUI] Resolve paths in file/directory fields

2021-07-26 Thread Greg Clayton via lldb-commits

Author: Omar Emara
Date: 2021-07-26T11:05:10-07:00
New Revision: a98f394e81f4dd70dc2a4a3a6640b10a6144cc3f

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

LOG: [LLDB][GUI] Resolve paths in file/directory fields

This patch resolves the paths in the file/directory fields before
performing checks. Those checks are applied on the file system if
m_need_to_exist is true, so remote files can set this to false to avoid
performing host-side file system checks. Additionally, methods to get
a resolved and a direct file specs were added to be used by client code.

Reviewed By: clayborg

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

Added: 


Modified: 
lldb/source/Core/IOHandlerCursesGUI.cpp

Removed: 




diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 4105bcc497871..b54511d2cebb5 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1300,8 +1300,11 @@ class FileFieldDelegate : public TextFieldDelegate {
 if (!IsSpecified())
   return;
 
-FileSpec file(GetPath());
-if (m_need_to_exist && !FileSystem::Instance().Exists(file)) {
+if (!m_need_to_exist)
+  return;
+
+FileSpec file = GetResolvedFileSpec();
+if (!FileSystem::Instance().Exists(file)) {
   SetError("File doesn't exist!");
   return;
 }
@@ -1311,7 +1314,17 @@ class FileFieldDelegate : public TextFieldDelegate {
 }
   }
 
-  // Returns the path of the file.
+  FileSpec GetFileSpec() {
+FileSpec file_spec(GetPath());
+return file_spec;
+  }
+
+  FileSpec GetResolvedFileSpec() {
+FileSpec file_spec(GetPath());
+FileSystem::Instance().Resolve(file_spec);
+return file_spec;
+  }
+
   const std::string &GetPath() { return m_content; }
 
 protected:
@@ -1330,8 +1343,11 @@ class DirectoryFieldDelegate : public TextFieldDelegate {
 if (!IsSpecified())
   return;
 
-FileSpec file(GetPath());
-if (m_need_to_exist && !FileSystem::Instance().Exists(file)) {
+if (!m_need_to_exist)
+  return;
+
+FileSpec file = GetResolvedFileSpec();
+if (!FileSystem::Instance().Exists(file)) {
   SetError("Directory doesn't exist!");
   return;
 }
@@ -1341,7 +1357,17 @@ class DirectoryFieldDelegate : public TextFieldDelegate {
 }
   }
 
-  // Returns the path of the file.
+  FileSpec GetFileSpec() {
+FileSpec file_spec(GetPath());
+return file_spec;
+  }
+
+  FileSpec GetResolvedFileSpec() {
+FileSpec file_spec(GetPath());
+FileSystem::Instance().Resolve(file_spec);
+return file_spec;
+  }
+
   const std::string &GetPath() { return m_content; }
 
 protected:



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


[Lldb-commits] [PATCH] D106553: [LLDB][GUI] Resolve paths in file/directory fields

2021-07-26 Thread Greg Clayton via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa98f394e81f4: [LLDB][GUI] Resolve paths in file/directory 
fields (authored by OmarEmaraDev, committed by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106553

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp


Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1300,8 +1300,11 @@
 if (!IsSpecified())
   return;
 
-FileSpec file(GetPath());
-if (m_need_to_exist && !FileSystem::Instance().Exists(file)) {
+if (!m_need_to_exist)
+  return;
+
+FileSpec file = GetResolvedFileSpec();
+if (!FileSystem::Instance().Exists(file)) {
   SetError("File doesn't exist!");
   return;
 }
@@ -1311,7 +1314,17 @@
 }
   }
 
-  // Returns the path of the file.
+  FileSpec GetFileSpec() {
+FileSpec file_spec(GetPath());
+return file_spec;
+  }
+
+  FileSpec GetResolvedFileSpec() {
+FileSpec file_spec(GetPath());
+FileSystem::Instance().Resolve(file_spec);
+return file_spec;
+  }
+
   const std::string &GetPath() { return m_content; }
 
 protected:
@@ -1330,8 +1343,11 @@
 if (!IsSpecified())
   return;
 
-FileSpec file(GetPath());
-if (m_need_to_exist && !FileSystem::Instance().Exists(file)) {
+if (!m_need_to_exist)
+  return;
+
+FileSpec file = GetResolvedFileSpec();
+if (!FileSystem::Instance().Exists(file)) {
   SetError("Directory doesn't exist!");
   return;
 }
@@ -1341,7 +1357,17 @@
 }
   }
 
-  // Returns the path of the file.
+  FileSpec GetFileSpec() {
+FileSpec file_spec(GetPath());
+return file_spec;
+  }
+
+  FileSpec GetResolvedFileSpec() {
+FileSpec file_spec(GetPath());
+FileSystem::Instance().Resolve(file_spec);
+return file_spec;
+  }
+
   const std::string &GetPath() { return m_content; }
 
 protected:


Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1300,8 +1300,11 @@
 if (!IsSpecified())
   return;
 
-FileSpec file(GetPath());
-if (m_need_to_exist && !FileSystem::Instance().Exists(file)) {
+if (!m_need_to_exist)
+  return;
+
+FileSpec file = GetResolvedFileSpec();
+if (!FileSystem::Instance().Exists(file)) {
   SetError("File doesn't exist!");
   return;
 }
@@ -1311,7 +1314,17 @@
 }
   }
 
-  // Returns the path of the file.
+  FileSpec GetFileSpec() {
+FileSpec file_spec(GetPath());
+return file_spec;
+  }
+
+  FileSpec GetResolvedFileSpec() {
+FileSpec file_spec(GetPath());
+FileSystem::Instance().Resolve(file_spec);
+return file_spec;
+  }
+
   const std::string &GetPath() { return m_content; }
 
 protected:
@@ -1330,8 +1343,11 @@
 if (!IsSpecified())
   return;
 
-FileSpec file(GetPath());
-if (m_need_to_exist && !FileSystem::Instance().Exists(file)) {
+if (!m_need_to_exist)
+  return;
+
+FileSpec file = GetResolvedFileSpec();
+if (!FileSystem::Instance().Exists(file)) {
   SetError("Directory doesn't exist!");
   return;
 }
@@ -1341,7 +1357,17 @@
 }
   }
 
-  // Returns the path of the file.
+  FileSpec GetFileSpec() {
+FileSpec file_spec(GetPath());
+return file_spec;
+  }
+
+  FileSpec GetResolvedFileSpec() {
+FileSpec file_spec(GetPath());
+FileSystem::Instance().Resolve(file_spec);
+return file_spec;
+  }
+
   const std::string &GetPath() { return m_content; }
 
 protected:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D106553: [LLDB][GUI] Resolve paths in file/directory fields

2021-07-26 Thread Omar Emara via Phabricator via lldb-commits
OmarEmaraDev added a comment.

@clayborg Did you check D106564 ? This is the 
last patch needed to do the rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106553

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


[Lldb-commits] [lldb] e42edce - [lldb][NFC] Delete unused and commented out DWARF constants

2021-07-26 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2021-07-26T12:26:35-07:00
New Revision: e42edce4a349efeedde2ffd07a26a6335178d24b

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

LOG: [lldb][NFC] Delete unused and commented out DWARF constants

I cannot find any users of these anywhere and they have been commented out
for years.

Added: 


Modified: 
lldb/include/lldb/Core/dwarf.h
lldb/packages/Python/lldbsuite/test/lldbdwarf.py

Removed: 




diff  --git a/lldb/include/lldb/Core/dwarf.h b/lldb/include/lldb/Core/dwarf.h
index bdb6f27a45214..968418e71c2f3 100644
--- a/lldb/include/lldb/Core/dwarf.h
+++ b/lldb/include/lldb/Core/dwarf.h
@@ -38,39 +38,6 @@ typedef uint32_t dw_offset_t; // Dwarf Debug Information 
Entry offset for any
 
 #define DW_EH_PE_MASK_ENCODING 0x0F
 
- The following are used only internally within lldb - don't
- document them in the llvm Dwarf.h header file, we won't see
- them in executable files anywhere.
- These constants fit between DW_OP_lo_user (0xe0) and DW_OP_hi_user (0xff).
-//
-//#define DW_OP_APPLE_array_ref 0xEE // first pops index, then pops array;
-//pushes array[index]
-//#define DW_OP_APPLE_extern0xEF // ULEB128 index of external object
-//(i.e., an entity from the program that was used in the expression)
-#define DW_OP_APPLE_uninit 
\
-  0xF0 // This is actually generated by some apple compilers in locations lists
-//#define DW_OP_APPLE_assign0xF1 // pops value off and assigns it to
-//second item on stack (2nd item must have assignable context)
-//#define DW_OP_APPLE_address_of0xF2 // gets the address of the top stack
-//item (top item must be a variable, or have value_type that is an address
-//already)
-//#define DW_OP_APPLE_value_of  0xF3 // pops the value off the stack and
-//pushes the value of that object (top item must be a variable, or expression
-//local)
-//#define DW_OP_APPLE_deref_type0xF4 // gets the address of the top stack
-//item (top item must be a variable, or a clang type)
-//#define DW_OP_APPLE_expr_local0xF5 // ULEB128 expression local index
-//#define DW_OP_APPLE_constf0xF6 // 1 byte float size, followed by
-//constant float data
-//#define DW_OP_APPLE_scalar_cast   0xF7 // Cast top of stack to 2nd in stack's
-//type leaving all items in place
-//#define DW_OP_APPLE_clang_cast0xF8 // pointer size clang::Type * off the
-//stack and cast top stack item to this type
-//#define DW_OP_APPLE_clear 0xFE // clears the entire expression stack,
-//ok if the stack is empty
-//#define DW_OP_APPLE_error 0xFF // Stops expression evaluation and
-//returns an error (no args)
-
 typedef lldb_private::RangeVector DWARFRangeList;
 
 #endif // LLDB_CORE_DWARF_H

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbdwarf.py 
b/lldb/packages/Python/lldbsuite/test/lldbdwarf.py
index 217f8bc0e2b77..5492960d2d75e 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbdwarf.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbdwarf.py
@@ -159,7 +159,6 @@
 DW_OP_stack_value   = 0x9F
 DW_OP_lo_user   = 0xE0
 DW_OP_GNU_push_tls_address  = 0xE0
-DW_OP_APPLE_uninit  = 0xF0
 DW_OP_hi_user   = 0xFF
 
 



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


[Lldb-commits] [PATCH] D105215: [lldb] Remove CPlusPlusLanguage from Mangled

2021-07-26 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.

ping!

@jingham I can change the name to `GetFullyQualifiedBaseName` if needed. Is 
there anything else here that should be changed or addressed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105215

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


[Lldb-commits] [PATCH] D106355: [DWARF5] Only fallback to manual index if no entry was found

2021-07-26 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil accepted this revision.
jankratochvil added a comment.
This revision is now accepted and ready to land.

Approved after removing the curly brackets.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:136
   continue;
 if (entry_or->getCUOffset() != cu_offset)
   continue;

It would be nice to reverse these two comparisons for `found_entry_for_cu` but 
`getCUOffset()` is much more expensive. Just saying.




Comment at: 
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp:149-151
+  if (!found_entry_for_cu) {
+m_fallback.GetGlobalVariables(cu, callback);
+  }




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106355

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


[Lldb-commits] [lldb] fed25dd - [LLDB][GUI] Expand selected thread tree item by default

2021-07-26 Thread Greg Clayton via lldb-commits

Author: Omar Emara
Date: 2021-07-26T14:20:50-07:00
New Revision: fed25ddc1c3de59aa1de27e95b349f86896ccb79

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

LOG: [LLDB][GUI] Expand selected thread tree item by default

This patch expands the tree item that corresponds to the selected thread
by default in the Threads window. Additionally, the tree root item is
always expanded, which is the process in the Threads window.

Reviewed By: clayborg

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

Added: 
lldb/test/API/commands/gui/expand-threads-tree/Makefile
lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
lldb/test/API/commands/gui/expand-threads-tree/main.c

Modified: 
lldb/source/Core/IOHandlerCursesGUI.cpp

Removed: 




diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index b54511d2cebb5..e664ac1ba4bd4 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -3361,8 +3361,13 @@ class TreeDelegate {
 
   virtual void TreeDelegateDrawTreeItem(TreeItem &item, Window &window) = 0;
   virtual void TreeDelegateGenerateChildren(TreeItem &item) = 0;
+  virtual void TreeDelegateUpdateSelection(TreeItem &root, int 
&selection_index,
+   TreeItem *&selected_item) {
+return;
+  }
   virtual bool TreeDelegateItemSelected(
   TreeItem &item) = 0; // Return true if we need to update views
+  virtual bool TreeDelegateExpandRootByDefault() { return false; }
 };
 
 typedef std::shared_ptr TreeDelegateSP;
@@ -3372,7 +3377,10 @@ class TreeItem {
   TreeItem(TreeItem *parent, TreeDelegate &delegate, bool might_have_children)
   : m_parent(parent), m_delegate(delegate), m_user_data(nullptr),
 m_identifier(0), m_row_idx(-1), m_children(),
-m_might_have_children(might_have_children), m_is_expanded(false) {}
+m_might_have_children(might_have_children), m_is_expanded(false) {
+if (m_parent == nullptr)
+  m_is_expanded = m_delegate.TreeDelegateExpandRootByDefault();
+  }
 
   TreeItem &operator=(const TreeItem &rhs) {
 if (this != &rhs) {
@@ -3601,6 +3609,8 @@ class TreeWindowDelegate : public WindowDelegate {
   const int num_visible_rows = NumVisibleRows();
   m_num_rows = 0;
   m_root.CalculateRowIndexes(m_num_rows);
+  m_delegate_sp->TreeDelegateUpdateSelection(m_root, m_selected_row_idx,
+ m_selected_item);
 
   // If we unexpanded while having something selected our total number of
   // rows is less than the num visible rows, then make sure we show all the
@@ -3902,7 +3912,7 @@ class ThreadsTreeDelegate : public TreeDelegate {
 public:
   ThreadsTreeDelegate(Debugger &debugger)
   : TreeDelegate(), m_thread_delegate_sp(), m_debugger(debugger),
-m_stop_id(UINT32_MAX) {
+m_stop_id(UINT32_MAX), m_update_selection(false) {
 FormatEntity::Parse("process ${process.id}{, name = ${process.name}}",
 m_format);
   }
@@ -3930,6 +3940,7 @@ class ThreadsTreeDelegate : public TreeDelegate {
 
   void TreeDelegateGenerateChildren(TreeItem &item) override {
 ProcessSP process_sp = GetProcess();
+m_update_selection = false;
 if (process_sp && process_sp->IsAlive()) {
   StateType state = process_sp->GetState();
   if (StateIsStoppedState(state, true)) {
@@ -3938,6 +3949,7 @@ class ThreadsTreeDelegate : public TreeDelegate {
   return; // Children are already up to date
 
 m_stop_id = stop_id;
+m_update_selection = true;
 
 if (!m_thread_delegate_sp) {
   // Always expand the thread item the first time we show it
@@ -3949,11 +3961,15 @@ class ThreadsTreeDelegate : public TreeDelegate {
 TreeItem t(&item, *m_thread_delegate_sp, false);
 ThreadList &threads = process_sp->GetThreadList();
 std::lock_guard guard(threads.GetMutex());
+ThreadSP selected_thread = threads.GetSelectedThread();
 size_t num_threads = threads.GetSize();
 item.Resize(num_threads, t);
 for (size_t i = 0; i < num_threads; ++i) {
-  item[i].SetIdentifier(threads.GetThreadAtIndex(i)->GetID());
+  ThreadSP thread = threads.GetThreadAtIndex(i);
+  item[i].SetIdentifier(thread->GetID());
   item[i].SetMightHaveChildren(true);
+  if (selected_thread->GetID() == thread->GetID())
+item[i].Expand();
 }
 return;
   }
@@ -3961,12 +3977,42 @@ class ThreadsTreeDelegate : public TreeDelegate {
 item.ClearChildren();
   }
 
+  void TreeDelegateUpdateSelection(TreeItem &root, int &selection_index,
+   TreeI

[Lldb-commits] [PATCH] D100243: [LLDB][GUI] Expand selected thread tree item by default

2021-07-26 Thread Greg Clayton via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfed25ddc1c3d: [LLDB][GUI] Expand selected thread tree item 
by default (authored by OmarEmaraDev, committed by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100243

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp
  lldb/test/API/commands/gui/expand-threads-tree/Makefile
  lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
  lldb/test/API/commands/gui/expand-threads-tree/main.c

Index: lldb/test/API/commands/gui/expand-threads-tree/main.c
===
--- /dev/null
+++ lldb/test/API/commands/gui/expand-threads-tree/main.c
@@ -0,0 +1,10 @@
+#include 
+
+void *thread_start_routine(void *arg) { return NULL; }
+
+int main() {
+  pthread_t thread;
+  pthread_create(&thread, NULL, thread_start_routine, NULL);
+  pthread_join(thread, NULL);
+  return 0;
+}
Index: lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
===
--- /dev/null
+++ lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
@@ -0,0 +1,55 @@
+"""
+Test the 'gui' default thread tree expansion.
+The root process tree item and the tree item corresponding to the selected
+thread should be expanded by default.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class TestGuiExpandThreadsTree(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+# PExpect uses many timeouts internally and doesn't play well
+# under ASAN on a loaded machine..
+@skipIfAsan
+@skipIfCursesSupportMissing
+def test_gui(self):
+self.build()
+
+self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500))
+self.expect("breakpoint set -r thread_start_routine", substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
+
+escape_key = chr(27).encode()
+
+# Start the GUI and close the welcome window.
+self.child.sendline("gui")
+self.child.send(escape_key)
+self.child.expect_exact("Threads")
+
+# The thread running thread_start_routine should be expanded.
+self.child.expect_exact("frame #0: thread_start_routine")
+
+# Exit GUI.
+self.child.send(escape_key)
+self.expect_prompt()
+
+# Select the main thread.
+self.child.sendline("thread select 1")
+
+# Start the GUI.
+self.child.sendline("gui")
+self.child.expect_exact("Threads")
+
+# The main thread should be expanded.
+self.child.expect("frame #\d+: main")
+
+# Quit the GUI
+self.child.send(escape_key)
+
+self.expect_prompt()
+self.quit()
Index: lldb/test/API/commands/gui/expand-threads-tree/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/gui/expand-threads-tree/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+ENABLE_THREADS := YES
+include Makefile.rules
Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -3361,8 +3361,13 @@
 
   virtual void TreeDelegateDrawTreeItem(TreeItem &item, Window &window) = 0;
   virtual void TreeDelegateGenerateChildren(TreeItem &item) = 0;
+  virtual void TreeDelegateUpdateSelection(TreeItem &root, int &selection_index,
+   TreeItem *&selected_item) {
+return;
+  }
   virtual bool TreeDelegateItemSelected(
   TreeItem &item) = 0; // Return true if we need to update views
+  virtual bool TreeDelegateExpandRootByDefault() { return false; }
 };
 
 typedef std::shared_ptr TreeDelegateSP;
@@ -3372,7 +3377,10 @@
   TreeItem(TreeItem *parent, TreeDelegate &delegate, bool might_have_children)
   : m_parent(parent), m_delegate(delegate), m_user_data(nullptr),
 m_identifier(0), m_row_idx(-1), m_children(),
-m_might_have_children(might_have_children), m_is_expanded(false) {}
+m_might_have_children(might_have_children), m_is_expanded(false) {
+if (m_parent == nullptr)
+  m_is_expanded = m_delegate.TreeDelegateExpandRootByDefault();
+  }
 
   TreeItem &operator=(const TreeItem &rhs) {
 if (this != &rhs) {
@@ -3601,6 +3609,8 @@
   const int num_visible_rows = NumVisibleRows();
   m_num_rows = 0;
   m_root.CalculateRowIndexes(m_num_rows);
+  m_delegate_sp->TreeDelegateUpdateSelection(m_root, m_selected_row_idx,
+ m_selected_item);
 
   // If we unexpand

[Lldb-commits] [lldb] ed5b4db - [LLDB][GUI] Add Arch Field

2021-07-26 Thread Greg Clayton via lldb-commits

Author: Omar Emara
Date: 2021-07-26T14:22:25-07:00
New Revision: ed5b4dbd3952ffa8970ae59faa7f7505cd28aa92

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

LOG: [LLDB][GUI] Add Arch Field

This patch adds an Arch field that inputs and validates an arch spec.

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

Added: 


Modified: 
lldb/source/Core/IOHandlerCursesGUI.cpp

Removed: 




diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index e664ac1ba4bd..4bed788d4863 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1374,6 +1374,25 @@ class DirectoryFieldDelegate : public TextFieldDelegate {
   bool m_need_to_exist;
 };
 
+class ArchFieldDelegate : public TextFieldDelegate {
+public:
+  ArchFieldDelegate(const char *label, const char *content, bool required)
+  : TextFieldDelegate(label, content, required) {}
+
+  void FieldDelegateExitCallback() override {
+TextFieldDelegate::FieldDelegateExitCallback();
+if (!IsSpecified())
+  return;
+
+if (!GetArchSpec().IsValid())
+  SetError("Not a valid arch!");
+  }
+
+  const std::string &GetArchString() { return m_content; }
+
+  ArchSpec GetArchSpec() { return ArchSpec(GetArchString()); }
+};
+
 class BooleanFieldDelegate : public FieldDelegate {
 public:
   BooleanFieldDelegate(const char *label, bool content)
@@ -1989,6 +2008,14 @@ class FormDelegate {
 return delegate;
   }
 
+  ArchFieldDelegate *AddArchField(const char *label, const char *content,
+  bool required) {
+ArchFieldDelegate *delegate =
+new ArchFieldDelegate(label, content, required);
+m_fields.push_back(FieldDelegateUP(delegate));
+return delegate;
+  }
+
   IntegerFieldDelegate *AddIntegerField(const char *label, int content,
 bool required) {
 IntegerFieldDelegate *delegate =



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


[Lldb-commits] [PATCH] D106564: [LLDB][GUI] Add Arch Field

2021-07-26 Thread Greg Clayton via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGed5b4dbd3952: [LLDB][GUI] Add Arch Field (authored by 
OmarEmaraDev, committed by clayborg).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106564

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp


Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1374,6 +1374,25 @@
   bool m_need_to_exist;
 };
 
+class ArchFieldDelegate : public TextFieldDelegate {
+public:
+  ArchFieldDelegate(const char *label, const char *content, bool required)
+  : TextFieldDelegate(label, content, required) {}
+
+  void FieldDelegateExitCallback() override {
+TextFieldDelegate::FieldDelegateExitCallback();
+if (!IsSpecified())
+  return;
+
+if (!GetArchSpec().IsValid())
+  SetError("Not a valid arch!");
+  }
+
+  const std::string &GetArchString() { return m_content; }
+
+  ArchSpec GetArchSpec() { return ArchSpec(GetArchString()); }
+};
+
 class BooleanFieldDelegate : public FieldDelegate {
 public:
   BooleanFieldDelegate(const char *label, bool content)
@@ -1989,6 +2008,14 @@
 return delegate;
   }
 
+  ArchFieldDelegate *AddArchField(const char *label, const char *content,
+  bool required) {
+ArchFieldDelegate *delegate =
+new ArchFieldDelegate(label, content, required);
+m_fields.push_back(FieldDelegateUP(delegate));
+return delegate;
+  }
+
   IntegerFieldDelegate *AddIntegerField(const char *label, int content,
 bool required) {
 IntegerFieldDelegate *delegate =


Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1374,6 +1374,25 @@
   bool m_need_to_exist;
 };
 
+class ArchFieldDelegate : public TextFieldDelegate {
+public:
+  ArchFieldDelegate(const char *label, const char *content, bool required)
+  : TextFieldDelegate(label, content, required) {}
+
+  void FieldDelegateExitCallback() override {
+TextFieldDelegate::FieldDelegateExitCallback();
+if (!IsSpecified())
+  return;
+
+if (!GetArchSpec().IsValid())
+  SetError("Not a valid arch!");
+  }
+
+  const std::string &GetArchString() { return m_content; }
+
+  ArchSpec GetArchSpec() { return ArchSpec(GetArchString()); }
+};
+
 class BooleanFieldDelegate : public FieldDelegate {
 public:
   BooleanFieldDelegate(const char *label, bool content)
@@ -1989,6 +2008,14 @@
 return delegate;
   }
 
+  ArchFieldDelegate *AddArchField(const char *label, const char *content,
+  bool required) {
+ArchFieldDelegate *delegate =
+new ArchFieldDelegate(label, content, required);
+m_fields.push_back(FieldDelegateUP(delegate));
+return delegate;
+  }
+
   IntegerFieldDelegate *AddIntegerField(const char *label, int content,
 bool required) {
 IntegerFieldDelegate *delegate =
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D106553: [LLDB][GUI] Resolve paths in file/directory fields

2021-07-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D106553#2905223 , @OmarEmaraDev 
wrote:

> @clayborg Did you check D106564 ? This is 
> the last patch needed to do the rebase.

Just committed that one and also the one that selects the right frame 
(https://reviews.llvm.org/D100243). We should be all up to date now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106553

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


Re: [Lldb-commits] [PATCH] D105215: [lldb] Remove CPlusPlusLanguage from Mangled

2021-07-26 Thread Jim Ingham via lldb-commits
Mostly I was reacting to your saying the "fully qualified name" idea was too 
much of a C++ specific thing and didn't belong in the Language abstraction.  
That doesn't seem to me right.  Swift has module names & class namespaces, etc. 
 And you might want to dial up all methods with some base name or narrow down 
to the one implemented by a class or module in the same way.  And we make the 
distinction between matching base names & qualified names in most of our 
searches; so this does seem a generally useful accessor.  

The name was a way to phrase the access that made sense of it as a general 
thing, but I'm not stuck on that name .  And you didn't make any actual moves 
to put it just in the C++ Language, so I'm doubly fine with that...  

It does seem odd to stick "Demangled" in the name as that does seem more an 
implementation detail.  But my main point was that I did think this belongs in 
the Language plugin, so I'm good.

Jim



> On Jul 26, 2021, at 12:39 PM, Alex Langford via Phabricator 
>  wrote:
> 
> bulbazord added a comment.
> 
> ping!
> 
> @jingham I can change the name to `GetFullyQualifiedBaseName` if needed. Is 
> there anything else here that should be changed or addressed?
> 
> 
> Repository:
>  rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D105215/new/
> 
> https://reviews.llvm.org/D105215
> 

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


[Lldb-commits] [PATCH] D105166: Fix expression evaluation result expansion in lldb-vscode

2021-07-26 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan updated this revision to Diff 361815.
yinghuitan marked 4 inline comments as done.
yinghuitan added a comment.

Fix the issue in setVariable request.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105166

Files:
  lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
  lldb/tools/lldb-vscode/VSCode.cpp
  lldb/tools/lldb-vscode/VSCode.h
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -107,6 +107,19 @@
 
 enum LaunchMethod { Launch, Attach, AttachForSuspendedLaunch };
 
+lldb::SBValueList *GetTopLevelScope(int64_t variablesReference) {
+  switch (variablesReference) {
+  case VARREF_LOCALS:
+return &g_vsc.variables.locals;
+  case VARREF_GLOBALS:
+return &g_vsc.variables.globals;
+  case VARREF_REGS:
+return &g_vsc.variables.registers;
+  default:
+return nullptr;
+  }
+}
+
 SOCKET AcceptConnection(int portno) {
   // Accept a socket connection from any host on "portno".
   SOCKET newsockfd = -1;
@@ -439,6 +452,7 @@
 }
 break;
   case lldb::eStateRunning:
+g_vsc.WillContinue();
 break;
   case lldb::eStateExited: {
 // Run any exit LLDB commands the user specified in the
@@ -1196,6 +1210,10 @@
 lldb::SBValue value = frame.GetValueForVariablePath(
 expression.data(), lldb::eDynamicDontRunTarget);
 
+// Freeze dry the value in case users expand it later in the debug console
+if (value.GetError().Success() && context == "repl")
+  value = value.Persist();
+
 if (value.GetError().Fail() && context != "hover")
   value = frame.EvaluateExpression(expression.data());
 
@@ -1215,9 +1233,9 @@
   EmplaceSafeString(body, "type",
 value_typename ? value_typename : NO_TYPENAME);
   if (value.MightHaveChildren()) {
-auto variablesReference = VARIDX_TO_VARREF(g_vsc.variables.GetSize());
-g_vsc.variables.Append(value);
-body.try_emplace("variablesReference", variablesReference);
+auto variableReference = g_vsc.variables.InsertExpandableVariable(
+value, /*is_permanent=*/context == "repl");
+body.try_emplace("variablesReference", variableReference);
   } else {
 body.try_emplace("variablesReference", (int64_t)0);
   }
@@ -1895,20 +1913,15 @@
 frame.GetThread().GetProcess().SetSelectedThread(frame.GetThread());
 frame.GetThread().SetSelectedFrame(frame.GetFrameID());
   }
-  g_vsc.variables.Clear();
-  g_vsc.variables.Append(frame.GetVariables(true,   // arguments
-true,   // locals
-false,  // statics
-true)); // in_scope_only
-  g_vsc.num_locals = g_vsc.variables.GetSize();
-  g_vsc.variables.Append(frame.GetVariables(false,  // arguments
-false,  // locals
-true,   // statics
-true)); // in_scope_only
-  g_vsc.num_globals = g_vsc.variables.GetSize() - (g_vsc.num_locals);
-  g_vsc.variables.Append(frame.GetRegisters());
-  g_vsc.num_regs =
-  g_vsc.variables.GetSize() - (g_vsc.num_locals + g_vsc.num_globals);
+  g_vsc.variables.locals = frame.GetVariables(/*arguments=*/true,
+  /*locals=*/true,
+  /*statics=*/false,
+  /*in_scope_only=*/true);
+  g_vsc.variables.globals = frame.GetVariables(/*arguments=*/false,
+   /*locals=*/false,
+   /*statics=*/true,
+   /*in_scope_only=*/true);
+  g_vsc.variables.registers = frame.GetRegisters();
   body.try_emplace("scopes", g_vsc.CreateTopLevelScopes());
   response.try_emplace("body", std::move(body));
   g_vsc.SendJSON(llvm::json::Value(std::move(response)));
@@ -2750,37 +2763,20 @@
   // of the variable within the g_vsc.variables list.
   const auto id_value = GetUnsigned(arguments, "id", UINT64_MAX);
   if (id_value != UINT64_MAX) {
-variable = g_vsc.variables.GetValueAtIndex(id_value);
-  } else if (VARREF_IS_SCOPE(variablesReference)) {
+variable = g_vsc.variables.GetVariable(id_value);
+  } else if (lldb::SBValueList *top_scope =
+ GetTopLevelScope(variablesReference)) {
 // variablesReference is one of our scopes, not an actual variable it is
 // asking for a variable in locals or globals or registers
-int64_t start_idx = 0;
-int64_t end_idx = 0;
-switch (variablesReference) {
-

[Lldb-commits] [PATCH] D105166: Fix expression evaluation result expansion in lldb-vscode

2021-07-26 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan added inline comments.



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1790
 g_vsc.focus_tid = thread.GetThreadID();
+g_vsc.WillContinue();
 thread.StepOver();

clayborg wrote:
> Remove and handle in "eStateStopped" or "eStateRunning" as previously 
> mentioned because the command line on the debugger console can end up making 
> the process continue.
Sure, I originally did not do this because I am not sure if a new debug event 
with eStateRunning is guaranteed to generate. If that guarantee is provided, 
sure. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105166

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


[Lldb-commits] [PATCH] D106832: [lldb] [gdb-remote client] Avoid zero padding PID/TID

2021-07-26 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: JDevlieghere, krytarowski, emaste, rovka, ted.
mgorny requested review of this revision.

Change SetCurrentThread*() logic not to include the zero padding
in PID/TID that was a side effect of 02ef0f5ab483 
.  This 
should fix
problems caused by sending 64-bit integers to 32-bit servers.  Reported
by Ted Woodward.


https://reviews.llvm.org/D106832

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp


Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -98,7 +98,7 @@
   });
 
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "P4=" + one_register_hex, "OK");
   ASSERT_TRUE(write_result.get());
 
@@ -143,7 +143,7 @@
 return client.SaveRegisterState(tid, save_id);
   });
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "QSaveRegisterState", "1");
   ASSERT_TRUE(async_result.get());
   EXPECT_EQ(1u, save_id);
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2639,16 +2639,13 @@
   packet.PutChar('H');
   packet.PutChar(op);
 
-  if (pid != LLDB_INVALID_PROCESS_ID) {
-packet.PutChar('p');
-packet.PutHex64(pid);
-packet.PutChar('.');
-  }
+  if (pid != LLDB_INVALID_PROCESS_ID)
+packet.Printf("p%" PRIx64 ".", pid);
 
   if (tid == UINT64_MAX)
 packet.PutCString("-1");
   else
-packet.PutHex64(tid);
+packet.Printf("%" PRIx64, tid);
 
   StringExtractorGDBRemote response;
   if (SendPacketAndWaitForResponse(packet.GetString(), response) 


Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -98,7 +98,7 @@
   });
 
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "P4=" + one_register_hex, "OK");
   ASSERT_TRUE(write_result.get());
 
@@ -143,7 +143,7 @@
 return client.SaveRegisterState(tid, save_id);
   });
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "QSaveRegisterState", "1");
   ASSERT_TRUE(async_result.get());
   EXPECT_EQ(1u, save_id);
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2639,16 +2639,13 @@
   packet.PutChar('H');
   packet.PutChar(op);
 
-  if (pid != LLDB_INVALID_PROCESS_ID) {
-packet.PutChar('p');
-packet.PutHex64(pid);
-packet.PutChar('.');
-  }
+  if (pid != LLDB_INVALID_PROCESS_ID)
+packet.Printf("p%" PRIx64 ".", pid);
 
   if (tid == UINT64_MAX)
 packet.PutCString("-1");
   else
-packet.PutHex64(tid);
+packet.Printf("%" PRIx64, tid);
 
   StringExtractorGDBRemote response;
   if (SendPacketAndWaitForResponse(packet.GetString(), response) 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D106832: [lldb] [gdb-remote client] Avoid zero padding PID/TID in H packet

2021-07-26 Thread Ted Woodward via Phabricator via lldb-commits
ted accepted this revision.
ted added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks Michał!


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

https://reviews.llvm.org/D106832

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


[Lldb-commits] [lldb] 3c32695 - [lldb] [gdb-remote client] Avoid zero padding PID/TID in H packet

2021-07-26 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-07-27T00:44:43+02:00
New Revision: 3c3269559ba9400224400b96c22b31812638de52

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

LOG: [lldb] [gdb-remote client] Avoid zero padding PID/TID in H packet

Change SetCurrentThread*() logic not to include the zero padding
in PID/TID that was a side effect of 02ef0f5ab483.  This should fix
problems caused by sending 64-bit integers to 32-bit servers.  Reported
by Ted Woodward.

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

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index a07a3f91c0c88..5e80317d5327c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2639,16 +2639,13 @@ 
GDBRemoteCommunicationClient::SendSetCurrentThreadPacket(uint64_t tid,
   packet.PutChar('H');
   packet.PutChar(op);
 
-  if (pid != LLDB_INVALID_PROCESS_ID) {
-packet.PutChar('p');
-packet.PutHex64(pid);
-packet.PutChar('.');
-  }
+  if (pid != LLDB_INVALID_PROCESS_ID)
+packet.Printf("p%" PRIx64 ".", pid);
 
   if (tid == UINT64_MAX)
 packet.PutCString("-1");
   else
-packet.PutHex64(tid);
+packet.Printf("%" PRIx64, tid);
 
   StringExtractorGDBRemote response;
   if (SendPacketAndWaitForResponse(packet.GetString(), response) 

diff  --git 
a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp 
b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index 781809297990a..07733962738c3 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -98,7 +98,7 @@ TEST_F(GDBRemoteCommunicationClientTest, 
WriteRegisterNoSuffix) {
   });
 
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "P4=" + one_register_hex, "OK");
   ASSERT_TRUE(write_result.get());
 
@@ -143,7 +143,7 @@ TEST_F(GDBRemoteCommunicationClientTest, 
SaveRestoreRegistersNoSuffix) {
 return client.SaveRegisterState(tid, save_id);
   });
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "QSaveRegisterState", "1");
   ASSERT_TRUE(async_result.get());
   EXPECT_EQ(1u, save_id);



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


[Lldb-commits] [PATCH] D106832: [lldb] [gdb-remote client] Avoid zero padding PID/TID in H packet

2021-07-26 Thread Michał Górny via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3c3269559ba9: [lldb] [gdb-remote client] Avoid zero padding 
PID/TID in H packet (authored by mgorny).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106832

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp


Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -98,7 +98,7 @@
   });
 
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "P4=" + one_register_hex, "OK");
   ASSERT_TRUE(write_result.get());
 
@@ -143,7 +143,7 @@
 return client.SaveRegisterState(tid, save_id);
   });
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "QSaveRegisterState", "1");
   ASSERT_TRUE(async_result.get());
   EXPECT_EQ(1u, save_id);
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2639,16 +2639,13 @@
   packet.PutChar('H');
   packet.PutChar(op);
 
-  if (pid != LLDB_INVALID_PROCESS_ID) {
-packet.PutChar('p');
-packet.PutHex64(pid);
-packet.PutChar('.');
-  }
+  if (pid != LLDB_INVALID_PROCESS_ID)
+packet.Printf("p%" PRIx64 ".", pid);
 
   if (tid == UINT64_MAX)
 packet.PutCString("-1");
   else
-packet.PutHex64(tid);
+packet.Printf("%" PRIx64, tid);
 
   StringExtractorGDBRemote response;
   if (SendPacketAndWaitForResponse(packet.GetString(), response) 


Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -98,7 +98,7 @@
   });
 
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "P4=" + one_register_hex, "OK");
   ASSERT_TRUE(write_result.get());
 
@@ -143,7 +143,7 @@
 return client.SaveRegisterState(tid, save_id);
   });
   Handle_QThreadSuffixSupported(server, false);
-  HandlePacket(server, "Hg0047", "OK");
+  HandlePacket(server, "Hg47", "OK");
   HandlePacket(server, "QSaveRegisterState", "1");
   ASSERT_TRUE(async_result.get());
   EXPECT_EQ(1u, save_id);
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2639,16 +2639,13 @@
   packet.PutChar('H');
   packet.PutChar(op);
 
-  if (pid != LLDB_INVALID_PROCESS_ID) {
-packet.PutChar('p');
-packet.PutHex64(pid);
-packet.PutChar('.');
-  }
+  if (pid != LLDB_INVALID_PROCESS_ID)
+packet.Printf("p%" PRIx64 ".", pid);
 
   if (tid == UINT64_MAX)
 packet.PutCString("-1");
   else
-packet.PutHex64(tid);
+packet.Printf("%" PRIx64, tid);
 
   StringExtractorGDBRemote response;
   if (SendPacketAndWaitForResponse(packet.GetString(), response) 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D106712: Remember to check whether the current thread is stopped for a no-stop signal

2021-07-26 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/source/Target/Process.cpp:780
 StopReason curr_thread_stop_reason = eStopReasonInvalid;
-if (curr_thread) {
+bool prefer_curr_thread = false;
+if (curr_thread && curr_thread->IsValid()) {

If we are setting `prefer_curr_thread` here, which I think is good, then I 
don't think we need to the `prefer_curr_thread = false;` lines in the switch. 
This will simplfiy the `if/else` below since we only care about the `true` case 
then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106712

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


[Lldb-commits] [PATCH] D106270: [DWARF5] Fix offset check when using .debug_names

2021-07-26 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3024
-m_index->GetGlobalVariables(
-dwarf_cu->GetNonSkeletonUnit(), [&](DWARFDIE die) {
-  VariableSP var_sp(

So is the problem that calling `GetNonSkeletonUnit()` does not work here b/c in 
`DebugNamesDWARFIndex` case we don't want this but in the other cases we do? 




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106270

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


[Lldb-commits] [PATCH] D106837: Create synthetic symbol names on demand to improve memory consumption and startup times.

2021-07-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg created this revision.
clayborg added reviewers: JDevlieghere, wallace.
Herald added subscribers: kristof.beyls, emaste.
clayborg requested review of this revision.
Herald added subscribers: lldb-commits, MaskRay.
Herald added a project: LLDB.

This is a resubmission of https://reviews.llvm.org/D105160 after fixing testing 
issues.

This fix was created after profiling the target creation of a large C/C++/ObjC 
application that contained almost 4,000,000 redacted symbol names. The symbol 
table parsing code was creating names for each of these synthetic symbols and 
adding them to the name indexes. The code was also adding the object file 
basename to the end of the symbol name which doesn't allow symbols from 
different shared libraries to share the names in the constant string pool.

Prior to this fix this was creating 180MB of "___lldb_unnamed_symbol" symbol 
names and was taking a long time to generate each name, add them to the string 
pool and then add each of these names to the name index.

This patch fixes the issue by:

not adding a name to synthetic symbols at creation time, and allows name to be 
dynamically generated when accessed
doesn't add synthetic symbol names to the name indexes, but catches this 
special case as name lookup time. Users won't typically set breakpoints or 
lookup these synthetic names, but support was added to do the lookup in case it 
does happen
removes the object file baseanme from the generated names to allow the names to 
be shared in the constant string pool
Prior to this fix the startup times for a large application was:
12.5 seconds (cold file caches)
8.5 seconds (warm file caches)

After this fix:
9.7 seconds (cold file caches)
5.7 seconds (warm file caches)

The names of the symbols are auto generated by appending the symbol's UserID to 
the end of the "___lldb_unnamed_symbol" string and is only done when the name 
is requested from a synthetic symbol if it has no name.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106837

Files:
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/include/lldb/Symbol/Symbol.h
  lldb/include/lldb/Symbol/Symtab.h
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Symbol/ObjectFile.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Symbol/Symtab.cpp
  lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml
  lldb/test/Shell/SymbolFile/Breakpad/symtab.test

Index: lldb/test/Shell/SymbolFile/Breakpad/symtab.test
===
--- lldb/test/Shell/SymbolFile/Breakpad/symtab.test
+++ lldb/test/Shell/SymbolFile/Breakpad/symtab.test
@@ -5,7 +5,7 @@
 # CHECK-LABEL: (lldb) image dump symtab symtab.out
 # CHECK: Symtab, file = {{.*}}symtab.out, num_symbols = 5:
 # CHECK: Index   UserID DSX TypeFile Address/Value Load Address   Size   Flags  Name
-# CHECK: [0]  0  SX Code0x00400x00b0 0x ___lldb_unnamed_symbol{{[0-9]*}}$$symtab.out
+# CHECK: [0]  0  SX Code0x00400x00b0 0x ___lldb_unnamed_symbol{{[0-9]*}}
 # CHECK: [1]  0   X Code0x004000b00x000c 0x f1_func
 # CHECK: [2]  0   X Code0x004000a00x000d 0x func_only
 # CHECK: [3]  0   X Code0x004000c00x0010 0x f2
Index: lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml
===
--- lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml
+++ lldb/test/Shell/ObjectFile/ELF/eh_frame-symbols.yaml
@@ -3,8 +3,8 @@
 
 # CHECK: Index   UserID DSX TypeFile Address/Value Load Address   Size   Flags  Name
 # CHECK: [0]  1 SourceFile  0x0x 0x0004 -
-# CHECK: [1]  2  SX Code0x002011800x0010 0x ___lldb_unnamed_symbol1$${{.*}}
-# CHECK: [2]  3  SX Code0x002011900x0006 0x ___lldb_unnamed_symbol2$${{.*}}
+# CHECK: [1]  2  SX Code0x002011800x0010 0x ___lldb_unnamed_symbol{{[0-9]*}}
+# CHECK: [2]  3  SX Code0x002011900x0006 0x ___lldb_unnamed_symbol{{[0-9]*}}
 
 --- !ELF
 FileHeader:
Index: lldb/source/Symbol/Symtab.cpp
===
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -300,8 +300,10 @@
   // Don't let trampolines get into the lookup by name map If we ever need
   // the tra

[Lldb-commits] [PATCH] D106837: Create synthetic symbol names on demand to improve memory consumption and startup times.

2021-07-26 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.

good luck with the build bots!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106837

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


[Lldb-commits] [PATCH] D105215: [lldb] Remove CPlusPlusLanguage from Mangled

2021-07-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/source/Core/Mangled.cpp:322
   if (preference == ePreferDemangledWithoutArguments) {
-return GetDemangledNameWithoutArguments(m_mangled, demangled);
+if (Language *lang = Language::FindPlugin(GuessLanguage())) {
+  return lang->GetDemangledFunctionNameWithoutArguments(*this);

Maybe we should make a Language::FindPlugin(...) that like:
```
Language *Language::FindPlugin(Mangled::ManglingScheme mangling_scheme);
```
Should be easy to add since this change is kind of about refactoring and 
putting the code into plug-ins. It is essentially what "lldb::LanguageType 
Mangled::GuessLanguage() const" is doing. That code could be moved to where 
Language::FindPlugin(...) lives.



Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:67
 
+ConstString CPlusPlusLanguage::GetDemangledFunctionNameWithoutArguments(
+Mangled mangled) const {

We are doing the work over and over here. Who calls this? Is this something we 
should think about caching? It would be easy to make a map of ConstString 
(demangled name) to ConstString (result of this function call) and we can 
possibly improve the efficiency of this. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105215

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


[Lldb-commits] [lldb] 1a3bf29 - [DebugInfo] Switch to using constructor homing (-debug-info-kind=constructor) by default when debug info is enabled

2021-07-26 Thread Amy Huang via lldb-commits

Author: Amy Huang
Date: 2021-07-26T17:24:42-07:00
New Revision: 1a3bf2953a9209fdc4dbb6e99678e02a7fec019d

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

LOG: [DebugInfo] Switch to using constructor homing 
(-debug-info-kind=constructor) by default when debug info is enabled

Constructor homing reduces the amount of class type info that is emitted
by emitting conmplete type info for a class only when a constructor for
that class is emitted.

This will mainly reduce the amount of duplicate debug info in object
files. In Chrome enabling ctor homing decreased total build directory sizes
by about 30%.

It's also expected that some class types (such as unused classes)
will no longer be emitted in the debug info. This is fine, since we wouldn't
expect to need these types when debugging.

In some cases (e.g. libc++, https://reviews.llvm.org/D98750), classes
are used without calling the constructor. Since this is technically
undefined behavior, enabling constructor homing should be fine.
However Clang now has an attribute
`__attribute__((standalone_debug))` that can be used on classes to
ignore ctor homing.

Bug: https://bugs.llvm.org/show_bug.cgi?id=46537

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

Added: 


Modified: 
clang/include/clang/Basic/DebugInfoOptions.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGenCXX/debug-info-template-deduction-guide.cpp
clang/test/Driver/cl-options.c
clang/test/Driver/clang-g-opts.c
clang/test/Driver/cuda-dwarf-2.cu
clang/test/Driver/debug-options-as.c
clang/test/Driver/debug-options.c
clang/test/Driver/integrated-as.s
clang/test/Driver/myriad-toolchain.c
clang/test/Driver/openmp-offload-gpu.c
clang/test/Driver/split-debug.c
lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DebugInfoOptions.h 
b/clang/include/clang/Basic/DebugInfoOptions.h
index 7f5669c1760fd..c1259d7797db2 100644
--- a/clang/include/clang/Basic/DebugInfoOptions.h
+++ b/clang/include/clang/Basic/DebugInfoOptions.h
@@ -37,6 +37,7 @@ enum DebugInfoKind {
   /// Limit generated debug info for classes to reduce size. This emits class
   /// type info only where the constructor is emitted, if it is a class that
   /// has a constructor.
+  /// FIXME: Consider combining this with LimitedDebugInfo.
   DebugInfoConstructor,
 
   /// Limit generated debug info to reduce size (-fno-standalone-debug). This

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fabacd9d49c02..fa45be0f8169f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -504,7 +504,7 @@ static codegenoptions::DebugInfoKind 
DebugLevelToInfoKind(const Arg &A) {
 return codegenoptions::DebugLineTablesOnly;
   if (A.getOption().matches(options::OPT_gline_directives_only))
 return codegenoptions::DebugDirectivesOnly;
-  return codegenoptions::LimitedDebugInfo;
+  return codegenoptions::DebugInfoConstructor;
 }
 
 static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple &Triple) {
@@ -2545,7 +2545,7 @@ static void CollectArgsForIntegratedAssembler(Compilation 
&C,
   CmdArgs.push_back(Value.data());
 } else {
   RenderDebugEnablingArgs(Args, CmdArgs,
-  codegenoptions::LimitedDebugInfo,
+  codegenoptions::DebugInfoConstructor,
   DwarfVersion, llvm::DebuggerKind::Default);
 }
   } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") ||
@@ -3914,7 +3914,7 @@ static void renderDebugOptions(const ToolChain &TC, const 
Driver &D,
 }
   }
   if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
-DebugInfoKind = codegenoptions::LimitedDebugInfo;
+DebugInfoKind = codegenoptions::DebugInfoConstructor;
 
 // If the last option explicitly specified a debug-info level, use it.
 if (checkDebugInfoOption(A, Args, D, TC) &&
@@ -4036,7 +4036,7 @@ static void renderDebugOptions(const ToolChain &TC, const 
Driver &D,
 if (checkDebugInfoOption(A, Args, D, TC)) {
   if (DebugInfoKind != codegenoptions::DebugLineTablesOnly &&
   DebugInfoKind != codegenoptions::DebugDirectivesOnly) {
-DebugInfoKind = codegenoptions::LimitedDebugInfo;
+DebugInfoKind = codegenoptions::DebugInfoConstructor;
 CmdArgs.push_back("-dwarf-ext-refs");
 CmdArgs.push_back("-fmodule-format=obj");
   }
@@ -4057,7 +4057,8 @@ static void renderDebugOptions(const ToolChain &TC, const 
Driver &D,
   if (const Arg *A = Args.getLastArg(options::OPT_fstandalone_debug))
 (void)checkDebugInfoOption(A, Args, D, TC);
 
-  if (Debug

[Lldb-commits] [lldb] c1b4632 - [trace] Add the definition of a TraceExporter plugin

2021-07-26 Thread Walter Erquinigo via lldb-commits

Author: Walter Erquinigo
Date: 2021-07-26T18:01:50-07:00
New Revision: c1b4632528cb405c9ef94cff90bf43afe688a899

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

LOG: [trace] Add the definition of a TraceExporter plugin

Copying from the inline documentation:

```
Trace exporter plug-ins operate on traces, converting the trace data provided 
by an \a lldb_private::TraceCursor into a different format that can be digested 
by other tools, e.g. Chrome Trace Event Profiler.
Trace exporters are supposed to operate on an architecture-agnostic fashion, as 
a TraceCursor, which feeds the data, hides the actual trace technology being 
used.
```

I want to use this to make the code in https://reviews.llvm.org/D105741 a 
plug-in. I also imagine that there will be more and more exporters being 
implemented, as an exporter creates something useful out of trace data. And tbh 
I don't want to keep adding more stuff to the lldb/Target folder.

This is the minimal definition for a TraceExporter plugin. I plan to use this 
with the following commands:

- thread trace export  [plug-in specific args]
  - This command would support autocompletion of plug-in names
- thread trace export list
  - This command would list the available trace exporter plug-ins

I don't plan to create yet a "process trace export" because it's easier to 
start analyzing the trace of a given thread than of the entire process. When we 
need a process-level command, we can implement it.

I also don't plan to force each "export" command implementation to support 
multiple threads (for example, "thread trace start 1 2 3" or "thread trace 
start all" operate on many threads simultaneously). The reason is that the 
format used by the exporter might or might not support multiple threads, so I'm 
leaving this decision to each trace exporter plug-in.

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

Added: 
lldb/include/lldb/Target/TraceExporter.h
lldb/source/Plugins/TraceExporter/CMakeLists.txt
lldb/source/Plugins/TraceExporter/ctf/CMakeLists.txt
lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h
lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp
lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h
lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTFOptions.td
lldb/source/Target/TraceExporter.cpp

Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/lldb-forward.h
lldb/include/lldb/lldb-private-interfaces.h
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/Plugins/CMakeLists.txt
lldb/source/Target/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index 42fa953797c5f..be91929c62e13 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -369,6 +369,28 @@ class PluginManager {
   /// number plugins, otherwise the actual schema is returned.
   static llvm::StringRef GetTraceSchema(size_t index);
 
+  // TraceExporter
+
+  /// \param[in] create_thread_trace_export_command
+  /// This callback is used to create a CommandObject that will be listed
+  /// under "thread trace export". Can be \b null.
+  static bool RegisterPlugin(
+  ConstString name, const char *description,
+  TraceExporterCreateInstance create_callback,
+  ThreadTraceExportCommandCreator create_thread_trace_export_command);
+
+  static TraceExporterCreateInstance
+  GetTraceExporterCreateCallback(ConstString plugin_name);
+
+  static bool UnregisterPlugin(TraceExporterCreateInstance create_callback);
+
+  static const char *GetTraceExporterPluginNameAtIndex(uint32_t index);
+
+  /// Return the callback used to create the CommandObject that will be listed
+  /// under "thread trace export". Can be \b null.
+  static ThreadTraceExportCommandCreator
+  GetThreadTraceExportCommandCreatorAtIndex(uint32_t index);
+
   // UnwindAssembly
   static bool RegisterPlugin(ConstString name, const char *description,
  UnwindAssemblyCreateInstance create_callback);

diff  --git a/lldb/include/lldb/Target/TraceExporter.h 
b/lldb/include/lldb/Target/TraceExporter.h
new file mode 100644
index 0..6560b39fd42ea
--- /dev/null
+++ b/lldb/include/lldb/Target/TraceExporter.h
@@ -0,0 +1,42 @@
+//===-- TraceExporter.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
+//
+//

[Lldb-commits] [PATCH] D106501: [trace] Add the definition of a TraceExporter plugin

2021-07-26 Thread Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc1b4632528cb: [trace] Add the definition of a TraceExporter 
plugin (authored by Walter Erquinigo ).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106501

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/include/lldb/Target/TraceExporter.h
  lldb/include/lldb/lldb-forward.h
  lldb/include/lldb/lldb-private-interfaces.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Core/PluginManager.cpp
  lldb/source/Plugins/CMakeLists.txt
  lldb/source/Plugins/TraceExporter/CMakeLists.txt
  lldb/source/Plugins/TraceExporter/ctf/CMakeLists.txt
  lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
  lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h
  lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp
  lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h
  lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTFOptions.td
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/TraceExporter.cpp

Index: lldb/source/Target/TraceExporter.cpp
===
--- /dev/null
+++ lldb/source/Target/TraceExporter.cpp
@@ -0,0 +1,32 @@
+//===-- TraceExporter.cpp -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Target/TraceExporter.h"
+
+#include "lldb/Core/PluginManager.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace llvm;
+
+static Error createInvalidPlugInError(StringRef plugin_name) {
+  return createStringError(
+  std::errc::invalid_argument,
+  "no trace expoter plug-in matches the specified type: \"%s\"",
+  plugin_name.data());
+}
+
+Expected
+TraceExporter::FindPlugin(llvm::StringRef plugin_name) {
+  ConstString name(plugin_name);
+  if (auto create_callback =
+  PluginManager::GetTraceExporterCreateCallback(name))
+return create_callback();
+
+  return createInvalidPlugInError(plugin_name);
+}
Index: lldb/source/Target/CMakeLists.txt
===
--- lldb/source/Target/CMakeLists.txt
+++ lldb/source/Target/CMakeLists.txt
@@ -68,6 +68,7 @@
   ThreadSpec.cpp
   Trace.cpp
   TraceCursor.cpp
+  TraceExporter.cpp
   TraceInstructionDumper.cpp
   UnixSignals.cpp
   UnwindAssembly.cpp
Index: lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTFOptions.td
===
--- /dev/null
+++ lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTFOptions.td
@@ -0,0 +1,9 @@
+include "../../../../source/Commands/OptionsBase.td"
+
+let Command = "thread trace export ctf" in {
+  def thread_trace_export_ctf: Option<"tid", "t">,
+Group<1>,
+Arg<"ThreadIndex">,
+Desc<"Export the trace for the specified thread index. Otherwise, the "
+ "currently selected thread will be used.">;
+}
Index: lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h
===
--- /dev/null
+++ lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.h
@@ -0,0 +1,42 @@
+//===-- TraceExporterCTF.h --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_SOURCE_PLUGINS_TRACE_EXPORTER_CTF_H
+#define LLDB_SOURCE_PLUGINS_TRACE_EXPORTER_CTF_H
+
+#include "lldb/Target/TraceExporter.h"
+
+namespace lldb_private {
+namespace ctf {
+
+/// Trace Exporter Plugin that can produce traces in Chrome Trace Format.
+/// Still in development.
+class TraceExporterCTF : public TraceExporter {
+public:
+  ~TraceExporterCTF() override = default;
+
+  /// PluginInterface protocol
+  /// \{
+  static llvm::Expected CreateInstance();
+
+  ConstString GetPluginName() override;
+
+  static void Initialize();
+
+  static void Terminate();
+
+  static ConstString GetPluginNameStatic();
+
+  uint32_t GetPluginVersion() override;
+  /// \}
+};
+
+} // namespace ctf
+} // namespace lldb_private
+
+#endif // LLDB_SOURCE_PLUGINS_TRACE_EXPORTER_CTF_H
Index: lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp
===
--- /dev/null
+++ lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTF.cpp
@@ -0,0 +1,53 @@
+//===

[Lldb-commits] [PATCH] D105741: [trace] Add `thread trace export` command for Intel PT trace visualization

2021-07-26 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

Pretty good. Just some minor nits. Once you rebase on top of the trace exporter 
plugin patch, this should be good to go.




Comment at: lldb/test/API/commands/trace/TestTraceExport.py:54-56
+TODO: Once the "trace save" command is implemented, gather Intel PT 
+trace of this program and load it like the other tests instead of 
+manually executing the commands to trace the program.

delete this. You can actually compile a main.cpp file as part of the test and 
trace it with intel pt, and then check its output. You don't need "trace save" 
to do that.



Comment at: lldb/test/API/commands/trace/intelpt-trace/functions_example.cpp:1
+void log_request_response(int reqest_response) {
+  // logging logic

rename this file to export_htr_input.cpp or something like that. Same for the 
a.out



Comment at: lldb/test/API/commands/trace/intelpt-trace/functions_example.cpp:26
+}
+
+int main() {

given that we are going to add a binary and we don't want to do it often, add 
another function like

  void iterative_handle_request_by_id(int id, int reps) {
for (int i = 0; i < reps; i++) {
  if (i % 2 == 0)
slow_handle_request(id);
  else
fast_handle_request(id);
  }

just to have someone interesting to test later. Then recompile your a.out


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

https://reviews.llvm.org/D105741

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


[Lldb-commits] [PATCH] D105741: [trace] Add `thread trace export` command for Intel PT trace visualization

2021-07-26 Thread Jakob Johnson via Phabricator via lldb-commits
jj10306 updated this revision to Diff 361916.
jj10306 added a comment.

Rebased (integrate with https://reviews.llvm.org/D106501#change-SoRRVpoqDNdx) 
and address comments


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

https://reviews.llvm.org/D105741

Files:
  lldb/docs/htr.rst
  lldb/docs/media/basic_super_block_pass.png
  lldb/docs/media/htr_example.png
  lldb/include/lldb/Target/Trace.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Plugins/TraceExporter/CMakeLists.txt
  lldb/source/Plugins/TraceExporter/common/CMakeLists.txt
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
  lldb/source/Plugins/TraceExporter/common/TraceHTR.h
  lldb/source/Plugins/TraceExporter/ctf/CMakeLists.txt
  lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
  lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h
  lldb/source/Plugins/TraceExporter/ctf/TraceExporterCTFOptions.td
  lldb/test/API/commands/trace/TestTraceExport.py
  lldb/test/API/commands/trace/intelpt-trace/export_ctf_test_program.cpp
  lldb/test/API/commands/trace/intelpt-trace/export_ctf_test_program.out

Index: lldb/test/API/commands/trace/intelpt-trace/export_ctf_test_program.cpp
===
--- /dev/null
+++ lldb/test/API/commands/trace/intelpt-trace/export_ctf_test_program.cpp
@@ -0,0 +1,34 @@
+void log_response(int reqest_response) {
+  // fake logging logic
+}
+
+int slow_handle_request(int id) {
+  // "slow" request handling logic
+  for (int i = 0; i < 10; i++)
+id += 2;
+  return id;
+}
+
+int fast_handle_request(int id) {
+  // "fast" request handling logic
+  return id + 2;
+}
+
+void iterative_handle_request_by_id(int id, int reps) {
+  int response;
+  for (int i = 0; i < reps; i++) {
+if (i % 2 == 0)
+  response = fast_handle_request(id);
+else
+  response = slow_handle_request(id);
+log_response(response);
+  }
+}
+
+int main() {
+  int n_requests = 10;
+  for (int id = 0; id < n_requests; id++) {
+iterative_handle_request_by_id(id, 3);
+  }
+  return 0;
+}
Index: lldb/test/API/commands/trace/TestTraceExport.py
===
--- /dev/null
+++ lldb/test/API/commands/trace/TestTraceExport.py
@@ -0,0 +1,112 @@
+from collections import defaultdict
+import lldb
+import json
+from intelpt_testcase import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test.decorators import *
+import os
+
+class TestTraceExport(TraceIntelPTTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def testErrorMessages(self):
+ctf_test_file = self.getBuildArtifact("ctf-test.json")
+# We first check the output when there are no targets
+self.expect(f"thread trace export ctf --file {ctf_test_file}",
+substrs=["error: invalid target, create a target using the 'target create' command"],
+error=True)
+
+# We now check the output when there's a non-running target
+self.expect("target create " +
+os.path.join(self.getSourceDir(), "intelpt-trace", "a.out"))
+
+self.expect(f"thread trace export ctf --file {ctf_test_file}",
+substrs=["error: invalid process"],
+error=True)
+
+# Now we check the output when there's a running target without a trace
+self.expect("b main")
+self.expect("run")
+
+self.expect(f"thread trace export ctf --file {ctf_test_file}",
+substrs=["error: Process is not being traced"],
+error=True)
+
+def testExportCreatesFile(self):
+self.expect("trace load -v " +
+os.path.join(self.getSourceDir(), "intelpt-trace", "trace.json"),
+substrs=["intel-pt"])
+
+ctf_test_file = self.getBuildArtifact("ctf-test.json")
+
+if os.path.exists(ctf_test_file):
+remove_file(ctf_test_file)
+self.expect(f"thread trace export ctf --file {ctf_test_file}")
+self.assertTrue(os.path.exists(ctf_test_file))
+
+
+def testHtrBasicSuperBlockPass(self):
+'''
+Test the BasicSuperBlock pass of HTR
+
+TODO: Once the "trace save" command is implemented, gather Intel PT 
+trace of this program and load it like the other tests instead of 
+manually executing the commands to trace the program.
+'''
+self.expect(f"target create {os.path.join(self.getSourceDir(), 'intelpt-trace', 'export_ctf_test_program.out')}")
+self.expect("b main")
+self.expect("r")
+self.expect("b exit")
+self.expect("thread trace start")
+self.expect("c")
+
+ctf_test_file = self.getBuildArtifact("ctf-test.json")
+
+if os.path.exists(ctf_test_file):
+remove_file(ctf_test_file)
+self.expect(f"thread trace export ctf --file {ctf_test_file}")
+self.assertTrue(os.path.exists(ctf_t

[Lldb-commits] [PATCH] D106270: [DWARF5] Fix offset check when using .debug_names

2021-07-26 Thread Kim-Anh Tran via Phabricator via lldb-commits
kimanh added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3024
-m_index->GetGlobalVariables(
-dwarf_cu->GetNonSkeletonUnit(), [&](DWARFDIE die) {
-  VariableSP var_sp(

shafik wrote:
> So is the problem that calling `GetNonSkeletonUnit()` does not work here b/c 
> in `DebugNamesDWARFIndex` case we don't want this but in the other cases we 
> do? 
> 
> 
Yes, that's correct!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106270

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