[Lldb-commits] [lldb] 808bcb7 - [lldb] [test] Mark *fork-follow-child* tests non-Darwin

2021-09-03 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-09-03T09:07:53+02:00
New Revision: 808bcb7a0ea5a897cd8311c27751504b4dd4f5a5

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

LOG: [lldb] [test] Mark *fork-follow-child* tests non-Darwin

Added: 


Modified: 
lldb/test/Shell/Subprocess/fork-follow-child-softbp.test
lldb/test/Shell/Subprocess/fork-follow-child-wp.test
lldb/test/Shell/Subprocess/fork-follow-child.test
lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test
lldb/test/Shell/Subprocess/vfork-follow-child-wp.test
lldb/test/Shell/Subprocess/vfork-follow-child.test

Removed: 




diff  --git a/lldb/test/Shell/Subprocess/fork-follow-child-softbp.test 
b/lldb/test/Shell/Subprocess/fork-follow-child-softbp.test
index 6a9254d1ba8c8..68914a53a05ed 100644
--- a/lldb/test/Shell/Subprocess/fork-follow-child-softbp.test
+++ b/lldb/test/Shell/Subprocess/fork-follow-child-softbp.test
@@ -1,4 +1,5 @@
 # REQUIRES: native
+# UNSUPPORTED: system-darwin
 # UNSUPPORTED: system-windows
 # RUN: %clangxx_host %p/Inputs/fork.cpp -DTEST_FORK=fork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s

diff  --git a/lldb/test/Shell/Subprocess/fork-follow-child-wp.test 
b/lldb/test/Shell/Subprocess/fork-follow-child-wp.test
index 6f3b67ea25dd9..437565788eeb9 100644
--- a/lldb/test/Shell/Subprocess/fork-follow-child-wp.test
+++ b/lldb/test/Shell/Subprocess/fork-follow-child-wp.test
@@ -1,4 +1,5 @@
 # REQUIRES: native && dbregs-set
+# UNSUPPORTED: system-darwin
 # UNSUPPORTED: system-windows
 # RUN: %clangxx_host -g %p/Inputs/fork.cpp -DTEST_FORK=fork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s

diff  --git a/lldb/test/Shell/Subprocess/fork-follow-child.test 
b/lldb/test/Shell/Subprocess/fork-follow-child.test
index a1df30082b33b..984caff6d3458 100644
--- a/lldb/test/Shell/Subprocess/fork-follow-child.test
+++ b/lldb/test/Shell/Subprocess/fork-follow-child.test
@@ -1,4 +1,5 @@
 # REQUIRES: native
+# UNSUPPORTED: system-darwin
 # UNSUPPORTED: system-windows
 # RUN: %clangxx_host %p/Inputs/fork.cpp -DTEST_FORK=fork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s

diff  --git a/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test 
b/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test
index 3de6941d671c4..4dbe2ea4a11b8 100644
--- a/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test
+++ b/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test
@@ -1,4 +1,5 @@
 # REQUIRES: native
+# UNSUPPORTED: system-darwin
 # UNSUPPORTED: system-windows
 # RUN: %clangxx_host %p/Inputs/fork.cpp -DTEST_FORK=vfork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s

diff  --git a/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test 
b/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test
index 15fa0c5fdd33d..ffe33beac7816 100644
--- a/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test
+++ b/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test
@@ -1,6 +1,6 @@
 # REQUIRES: native && dbregs-set
-# UNSUPPORTED: system-windows
 # UNSUPPORTED: system-darwin
+# UNSUPPORTED: system-windows
 # RUN: %clangxx_host -g %p/Inputs/fork.cpp -DTEST_FORK=vfork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
 settings set target.process.follow-fork-mode child

diff  --git a/lldb/test/Shell/Subprocess/vfork-follow-child.test 
b/lldb/test/Shell/Subprocess/vfork-follow-child.test
index 6b6403274a11c..e21b918e16504 100644
--- a/lldb/test/Shell/Subprocess/vfork-follow-child.test
+++ b/lldb/test/Shell/Subprocess/vfork-follow-child.test
@@ -1,4 +1,5 @@
 # REQUIRES: native
+# UNSUPPORTED: system-darwin
 # UNSUPPORTED: system-windows
 # RUN: %clangxx_host %p/Inputs/fork.cpp -DTEST_FORK=vfork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s



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


[Lldb-commits] [PATCH] D100503: [lldb] [client] Implement follow-fork-mode

2021-09-03 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

I'm sorry about looking into it this late. I've just marked them all 
unsupported on Darwin.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100503

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


[Lldb-commits] [lldb] 7bb42dc - [lldb/lua] Force Lua version to be 5.3

2021-09-03 Thread Siger Yang via lldb-commits

Author: Siger Yang
Date: 2021-09-03T15:22:57+08:00
New Revision: 7bb42dc6b114f57200abfebaaa01160914be6bba

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

LOG: [lldb/lua] Force Lua version to be 5.3

Due to CMake cache, find_package in FindLuaAndSwig.cmake
will be ignored. This commit adds EXACT and REQUIRED flags
to it and removes find_package in Lua ScriptInterpreter.

Signed-off-by: Siger Yang 

Reviewed By: tammela, JDevlieghere

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

Added: 


Modified: 
lldb/cmake/modules/FindLuaAndSwig.cmake
lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/FindLuaAndSwig.cmake 
b/lldb/cmake/modules/FindLuaAndSwig.cmake
index f6251bbd1042c..847394100c5a0 100644
--- a/lldb/cmake/modules/FindLuaAndSwig.cmake
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -9,7 +9,7 @@ if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
 else()
   find_package(SWIG 3.0)
   if (SWIG_FOUND)
-find_package(Lua 5.3)
+find_package(Lua 5.3 EXACT REQUIRED)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt 
b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
index f5c62ee3a54f3..498bd97839510 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
+++ b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
@@ -1,5 +1,3 @@
-find_package(Lua REQUIRED)
-
 add_lldb_library(lldbPluginScriptInterpreterLua PLUGIN
   Lua.cpp
   ScriptInterpreterLua.cpp



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


[Lldb-commits] [PATCH] D108515: [lldb/lua] Force Lua version to be 5.3

2021-09-03 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7bb42dc6b114: [lldb/lua] Force Lua version to be 5.3 
(authored by Siger Yang ).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108515

Files:
  lldb/cmake/modules/FindLuaAndSwig.cmake
  lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt


Index: lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
@@ -1,5 +1,3 @@
-find_package(Lua REQUIRED)
-
 add_lldb_library(lldbPluginScriptInterpreterLua PLUGIN
   Lua.cpp
   ScriptInterpreterLua.cpp
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -9,7 +9,7 @@
 else()
   find_package(SWIG 3.0)
   if (SWIG_FOUND)
-find_package(Lua 5.3)
+find_package(Lua 5.3 EXACT REQUIRED)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES


Index: lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
@@ -1,5 +1,3 @@
-find_package(Lua REQUIRED)
-
 add_lldb_library(lldbPluginScriptInterpreterLua PLUGIN
   Lua.cpp
   ScriptInterpreterLua.cpp
Index: lldb/cmake/modules/FindLuaAndSwig.cmake
===
--- lldb/cmake/modules/FindLuaAndSwig.cmake
+++ lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -9,7 +9,7 @@
 else()
   find_package(SWIG 3.0)
   if (SWIG_FOUND)
-find_package(Lua 5.3)
+find_package(Lua 5.3 EXACT REQUIRED)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D108515: [lldb/lua] Force Lua version to be 5.3

2021-09-03 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added inline comments.



Comment at: lldb/cmake/modules/FindLuaAndSwig.cmake:12
   if (SWIG_FOUND)
-find_package(Lua 5.3)
+find_package(Lua 5.3 EXACT REQUIRED)
 if(LUA_FOUND AND SWIG_FOUND)

This breaks building in setups where SWIG is available, but not Lua. Previously 
this detected Lua and took it into use if both Lua and SWIG were available, and 
if not , proceeded without them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108515

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


[Lldb-commits] [PATCH] D108515: [lldb/lua] Force Lua version to be 5.3

2021-09-03 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added inline comments.



Comment at: lldb/cmake/modules/FindLuaAndSwig.cmake:12
   if (SWIG_FOUND)
-find_package(Lua 5.3)
+find_package(Lua 5.3 EXACT REQUIRED)
 if(LUA_FOUND AND SWIG_FOUND)

mstorsjo wrote:
> This breaks building in setups where SWIG is available, but not Lua. 
> Previously this detected Lua and took it into use if both Lua and SWIG were 
> available, and if not , proceeded without them.
Just removing the `REQUIRED` from here seems to fix my build. Or I could just 
revert the patch to return to discussing how it should be done.

I'm doing either of them fairly soon in any case, to unbreak my build.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108515

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


[Lldb-commits] [lldb] 49229bb - Revert "[lldb/lua] Force Lua version to be 5.3"

2021-09-03 Thread Siger Yang via lldb-commits

Author: Siger Yang
Date: 2021-09-03T17:31:25+08:00
New Revision: 49229bb92b4ba345a414732f4e2248b44c4fcb1d

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

LOG: Revert "[lldb/lua] Force Lua version to be 5.3"

This commit causes buildbot failures if SWIG is available but Lua is
not present.

This reverts commit 7bb42dc6b114f57200abfebaaa01160914be6bba.

Added: 


Modified: 
lldb/cmake/modules/FindLuaAndSwig.cmake
lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/FindLuaAndSwig.cmake 
b/lldb/cmake/modules/FindLuaAndSwig.cmake
index 847394100c5a0..f6251bbd1042c 100644
--- a/lldb/cmake/modules/FindLuaAndSwig.cmake
+++ b/lldb/cmake/modules/FindLuaAndSwig.cmake
@@ -9,7 +9,7 @@ if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE)
 else()
   find_package(SWIG 3.0)
   if (SWIG_FOUND)
-find_package(Lua 5.3 EXACT REQUIRED)
+find_package(Lua 5.3)
 if(LUA_FOUND AND SWIG_FOUND)
   mark_as_advanced(
 LUA_LIBRARIES

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt 
b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
index 498bd97839510..f5c62ee3a54f3 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
+++ b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt
@@ -1,3 +1,5 @@
+find_package(Lua REQUIRED)
+
 add_lldb_library(lldbPluginScriptInterpreterLua PLUGIN
   Lua.cpp
   ScriptInterpreterLua.cpp



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


[Lldb-commits] [PATCH] D108515: [lldb/lua] Force Lua version to be 5.3

2021-09-03 Thread Siger Young via Phabricator via lldb-commits
siger-young added inline comments.



Comment at: lldb/cmake/modules/FindLuaAndSwig.cmake:12
   if (SWIG_FOUND)
-find_package(Lua 5.3)
+find_package(Lua 5.3 EXACT REQUIRED)
 if(LUA_FOUND AND SWIG_FOUND)

mstorsjo wrote:
> This breaks building in setups where SWIG is available, but not Lua. 
> Previously this detected Lua and took it into use if both Lua and SWIG were 
> available, and if not , proceeded without them.
I think removing the "REQUIRED" flags might work. I will revert the broken 
commit first.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108515

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


[Lldb-commits] [PATCH] D107456: [lldb] Support .debug_rnglists.dwo sections in dwp file

2021-09-03 Thread Kim-Anh Tran via Phabricator via lldb-commits
kimanh updated this revision to Diff 370562.
kimanh added a comment.

- splitting up new code (for error handling) into a different CL
- keep code that was already accepted


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107456

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s

Index: lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s
@@ -0,0 +1,187 @@
+## This tests if .debug_rnglists.dwo are correctly read if they are part
+## of a dwp file.
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym MAIN=0 > %t
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t.dwp
+# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" -o exit | FileCheck %s
+
+# CHECK-LABEL: image lookup -v -s lookup_rnglists
+# CHECK:  Function: id = {{.*}}, name = "rnglists", range = [0x-0x0003)
+# CHECK:Blocks: id = {{.*}}, range = [0x-0x0003)
+# CHECK-NEXT:   id = {{.*}}, range = [0x0001-0x0002)
+
+.text
+rnglists:
+nop
+.Lblock1_begin:
+lookup_rnglists:
+nop
+.Lblock1_end:
+nop
+.Lrnglists_end:
+
+## The main file.
+.ifdef MAIN
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   0   # DW_CHILDREN_no
+.byte   0x76# DW_AT_dwo_name
+.byte   8   # DW_FORM_string
+.byte   115 # DW_AT_addr_base
+.byte   23  # DW_FORM_sec_offset
+.byte   85  # DW_AT_ranges
+.byte   35  # DW_FORM_rnglistx
+.byte   116 # DW_AT_rnglists_base
+.byte   23  # DW_FORM_sec_offset
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   0   # EOM(3)
+
+.section.debug_info,"",@progbits
+.Lcu_begin0:
+.long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+.short  5   # DWARF version number
+.byte   4   # DWARF Unit Type
+.byte   8   # Address Size (in bytes)
+.long   .debug_abbrev   # Offset Into Abbrev. Section
+.quad   1026699901672188186 # DWO id
+.byte   1   # Abbrev [1] DW_TAG_compile_unit
+.asciz  "debug_rnglists-dwp.s.tmp.dwo"  # DW_AT_dwo_name
+.long   .Laddr_table_base0  # DW_AT_addr_base
+.byte   0   # DW_AT_ranges
+.long   .Lskel_rnglists_table_base # DW_AT_rnglists_base
+.Ldebug_info_end0:
+
+.section.debug_addr,"",@progbits
+.long   .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
+.Ldebug_addr_start0:
+.short  5   # DWARF version number
+.byte   8   # Address size
+.byte   0   # Segment selector size
+.Laddr_table_base0:
+.quad   rnglists
+.quad   .Lblock1_begin
+.Ldebug_addr_end0:
+
+.section.debug_rnglists,"",@progbits
+.long   .Lskel_rnglist_table_end-.Lskel_rnglist_table_start # Length
+.Lskel_rnglist_table_start:
+.short  5   # Version
+.byte   8   # Address size
+.byte   0   # Segment selector size
+.long   1   # Offset entry count
+.Lskel_rnglists_table_base:
+.long   .Lskel_ranges0-.Lskel_rnglists_table_base
+.Lskel_ranges0:
+.byte   7   # DW_RLE_start_length
+.quad   rnglists
+.uleb128   .Lrnglists_end-rnglists
+.byte   0   # DW_RLE_end_of_list
+.Lskel_rnglist_table_end:
+ .else
+ ## DWP file starts here.
+.section.debug_abbrev.dwo,"e",@progbits
+.LAbbrevBegin:
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   1   # DW_CHILDREN_yes
+.byte   37  # DW_AT_producer
+.byte   8   # DW_FORM_string
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   2   # Abbreviation Code
+.byte   46  # DW_TAG_subprogram
+.byte   1   # DW_C

[Lldb-commits] [PATCH] D109231: [lldb] Improve error handling around GetRngListData()

2021-09-03 Thread Kim-Anh Tran via Phabricator via lldb-commits
kimanh created this revision.
kimanh added a reviewer: jankratochvil.
kimanh published this revision for review.
kimanh added a comment.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

I've split up the other CL (https://reviews.llvm.org/D107456) into the part 
that was reviewed, and this: the error handling that was requested on that CL. 
Please take a look whenever you have time!


This adds more informative error handling around the
usage of GetRngListData.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109231

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s

Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
===
--- lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
+++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -29,7 +29,7 @@
 # RUN:   -o exit 2>&1 | FileCheck --check-prefix=RNGLISTBASE %s
 
 # RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists
-# RNGLISTBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24), please file a bug and attach the file at the start of this error message
+# RNGLISTBASE: error: DW_AT_range-DW_FORM_sec_offset.s.tmp-rnglistbase {0x0043}: DIE has DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed (invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base is 24, offset to range list table is 0x18), please file a bug and attach the file at the start of this error message
 
 .text
 rnglists:
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -286,7 +286,7 @@
 
   const llvm::Optional &GetRnglistTable();
 
-  lldb_private::DWARFDataExtractor GetRnglistData() const;
+  lldb_private::DWARFDataExtractor GetRnglistData(uint32_t &Offset) const;
 
   SymbolFileDWARF &m_dwarf;
   std::shared_ptr m_dwo;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -513,14 +513,16 @@
   return data;
 }
 
-DWARFDataExtractor DWARFUnit::GetRnglistData() const {
+DWARFDataExtractor DWARFUnit::GetRnglistData(uint32_t &Offset) const {
   DWARFContext &Ctx = GetSymbolFileDWARF().GetDWARFContext();
   const DWARFDataExtractor &data = Ctx.getOrLoadRngListsData();
   if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
 if (const auto *contribution =
-entry->getContribution(llvm::DW_SECT_RNGLISTS))
+entry->getContribution(llvm::DW_SECT_RNGLISTS)) {
+  Offset = contribution->Offset;
   return DWARFDataExtractor(data, contribution->Offset,
 contribution->Length);
+}
 GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
 "Failed to find range list contribution for CU with signature "
 "0x%" PRIx64,
@@ -541,14 +543,18 @@
 DWARFUnit::GetRnglistTable() {
   if (GetVersion() >= 5 && !m_rnglist_table_done) {
 m_rnglist_table_done = true;
+uint32_t contribution_off;
 if (auto table_or_error =
 ParseListTableHeader(
-GetRnglistData().GetAsLLVM(), m_ranges_base, DWARF32))
+GetRnglistData(contribution_off).GetAsLLVM(), m_ranges_base,
+DWARF32))
   m_rnglist_table = std::move(table_or_error.get());
 else
   GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
-  "Failed to extract range list table at offset 0x%" PRIx64 ": %s",
-  m_ranges_base, toString(table_or_error.takeError()).c_str());
+  "Failed to extract range list table at offset 0x%" PRIx64
+  " (DW_AT_rnglists_base is %" PRIu64 "): %s",
+  m_ranges_base + contribution_off, m_ranges_base,
+  toString(table_or_error.takeError()).c_str());
   }
   return m_rnglist_table;
 }
@@ -563,14 +569,17 @@
"DW_FORM_rnglistx cannot be used without "
"DW_AT_rnglists_base for CU at 0x%8.8x",
GetOffset());
+  uint32_t contribution_off;
   if (llvm::Optional off = GetRnglistTable()->getOffsetEntry(
-  GetRnglistData().GetAsLLVM(), Index))
+  GetRnglistData(contribution_off).GetAsLLVM(), Index))
 return *off + m_ranges_base;
   return llvm::createStringError(
   errc::invalid_argument,
   "invalid range list table in

[Lldb-commits] [PATCH] D107456: [lldb] Support .debug_rnglists.dwo sections in dwp file

2021-09-03 Thread Kim-Anh Tran via Phabricator via lldb-commits
kimanh added a comment.

I've split up the code that addresses the .debug_rnglists from the code that 
takes care of better error handling (https://reviews.llvm.org/D109231). I'll 
commit the reviewed part (this).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107456

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


[Lldb-commits] [lldb] ec671f3 - [lldb] Support .debug_rnglists.dwo sections in dwp file

2021-09-03 Thread Kim-Anh Tran via lldb-commits

Author: Kim-Anh Tran
Date: 2021-09-03T15:19:50+02:00
New Revision: ec671f3ea00bcbd7cca7f0d9209c9d775dd47c39

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

LOG: [lldb] Support .debug_rnglists.dwo sections in dwp file

This patch considers the CU index entry
when reading the .debug_rnglists.dwo section.

Reviewed By: jankratochvil

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 9a56e1e6aa2c6..988c1a75f5450 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -513,6 +513,24 @@ DWARFDataExtractor DWARFUnit::GetLocationData() const {
   return data;
 }
 
+DWARFDataExtractor DWARFUnit::GetRnglistData() const {
+  DWARFContext &Ctx = GetSymbolFileDWARF().GetDWARFContext();
+  const DWARFDataExtractor &data = Ctx.getOrLoadRngListsData();
+  if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
+if (const auto *contribution =
+entry->getContribution(llvm::DW_SECT_RNGLISTS))
+  return DWARFDataExtractor(data, contribution->Offset,
+contribution->Length);
+GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
+"Failed to find range list contribution for CU with signature "
+"0x%" PRIx64,
+entry->getSignature());
+
+return DWARFDataExtractor();
+  }
+  return data;
+}
+
 void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) {
   lldbassert(!m_rnglist_table_done);
 
@@ -525,8 +543,7 @@ DWARFUnit::GetRnglistTable() {
 m_rnglist_table_done = true;
 if (auto table_or_error =
 ParseListTableHeader(
-m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
-m_ranges_base, DWARF32))
+GetRnglistData().GetAsLLVM(), m_ranges_base, DWARF32))
   m_rnglist_table = std::move(table_or_error.get());
 else
   GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError(
@@ -547,7 +564,7 @@ llvm::Expected 
DWARFUnit::GetRnglistOffset(uint32_t Index) {
"DW_AT_rnglists_base for CU at 0x%8.8x",
GetOffset());
   if (llvm::Optional off = GetRnglistTable()->getOffsetEntry(
-  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), 
Index))
+  GetRnglistData().GetAsLLVM(), Index))
 return *off + m_ranges_base;
   return llvm::createStringError(
   errc::invalid_argument,
@@ -1001,8 +1018,7 @@ DWARFUnit::FindRnglistFromOffset(dw_offset_t offset) {
 return llvm::createStringError(errc::invalid_argument,
"missing or invalid range list table");
 
-  llvm::DWARFDataExtractor data =
-  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM();
+  llvm::DWARFDataExtractor data = GetRnglistData().GetAsLLVM();
 
   // As DW_AT_rnglists_base may be missing we need to call setAddressSize.
   data.setAddressSize(m_header.GetAddressByteSize());

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 79059b67ba88c..cb7018144bacc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -286,6 +286,8 @@ class DWARFUnit : public lldb_private::UserID {
 
   const llvm::Optional &GetRnglistTable();
 
+  lldb_private::DWARFDataExtractor GetRnglistData() const;
+
   SymbolFileDWARF &m_dwarf;
   std::shared_ptr m_dwo;
   DWARFUnitHeader m_header;

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s 
b/lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s
new file mode 100644
index 0..227ca9e49adc9
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s
@@ -0,0 +1,187 @@
+## This tests if .debug_rnglists.dwo are correctly read if they are part
+## of a dwp file.
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym MAIN=0 > %t
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t.dwp
+# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" -o exit | FileCheck %s
+
+# CHECK-LABEL: image lookup -v -s lookup_rnglists
+# CHECK:  Function: id = {{.*}}, name = "rnglists", range = 
[0x-0x0003)
+# CHECK:Blocks: id = {{.*}}, range = [0x-0x0003)
+# CHECK-NEXT:   id = {{.*}}, range = [0x0001-0x0002)
+
+.text
+rnglists:
+nop
+.L

[Lldb-commits] [PATCH] D107456: [lldb] Support .debug_rnglists.dwo sections in dwp file

2021-09-03 Thread Kim-Anh Tran 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 rGec671f3ea00b: [lldb] Support .debug_rnglists.dwo sections in 
dwp file (authored by kimanh).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107456

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s

Index: lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/x86/debug_rnglists-dwp.s
@@ -0,0 +1,187 @@
+## This tests if .debug_rnglists.dwo are correctly read if they are part
+## of a dwp file.
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s --defsym MAIN=0 > %t
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t.dwp
+# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" -o exit | FileCheck %s
+
+# CHECK-LABEL: image lookup -v -s lookup_rnglists
+# CHECK:  Function: id = {{.*}}, name = "rnglists", range = [0x-0x0003)
+# CHECK:Blocks: id = {{.*}}, range = [0x-0x0003)
+# CHECK-NEXT:   id = {{.*}}, range = [0x0001-0x0002)
+
+.text
+rnglists:
+nop
+.Lblock1_begin:
+lookup_rnglists:
+nop
+.Lblock1_end:
+nop
+.Lrnglists_end:
+
+## The main file.
+.ifdef MAIN
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   0   # DW_CHILDREN_no
+.byte   0x76# DW_AT_dwo_name
+.byte   8   # DW_FORM_string
+.byte   115 # DW_AT_addr_base
+.byte   23  # DW_FORM_sec_offset
+.byte   85  # DW_AT_ranges
+.byte   35  # DW_FORM_rnglistx
+.byte   116 # DW_AT_rnglists_base
+.byte   23  # DW_FORM_sec_offset
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   0   # EOM(3)
+
+.section.debug_info,"",@progbits
+.Lcu_begin0:
+.long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+.short  5   # DWARF version number
+.byte   4   # DWARF Unit Type
+.byte   8   # Address Size (in bytes)
+.long   .debug_abbrev   # Offset Into Abbrev. Section
+.quad   1026699901672188186 # DWO id
+.byte   1   # Abbrev [1] DW_TAG_compile_unit
+.asciz  "debug_rnglists-dwp.s.tmp.dwo"  # DW_AT_dwo_name
+.long   .Laddr_table_base0  # DW_AT_addr_base
+.byte   0   # DW_AT_ranges
+.long   .Lskel_rnglists_table_base # DW_AT_rnglists_base
+.Ldebug_info_end0:
+
+.section.debug_addr,"",@progbits
+.long   .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
+.Ldebug_addr_start0:
+.short  5   # DWARF version number
+.byte   8   # Address size
+.byte   0   # Segment selector size
+.Laddr_table_base0:
+.quad   rnglists
+.quad   .Lblock1_begin
+.Ldebug_addr_end0:
+
+.section.debug_rnglists,"",@progbits
+.long   .Lskel_rnglist_table_end-.Lskel_rnglist_table_start # Length
+.Lskel_rnglist_table_start:
+.short  5   # Version
+.byte   8   # Address size
+.byte   0   # Segment selector size
+.long   1   # Offset entry count
+.Lskel_rnglists_table_base:
+.long   .Lskel_ranges0-.Lskel_rnglists_table_base
+.Lskel_ranges0:
+.byte   7   # DW_RLE_start_length
+.quad   rnglists
+.uleb128   .Lrnglists_end-rnglists
+.byte   0   # DW_RLE_end_of_list
+.Lskel_rnglist_table_end:
+ .else
+ ## DWP file starts here.
+.section.debug_abbrev.dwo,"e",@progbits
+.LAbbrevBegin:
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   1   # DW_CHILDREN_yes
+.byte   37  # DW_AT_producer
+.byte   8   # DW_FORM_string
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   2   # Abbreviation Code
+.byte   46 

[Lldb-commits] [lldb] dda643c - [lldb] [test] Mark vfork-follow-child-* tests unsupported (flaky) on aarch64

2021-09-03 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-09-03T16:04:34+02:00
New Revision: dda643c9fbae59a049d5499920a40455071c206c

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

LOG: [lldb] [test] Mark vfork-follow-child-* tests unsupported (flaky) on 
aarch64

Added: 


Modified: 
lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test
lldb/test/Shell/Subprocess/vfork-follow-child-wp.test

Removed: 




diff  --git a/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test 
b/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test
index 4dbe2ea4a11b..e9cda8bd58f1 100644
--- a/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test
+++ b/lldb/test/Shell/Subprocess/vfork-follow-child-softbp.test
@@ -1,6 +1,8 @@
 # REQUIRES: native
 # UNSUPPORTED: system-darwin
 # UNSUPPORTED: system-windows
+# This test is very flaky on aarch64.
+# UNSUPPORTED: system-linux && target-aarch64
 # RUN: %clangxx_host %p/Inputs/fork.cpp -DTEST_FORK=vfork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
 settings set target.process.follow-fork-mode child

diff  --git a/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test 
b/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test
index ffe33beac781..66cfa439f534 100644
--- a/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test
+++ b/lldb/test/Shell/Subprocess/vfork-follow-child-wp.test
@@ -1,6 +1,8 @@
 # REQUIRES: native && dbregs-set
 # UNSUPPORTED: system-darwin
 # UNSUPPORTED: system-windows
+# This test is very flaky on aarch64.
+# UNSUPPORTED: system-linux && target-aarch64
 # RUN: %clangxx_host -g %p/Inputs/fork.cpp -DTEST_FORK=vfork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
 settings set target.process.follow-fork-mode child



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


[Lldb-commits] [lldb] 5ef63c9 - [lldb] [test] Mark the remaining vfork-follow-child test unsupported (flaky) on aarch64

2021-09-03 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2021-09-03T16:30:25+02:00
New Revision: 5ef63c953f37b878f5a39aece231aada33ee9798

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

LOG: [lldb] [test] Mark the remaining vfork-follow-child test unsupported 
(flaky) on aarch64

Added: 


Modified: 
lldb/test/Shell/Subprocess/vfork-follow-child.test

Removed: 




diff  --git a/lldb/test/Shell/Subprocess/vfork-follow-child.test 
b/lldb/test/Shell/Subprocess/vfork-follow-child.test
index e21b918e1650..57a054a15b28 100644
--- a/lldb/test/Shell/Subprocess/vfork-follow-child.test
+++ b/lldb/test/Shell/Subprocess/vfork-follow-child.test
@@ -1,6 +1,8 @@
 # REQUIRES: native
 # UNSUPPORTED: system-darwin
 # UNSUPPORTED: system-windows
+# This test is very flaky on aarch64.
+# UNSUPPORTED: system-linux && target-aarch64
 # RUN: %clangxx_host %p/Inputs/fork.cpp -DTEST_FORK=vfork -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
 settings set target.process.follow-fork-mode child



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


[Lldb-commits] [PATCH] D107521: [lldb/Plugins] Introduce Scripted Interface Factory

2021-09-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107521

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


[Lldb-commits] [lldb] 3925204 - [lldb/Plugins] Introduce Scripted Interface Factory

2021-09-03 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2021-09-03T19:37:25+02:00
New Revision: 3925204c1f5880f491e08d8481e88342bbeb7bc4

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

LOG: [lldb/Plugins] Introduce Scripted Interface Factory

This patch splits the previous `ScriptedProcessPythonInterface` into
multiple specific classes:

1. The `ScriptedInterface` abstract class that carries the interface
   instance object and its virtual pure abstract creation method.

2. The `ScriptedPythonInterface` that holds a generic `Dispatch` method that
   can be used by various interfaces to call python methods and also keeps a
   reference to the Python Script Interpreter instance.

3. The `ScriptedProcessInterface` that describes the base Scripted
   Process model with all the methods used in the underlying script.

All these components are used to refactor the `ScriptedProcessPythonInterface`
class, making it more modular.

This patch is also a requirement for the upcoming work on `ScriptedThread`.

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

Signed-off-by: Med Ismail Bennani 

Added: 
lldb/include/lldb/Interpreter/ScriptedInterface.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h

Modified: 
lldb/bindings/python/python-wrapper.swig
lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp

lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Removed: 




diff  --git a/lldb/bindings/python/python-wrapper.swig 
b/lldb/bindings/python/python-wrapper.swig
index 4c39e9c2c776a..a148ec3544ab8 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -288,7 +288,6 @@ LLDBSwigPythonCreateScriptedProcess
 if (python_class_name == NULL || python_class_name[0] == '\0' || 
!session_dictionary_name)
 Py_RETURN_NONE;
 
-
 PyErr_Cleaner py_err_cleaner(true);
 
 auto dict = 
PythonModule::MainModule().ResolveName(session_dictionary_name);

diff  --git a/lldb/include/lldb/Interpreter/ScriptedInterface.h 
b/lldb/include/lldb/Interpreter/ScriptedInterface.h
new file mode 100644
index 0..7cd0c6a1a7772
--- /dev/null
+++ b/lldb/include/lldb/Interpreter/ScriptedInterface.h
@@ -0,0 +1,32 @@
+//===-- ScriptedInterface.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_INTERPRETER_SCRIPTEDINTERFACE_H
+#define LLDB_INTERPRETER_SCRIPTEDINTERFACE_H
+
+#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/lldb-private.h"
+
+#include 
+
+namespace lldb_private {
+class ScriptedInterface {
+public:
+  ScriptedInterface() = default;
+  virtual ~ScriptedInterface() = default;
+
+  virtual StructuredData::GenericSP
+  CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
+ StructuredData::DictionarySP args_sp) = 0;
+
+protected:
+  StructuredData::GenericSP m_object_instance_sp;
+};
+} // namespace lldb_private
+#endif // LLDB_INTERPRETER_SCRIPTEDINTERFACE_H

diff  --git a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h 
b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
index 223e89be87ee6..9682ba76383b7 100644
--- a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
+++ b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
@@ -11,20 +11,18 @@
 
 #include "lldb/Core/StructuredDataImpl.h"
 #include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Interpreter/ScriptedInterface.h"
+
 #include "lldb/lldb-private.h"
 
 #include 
 
 namespace lldb_private {
-class ScriptedProcessInterface {
+class ScriptedProcessInterface : virtual public ScriptedInterface {
 public:
-  ScriptedProcessInterface() : m_object_instance_sp(nullptr) {}
-
-  virtual ~ScriptedProcessInterface() = default;
-
-  virtual StructuredData::GenericSP
-  CreatePluginObject(const llvm::StringRef class_name, lldb::TargetSP 
target_sp,
- StructuredData::DictionarySP args_sp) {
+  StructuredData::GenericSP
+  CreatePluginObject(llvm::StringRef class_name, Exec

[Lldb-commits] [PATCH] D107521: [lldb/Plugins] Introduce Scripted Interface Factory

2021-09-03 Thread Med Ismail Bennani 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 rG3925204c1f58: [lldb/Plugins] Introduce Scripted Interface 
Factory (authored by mib).

Changed prior to commit:
  https://reviews.llvm.org/D107521?vs=370258&id=370625#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107521

Files:
  lldb/bindings/python/python-wrapper.swig
  lldb/include/lldb/Interpreter/ScriptedInterface.h
  lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
  
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -12,7 +12,7 @@
 
 #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
 #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h"
-#include "lldb/API/SBError.h"
+
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
@@ -0,0 +1,155 @@
+//===-- ScriptedPythonInterface.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_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTEDPYTHONINTERFACE_H
+#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTEDPYTHONINTERFACE_H
+
+#include "lldb/Host/Config.h"
+
+#if LLDB_ENABLE_PYTHON
+
+#include "lldb/Interpreter/ScriptedInterface.h"
+#include "lldb/Utility/DataBufferHeap.h"
+
+#include "PythonDataObjects.h"
+#include "SWIGPythonBridge.h"
+#include "ScriptInterpreterPythonImpl.h"
+
+namespace lldb_private {
+class ScriptInterpreterPythonImpl;
+class ScriptedPythonInterface : virtual public ScriptedInterface {
+public:
+  ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter);
+  virtual ~ScriptedPythonInterface() = default;
+
+protected:
+  template 
+  T ExtractValueFromPythonObject(python::PythonObject &p, Status &error) {
+return p.CreateStructuredObject();
+  }
+
+  template <>
+  Status ExtractValueFromPythonObject(python::PythonObject &p,
+  Status &error) {
+if (lldb::SBError *sb_error = reinterpret_cast(
+LLDBSWIGPython_CastPyObjectToSBError(p.get(
+  error = m_interpreter.GetStatusFromSBError(*sb_error);
+else
+  error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
+
+return error;
+  }
+
+  template <>
+  lldb::DataExtractorSP
+  ExtractValueFromPythonObject(python::PythonObject &p,
+  Status &error) {
+lldb::SBData *sb_data = reinterpret_cast(
+LLDBSWIGPython_CastPyObjectToSBData(p.get()));
+
+if (!sb_data) {
+  error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
+  return nullptr;
+}
+
+return m_interpreter.GetDataExtractorFromSBData(*sb_data);
+  }
+
+  template 
+  T Dispatch(llvm::StringRef method_name, Status &error, Args... args) {
+using namespace python;
+using Locker = ScriptInterpreterPythonImpl::Locker;
+
+auto error_with_message = [&method_name, &error](llvm::StringRef message) {
+  error.SetErrorStringWithFormatv(
+  "ScriptedPythonInterface::{0} ({1}) ERROR = {2}", __FUNCTION__,
+  method_name, message);
+  return T();
+};
+
+if (!m_object_instance_sp)
+  return error_with_message("Python object ill-formed");
+
+Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN,
+   Locker::FreeLock);
+
+PythonObject implementor(PyRefType::Borrowed,
+ (PyObject *)m_object_instance_sp->GetValue());
+
+if (!implementor.IsAllocated())
+  return error_with_message("Python implementor not allocated.");
+
+PythonObject pmeth(
+Py

[Lldb-commits] [PATCH] D109249: [lldb] Add Getdescription function for SBInstruction.

2021-09-03 Thread Rumeet Dhindsa via Phabricator via lldb-commits
rdhindsa created this revision.
rdhindsa added reviewers: labath, clayborg.
rdhindsa requested review of this revision.
Herald added a project: LLDB.

Add another Getdescription function for SBInstruction.

When trying to print the instruction, existing GetDescription function doesn't 
have access to Execution Context. Hence, it prints instructions of the 
following form for the added test case:
libc.so.6[0x3bce1]: movq   0x108(%rsp), %rax

When a target is passed with this new API call, it is able to extract execution 
context and hence it prints in the following form:
0x77af6ce1:movq   0x108(%rsp), %rax


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109249

Files:
  lldb/bindings/interface/SBInstruction.i
  lldb/include/lldb/API/SBInstruction.h
  lldb/source/API/SBInstruction.cpp
  lldb/test/API/functionalities/disassemble/Makefile
  lldb/test/API/functionalities/disassemble/TestDisassemble.py
  lldb/test/API/functionalities/disassemble/main.cpp

Index: lldb/test/API/functionalities/disassemble/main.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/disassemble/main.cpp
@@ -0,0 +1,6 @@
+#include 
+int main() {
+  // Break here
+  raise(SIGSEGV);
+  return 0;
+}
Index: lldb/test/API/functionalities/disassemble/TestDisassemble.py
===
--- /dev/null
+++ lldb/test/API/functionalities/disassemble/TestDisassemble.py
@@ -0,0 +1,26 @@
+"""
+Test that description for instruction can print address if target is provided.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestDisassembledInstructionPrint(TestBase):
+  mydir = TestBase.compute_mydir(__file__)
+
+  def test(self):
+
+self.build()
+exe = self.getBuildArtifact("a.out")
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+self.runCmd("run", RUN_SUCCEEDED)
+
+thread = target.GetProcess().GetSelectedThread()
+instructions = target.ReadInstructions(thread.GetFrameAtIndex(0).GetPCAddress(),1)
+instr = instructions.GetInstructionAtIndex(0)
+strm_instr = lldb.SBStream()
+instr.GetDescription(strm_instr, target)
+disasm_instr = strm_instr.GetData()
+self.assertTrue(disasm_instr.startswith("0x"))
Index: lldb/test/API/functionalities/disassemble/Makefile
===
--- /dev/null
+++ lldb/test/API/functionalities/disassemble/Makefile
@@ -0,0 +1,2 @@
+CXX_SOURCES := main.cpp
+include Makefile.rules
Index: lldb/source/API/SBInstruction.cpp
===
--- lldb/source/API/SBInstruction.cpp
+++ lldb/source/API/SBInstruction.cpp
@@ -256,6 +256,33 @@
   return false;
 }
 
+bool SBInstruction::GetDescription(lldb::SBStream &s, SBTarget target) {
+  LLDB_RECORD_METHOD(bool, SBInstruction, GetDescription,
+ (lldb::SBStream &, lldb::SBTarget), s, target);
+
+  lldb::InstructionSP inst_sp(GetOpaque());
+  if (inst_sp) {
+ExecutionContext exe_ctx;
+TargetSP target_sp(target.GetSP());
+std::unique_lock lock;
+if (target_sp) {
+  lock = std::unique_lock(target_sp->GetAPIMutex());
+  target_sp->CalculateExecutionContext(exe_ctx);
+}
+SymbolContext sc;
+const Address &addr = inst_sp->GetAddress();
+ModuleSP module_sp(addr.GetModule());
+if (module_sp)
+  module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything,
+sc);
+FormatEntity::Entry format;
+FormatEntity::Parse("${addr}:", format);
+inst_sp->Dump(&s.ref(), 0, true, false, &exe_ctx, &sc, nullptr, &format, 0);
+return true;
+  }
+  return false;
+}
+
 void SBInstruction::Print(FILE *outp) {
   LLDB_RECORD_METHOD(void, SBInstruction, Print, (FILE *), outp);
   FileSP out = std::make_shared(outp, /*take_ownership=*/false);
Index: lldb/include/lldb/API/SBInstruction.h
===
--- lldb/include/lldb/API/SBInstruction.h
+++ lldb/include/lldb/API/SBInstruction.h
@@ -61,6 +61,8 @@
 
   bool GetDescription(lldb::SBStream &description);
 
+  bool GetDescription(lldb::SBStream &s, lldb::SBTarget target);
+
   bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
 
   bool DumpEmulation(const char *triple); // triple is to specify the
Index: lldb/bindings/interface/SBInstruction.i
===
--- lldb/bindings/interface/SBInstruction.i
+++ lldb/bindings/interface/SBInstruction.i
@@ -68,6 +68,9 @@
 bool
 GetDescription (lldb::SBStream &description);
 
+bool
+GetDescription (lldb::SBStream &description, lldb::SBTarget target);
+
 bool
 EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options);
 
_

[Lldb-commits] [PATCH] D109249: [lldb] Add Getdescription function for SBInstruction.

2021-09-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/API/SBInstruction.cpp:260
+bool SBInstruction::GetDescription(lldb::SBStream &s, SBTarget target) {
+  LLDB_RECORD_METHOD(bool, SBInstruction, GetDescription,
+ (lldb::SBStream &, lldb::SBTarget), s, target);

In addition to the `LLDB_RECORD_METHOD`, you also need the corresponding 
`LLDB_REGISTER_METHOD` macro. If you remove the macro, `lldb-instr` can 
generate both for you if you pass it the cpp file. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109249

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


[Lldb-commits] [PATCH] D109249: [lldb] Add Getdescription function for SBInstruction.

2021-09-03 Thread Rumeet Dhindsa via Phabricator via lldb-commits
rdhindsa updated this revision to Diff 370660.
rdhindsa marked an inline comment as done.
rdhindsa added a comment.

Added LLDB_REGISTER_METHOD for GetDescription.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109249

Files:
  lldb/bindings/interface/SBInstruction.i
  lldb/include/lldb/API/SBInstruction.h
  lldb/source/API/SBInstruction.cpp
  lldb/test/API/functionalities/disassemble/Makefile
  lldb/test/API/functionalities/disassemble/TestDisassemble.py
  lldb/test/API/functionalities/disassemble/main.cpp

Index: lldb/test/API/functionalities/disassemble/main.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/disassemble/main.cpp
@@ -0,0 +1,6 @@
+#include 
+int main() {
+  // Break here
+  raise(SIGSEGV);
+  return 0;
+}
Index: lldb/test/API/functionalities/disassemble/TestDisassemble.py
===
--- /dev/null
+++ lldb/test/API/functionalities/disassemble/TestDisassemble.py
@@ -0,0 +1,26 @@
+"""
+Test that description for instruction can print address if target is provided.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestDisassembledInstructionPrint(TestBase):
+  mydir = TestBase.compute_mydir(__file__)
+
+  def test(self):
+
+self.build()
+exe = self.getBuildArtifact("a.out")
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+self.runCmd("run", RUN_SUCCEEDED)
+
+thread = target.GetProcess().GetSelectedThread()
+instructions = target.ReadInstructions(thread.GetFrameAtIndex(0).GetPCAddress(),1)
+instr = instructions.GetInstructionAtIndex(0)
+strm_instr = lldb.SBStream()
+instr.GetDescription(strm_instr, target)
+disasm_instr = strm_instr.GetData()
+self.assertTrue(disasm_instr.startswith("0x"))
Index: lldb/test/API/functionalities/disassemble/Makefile
===
--- /dev/null
+++ lldb/test/API/functionalities/disassemble/Makefile
@@ -0,0 +1,2 @@
+CXX_SOURCES := main.cpp
+include Makefile.rules
Index: lldb/source/API/SBInstruction.cpp
===
--- lldb/source/API/SBInstruction.cpp
+++ lldb/source/API/SBInstruction.cpp
@@ -256,6 +256,33 @@
   return false;
 }
 
+bool SBInstruction::GetDescription(lldb::SBStream &s, SBTarget target) {
+  LLDB_RECORD_METHOD(bool, SBInstruction, GetDescription,
+ (lldb::SBStream &, lldb::SBTarget), s, target);
+
+  lldb::InstructionSP inst_sp(GetOpaque());
+  if (inst_sp) {
+ExecutionContext exe_ctx;
+TargetSP target_sp(target.GetSP());
+std::unique_lock lock;
+if (target_sp) {
+  lock = std::unique_lock(target_sp->GetAPIMutex());
+  target_sp->CalculateExecutionContext(exe_ctx);
+}
+SymbolContext sc;
+const Address &addr = inst_sp->GetAddress();
+ModuleSP module_sp(addr.GetModule());
+if (module_sp)
+  module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything,
+sc);
+FormatEntity::Entry format;
+FormatEntity::Parse("${addr}:", format);
+inst_sp->Dump(&s.ref(), 0, true, false, &exe_ctx, &sc, nullptr, &format, 0);
+return true;
+  }
+  return false;
+}
+
 void SBInstruction::Print(FILE *outp) {
   LLDB_RECORD_METHOD(void, SBInstruction, Print, (FILE *), outp);
   FileSP out = std::make_shared(outp, /*take_ownership=*/false);
@@ -369,6 +396,8 @@
   LLDB_REGISTER_METHOD(bool, SBInstruction, CanSetBreakpoint, ());
   LLDB_REGISTER_METHOD(bool, SBInstruction, GetDescription,
(lldb::SBStream &));
+  LLDB_REGISTER_METHOD(bool, SBInstruction, GetDescription,
+   (lldb::SBStream &, lldb::SBTarget));
   LLDB_REGISTER_METHOD(void, SBInstruction, Print, (FILE *));
   LLDB_REGISTER_METHOD(void, SBInstruction, Print, (SBFile));
   LLDB_REGISTER_METHOD(void, SBInstruction, Print, (FileSP));
Index: lldb/include/lldb/API/SBInstruction.h
===
--- lldb/include/lldb/API/SBInstruction.h
+++ lldb/include/lldb/API/SBInstruction.h
@@ -61,6 +61,8 @@
 
   bool GetDescription(lldb::SBStream &description);
 
+  bool GetDescription(lldb::SBStream &s, lldb::SBTarget target);
+
   bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
 
   bool DumpEmulation(const char *triple); // triple is to specify the
Index: lldb/bindings/interface/SBInstruction.i
===
--- lldb/bindings/interface/SBInstruction.i
+++ lldb/bindings/interface/SBInstruction.i
@@ -68,6 +68,9 @@
 bool
 GetDescription (lldb::SBStream &description);
 
+bool
+GetDescription (lldb::SBStream &description, lldb::SBTarge

[Lldb-commits] [PATCH] D107521: [lldb/Plugins] Introduce Scripted Interface Factory

2021-09-03 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

It broke Fedora 34 x86_64 buildbot (using gcc) lldb-x86_64-fedora = 
https://lab.llvm.org/staging/#/builders/16
https://lab.llvm.org/staging/#/builders/16/builds/10450


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107521

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


[Lldb-commits] [lldb] 05cdd29 - [lldb] Adjust parse_frames for unnamed images

2021-09-03 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-09-03T13:23:24-07:00
New Revision: 05cdd294ab020b42329413ae7ab52d0c5aaf8151

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

LOG: [lldb] Adjust parse_frames for unnamed images

Follow up to 2cbd3b04feaaaff7fab4c6500476839a23180886 which added
support for unnamed images but missed the use case in parse_frames.

Added: 


Modified: 
lldb/examples/python/crashlog.py

Removed: 




diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index a7b2d3b52b562..79b290ceba8a2 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -473,7 +473,8 @@ def parse_frames(self, thread, json_frames):
 idx = 0
 for json_frame in json_frames:
 image_id = int(json_frame['imageIndex'])
-ident = self.get_used_image(image_id)['name']
+json_image = self.get_used_image(image_id)
+ident = json_image['name'] if 'name' in json_image else ''
 thread.add_ident(ident)
 if ident not in self.crashlog.idents:
 self.crashlog.idents.append(ident)



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


[Lldb-commits] [PATCH] D107521: [lldb/Plugins] Introduce Scripted Interface Factory

2021-09-03 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D107521#2983069 , @jankratochvil 
wrote:

> It broke Fedora 34 x86_64 buildbot (using gcc) lldb-x86_64-fedora = 
> https://lab.llvm.org/staging/#/builders/16 - the build fails:
> https://lab.llvm.org/staging/#/builders/16/builds/10450

Looking! I'll try to send a quick fix ASAP!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107521

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


[Lldb-commits] [PATCH] D107521: [lldb/Plugins] Introduce Scripted Interface Factory

2021-09-03 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

I have a fix. I'm testing it locally before landing it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107521

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


[Lldb-commits] [lldb] 5f6f33d - [lldb/Plugins] Move member template specialization out of class

2021-09-03 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2021-09-03T22:18:55Z
New Revision: 5f6f33da9ee6cbaef5f10b4a7be34a91d5185b2b

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

LOG: [lldb/Plugins] Move member template specialization out of class

This patch should fix the build failure that surfaced when build llvm
with GCC: https://lab.llvm.org/staging/#/builders/16/builds/10450

GCC complained that I explicitely specialized
 `ScriptedPythonInterface::ExtractValueFromPythonObject` in a
in non-namespace scope, which is tolerated by Clang.

To solve this issue, the specialization were declared out of the class
and implemented in the source file.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h

Removed: 




diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
index 097cbbdb6fc7e..a38cb104c0c63 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
@@ -35,4 +35,31 @@ ScriptedPythonInterface::GetStatusFromMethod(llvm::StringRef 
method_name) {
   return error;
 }
 
+template <>
+Status ScriptedPythonInterface::ExtractValueFromPythonObject(
+python::PythonObject &p, Status &error) {
+  if (lldb::SBError *sb_error = reinterpret_cast(
+  LLDBSWIGPython_CastPyObjectToSBError(p.get(
+error = m_interpreter.GetStatusFromSBError(*sb_error);
+  else
+error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
+
+  return error;
+}
+
+template <>
+lldb::DataExtractorSP
+ScriptedPythonInterface::ExtractValueFromPythonObject(
+python::PythonObject &p, Status &error) {
+  lldb::SBData *sb_data = reinterpret_cast(
+  LLDBSWIGPython_CastPyObjectToSBData(p.get()));
+
+  if (!sb_data) {
+error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
+return nullptr;
+  }
+
+  return m_interpreter.GetDataExtractorFromSBData(*sb_data);
+}
+
 #endif

diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
index 85ec167e1463f..bac4efbe76d8d 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
@@ -33,33 +33,6 @@ class ScriptedPythonInterface : virtual public 
ScriptedInterface {
 return p.CreateStructuredObject();
   }
 
-  template <>
-  Status ExtractValueFromPythonObject(python::PythonObject &p,
-  Status &error) {
-if (lldb::SBError *sb_error = reinterpret_cast(
-LLDBSWIGPython_CastPyObjectToSBError(p.get(
-  error = m_interpreter.GetStatusFromSBError(*sb_error);
-else
-  error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
-
-return error;
-  }
-
-  template <>
-  lldb::DataExtractorSP
-  ExtractValueFromPythonObject(python::PythonObject &p,
-  Status &error) {
-lldb::SBData *sb_data = reinterpret_cast(
-LLDBSWIGPython_CastPyObjectToSBData(p.get()));
-
-if (!sb_data) {
-  error.SetErrorString("Couldn't cast lldb::SBError to lldb::Status.");
-  return nullptr;
-}
-
-return m_interpreter.GetDataExtractorFromSBData(*sb_data);
-  }
-
   template 
   T Dispatch(llvm::StringRef method_name, Status &error, Args... args) {
 using namespace python;
@@ -149,6 +122,16 @@ class ScriptedPythonInterface : virtual public 
ScriptedInterface {
   // The lifetime is managed by the ScriptInterpreter
   ScriptInterpreterPythonImpl &m_interpreter;
 };
+
+template <>
+Status ScriptedPythonInterface::ExtractValueFromPythonObject(
+python::PythonObject &p, Status &error);
+
+template <>
+lldb::DataExtractorSP
+ScriptedPythonInterface::ExtractValueFromPythonObject(
+python::PythonObject &p, Status &error);
+
 } // namespace lldb_private
 
 #endif // LLDB_ENABLE_PYTHON



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


[Lldb-commits] [PATCH] D107521: [lldb/Plugins] Introduce Scripted Interface Factory

2021-09-03 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D107521#2983109 , @mib wrote:

> In D107521#2983069 , @jankratochvil 
> wrote:
>
>> It broke Fedora 34 x86_64 buildbot (using gcc) lldb-x86_64-fedora = 
>> https://lab.llvm.org/staging/#/builders/16 - the build fails:
>> https://lab.llvm.org/staging/#/builders/16/builds/10450
>
> Looking! I'll try to send a quick fix ASAP!

This should get fixed with rG5f6f33da9ee6cbaef5f10b4a7be34a91d5185b2b 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107521

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


[Lldb-commits] [PATCH] D109263: [lldb] Update crashlog.py to accept multiple results from mdfind

2021-09-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, clayborg.
JDevlieghere requested review of this revision.

mdfind can return multiple results, some of which are not even dSYM
bundles, but Xcode archives (`.xcrachive).

Currently, we end up concatenating the paths, which is obviously bogus.
This patch not only fixes that, but now also skips paths that don't have
a Contents/Resources/DWARF subdirectory.

rdar://81270312


https://reviews.llvm.org/D109263

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -293,18 +293,24 @@
 return False
 if not self.resolved_path and not os.path.exists(self.path):
 try:
-dsym = subprocess.check_output(
+mdfind_results = subprocess.check_output(
 ["/usr/bin/mdfind",
- "com_apple_xcode_dsym_uuids == 
%s"%uuid_str]).decode("utf-8")[:-1]
-if dsym and os.path.exists(dsym):
-print(('falling back to binary inside "%s"'%dsym))
-self.symfile = dsym
+ "com_apple_xcode_dsym_uuids == %s" % 
uuid_str]).decode("utf-8").splitlines()
+found_matching_slice = False
+for dsym in mdfind_results:
 dwarf_dir = os.path.join(dsym, 
'Contents/Resources/DWARF')
+if not os.path.exists(dwarf_dir):
+# Not a dSYM bundle, probably an Xcode archive.
+continue
+print('falling back to binary inside "%s"' % dsym)
+self.symfile = dsym
 for filename in os.listdir(dwarf_dir):
-self.path = os.path.join(dwarf_dir, filename)
-if not self.find_matching_slice():
-return False
-break
+   self.path = os.path.join(dwarf_dir, filename)
+   if self.find_matching_slice():
+  found_matching_slice = True
+  break
+if found_matching_slice:
+   break
 except:
 pass
 if (self.resolved_path and os.path.exists(self.resolved_path)) or (


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -293,18 +293,24 @@
 return False
 if not self.resolved_path and not os.path.exists(self.path):
 try:
-dsym = subprocess.check_output(
+mdfind_results = subprocess.check_output(
 ["/usr/bin/mdfind",
- "com_apple_xcode_dsym_uuids == %s"%uuid_str]).decode("utf-8")[:-1]
-if dsym and os.path.exists(dsym):
-print(('falling back to binary inside "%s"'%dsym))
-self.symfile = dsym
+ "com_apple_xcode_dsym_uuids == %s" % uuid_str]).decode("utf-8").splitlines()
+found_matching_slice = False
+for dsym in mdfind_results:
 dwarf_dir = os.path.join(dsym, 'Contents/Resources/DWARF')
+if not os.path.exists(dwarf_dir):
+# Not a dSYM bundle, probably an Xcode archive.
+continue
+print('falling back to binary inside "%s"' % dsym)
+self.symfile = dsym
 for filename in os.listdir(dwarf_dir):
-self.path = os.path.join(dwarf_dir, filename)
-if not self.find_matching_slice():
-return False
-break
+   self.path = os.path.join(dwarf_dir, filename)
+   if self.find_matching_slice():
+  found_matching_slice = True
+  break
+if found_matching_slice:
+   break
 except:
 pass
 if (self.resolved_path and os.path.exists(self.resolved_path)) or (
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D109263: [lldb] Update crashlog.py to accept multiple results from mdfind

2021-09-03 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Thanks, looks good!


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

https://reviews.llvm.org/D109263

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


[Lldb-commits] [PATCH] D108515: [lldb/lua] Force Lua version to be 5.3

2021-09-03 Thread Pedro Tammela via Phabricator via lldb-commits
tammela added inline comments.



Comment at: lldb/cmake/modules/FindLuaAndSwig.cmake:12
   if (SWIG_FOUND)
-find_package(Lua 5.3)
+find_package(Lua 5.3 EXACT REQUIRED)
 if(LUA_FOUND AND SWIG_FOUND)

mstorsjo wrote:
> siger-young wrote:
> > mstorsjo wrote:
> > > This breaks building in setups where SWIG is available, but not Lua. 
> > > Previously this detected Lua and took it into use if both Lua and SWIG 
> > > were available, and if not , proceeded without them.
> > I think removing the "REQUIRED" flags might work. I will revert the broken 
> > commit first.
> Just removing the `REQUIRED` from here seems to fix my build. Or I could just 
> revert the patch to return to discussing how it should be done.
> 
> I'm doing either of them fairly soon in any case, to unbreak my build.
That's look OK


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108515

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