[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 230353.
JDevlieghere added a comment.

Fix description for `one-line-on-crash`


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

https://reviews.llvm.org/D70514

Files:
  lldb/docs/CMakeLists.txt
  lldb/docs/conf.py
  lldb/docs/lldb.1
  lldb/docs/man/lldb.rst
  lldb/tools/driver/Options.td

Index: lldb/tools/driver/Options.td
===
--- lldb/tools/driver/Options.td
+++ lldb/tools/driver/Options.td
@@ -5,6 +5,8 @@
 class R prefixes, string name>
   : Option;
 
+// Please keep this in sync with the man page in docs/man/lldb.rst
+
 // Attaching options.
 def grp_attach : OptionGroup<"attaching">, HelpText<"ATTACHING">;
 
@@ -117,7 +119,7 @@
 
 def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">,
   MetaVarName<"">,
-  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  HelpText<"When in batch mode, tells the debugger to run this one-line lldb command if the target crashes.">,
   Group;
 def: Separate<["-"], "k">,
   Alias,
Index: lldb/docs/man/lldb.rst
===
--- /dev/null
+++ lldb/docs/man/lldb.rst
@@ -0,0 +1,316 @@
+:orphan:
+
+lldb -- The Debugger
+
+
+.. program:: lldb
+
+SYNOPSIS
+
+
+| :program:`lldb` [*options*] *executable*
+
+DESCRIPTION
+---
+
+:program:`lldb` is a fully featured debugger. It is a command line interface to
+the LLDB debugger library.
+
+ATTACHING
+-
+
+.. option:: --attach-name 
+
+ Tells the debugger to attach to a process with the given name.
+
+.. option:: --attach-pid 
+
+ Tells the debugger to attach to a process with the given pid.
+
+.. option:: -n 
+
+ Alias for --attach-name
+
+.. option:: -p 
+
+ Alias for --attach-pid
+
+.. option:: --wait-for
+
+ Tells the debugger to wait for a process with the given pid or name to launch before attaching.
+
+.. option:: -w
+
+ Alias for --wait-for
+
+COMMANDS
+
+
+.. option:: --batch
+
+ Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.
+
+.. option:: -b
+
+ Alias for --batch
+
+.. option:: -K 
+
+ Alias for --source-on-crash
+
+.. option:: -k 
+
+ Alias for --one-line-on-crash
+
+.. option:: --local-lldbinit
+
+ Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.
+
+.. option:: --no-lldbinit
+
+ Do not automatically parse any '.lldbinit' files.
+
+.. option:: --one-line-before-file 
+
+ Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
+
+.. option::  --one-line-on-crash 
+
+ When in batch mode, tells the debugger to run this one-line lldb command if the target crashes.
+
+.. option:: --one-line 
+
+ Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
+
+.. option:: -O 
+
+ Alias for --one-line-before-file
+
+.. option:: -o 
+
+ Alias for --one-line
+
+.. option:: -Q
+
+ Alias for --source-quietly
+
+.. option:: --source-before-file 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
+
+.. option:: --source-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --source-quietly
+
+ Tells the debugger to execute this one-line lldb command before any file has been loaded.
+
+.. option:: --source 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
+
+.. option:: -S 
+
+ Alias for --source-before-file
+
+.. option:: -s 
+
+ Alias for --source
+
+.. option:: -x
+
+ Alias for --no-lldbinit
+
+OPTIONS
+---
+
+.. option:: --arch 
+
+ Tells the debugger to use the specified architecture when starting and running the program.
+
+.. option:: -a 
+
+ Alias for --arch
+
+.. option:: --capture-path 
+
+ Tells the debugger to use the given filename for the reproducer.
+
+.. option:: --capture
+
+ Tells the debugger to capture a reproducer.
+
+.. option:: --core 
+
+ Tells the debugger to use the full path to  as the core file.
+
+.. option:: -c 
+
+ Alias for --core
+
+.. option:: --debug
+
+ Tells the debugger to print out extra information for debugging itself.
+
+.. option:: -d
+
+ Alias for --debug
+
+.. option:: --editor
+
+ Tells the debugger to open source files using the host's "external editor" mechanism.
+
+.. option:: -e
+
+ Alias for --editor
+
+.. option:: --file 
+
+ Tells the debugger to use the file  as the program to be debugged.
+
+.. option:: -f 
+
+ Alias for --file
+
+.. option:: --help
+
+ Prints out the usage information for the LLDB debugger.
+
+.. option:: -h
+
+ Alias for --help
+
+.. option:: --no-use-colors
+
+ Do not use colors.
+
+.. option:: --replay 
+
+ Tells the debugger to replay a 

[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: lldb/docs/man/lldb.rst:80
+ When in batch mode, tells the debugger to source this file of lldb commands 
if the target crashes.
+
+.. option:: --one-line 

This is probably wrong in the lldb help too - copy paste most likely.  But the 
value of -one-line-on-crash is a command not a file...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70514



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


[Lldb-commits] [PATCH] D70517: [lldb][DataFormatters] Support pretty printing std::string when built with -funsigned-char.

2019-11-20 Thread pre-merge checks [bot] via Phabricator via lldb-commits
merge_guards_bot added a comment.

Build result: pass - 60200 tests passed, 0 failed and 732 were skipped.
Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70517



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


[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 230349.
JDevlieghere added a comment.

Update configuration file section.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70514

Files:
  lldb/docs/CMakeLists.txt
  lldb/docs/conf.py
  lldb/docs/lldb.1
  lldb/docs/man/lldb.rst

Index: lldb/docs/man/lldb.rst
===
--- /dev/null
+++ lldb/docs/man/lldb.rst
@@ -0,0 +1,316 @@
+:orphan:
+
+lldb -- The Debugger
+
+
+.. program:: lldb
+
+SYNOPSIS
+
+
+| :program:`lldb` [*options*] *executable*
+
+DESCRIPTION
+---
+
+:program:`lldb` is a fully featured debugger. It is a command line interface to
+the LLDB debugger library.
+
+ATTACHING
+-
+
+.. option:: --attach-name 
+
+ Tells the debugger to attach to a process with the given name.
+
+.. option:: --attach-pid 
+
+ Tells the debugger to attach to a process with the given pid.
+
+.. option:: -n 
+
+ Alias for --attach-name
+
+.. option:: -p 
+
+ Alias for --attach-pid
+
+.. option:: --wait-for
+
+ Tells the debugger to wait for a process with the given pid or name to launch before attaching.
+
+.. option:: -w
+
+ Alias for --wait-for
+
+COMMANDS
+
+
+.. option:: --batch
+
+ Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.
+
+.. option:: -b
+
+ Alias for --batch
+
+.. option:: -K 
+
+ Alias for --source-on-crash
+
+.. option:: -k 
+
+ Alias for --one-line-on-crash
+
+.. option:: --local-lldbinit
+
+ Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.
+
+.. option:: --no-lldbinit
+
+ Do not automatically parse any '.lldbinit' files.
+
+.. option:: --one-line-before-file 
+
+ Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
+
+.. option::  --one-line-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --one-line 
+
+ Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
+
+.. option:: -O 
+
+ Alias for --one-line-before-file
+
+.. option:: -o 
+
+ Alias for --one-line
+
+.. option:: -Q
+
+ Alias for --source-quietly
+
+.. option:: --source-before-file 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
+
+.. option:: --source-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --source-quietly
+
+ Tells the debugger to execute this one-line lldb command before any file has been loaded.
+
+.. option:: --source 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
+
+.. option:: -S 
+
+ Alias for --source-before-file
+
+.. option:: -s 
+
+ Alias for --source
+
+.. option:: -x
+
+ Alias for --no-lldbinit
+
+OPTIONS
+---
+
+.. option:: --arch 
+
+ Tells the debugger to use the specified architecture when starting and running the program.
+
+.. option:: -a 
+
+ Alias for --arch
+
+.. option:: --capture-path 
+
+ Tells the debugger to use the given filename for the reproducer.
+
+.. option:: --capture
+
+ Tells the debugger to capture a reproducer.
+
+.. option:: --core 
+
+ Tells the debugger to use the full path to  as the core file.
+
+.. option:: -c 
+
+ Alias for --core
+
+.. option:: --debug
+
+ Tells the debugger to print out extra information for debugging itself.
+
+.. option:: -d
+
+ Alias for --debug
+
+.. option:: --editor
+
+ Tells the debugger to open source files using the host's "external editor" mechanism.
+
+.. option:: -e
+
+ Alias for --editor
+
+.. option:: --file 
+
+ Tells the debugger to use the file  as the program to be debugged.
+
+.. option:: -f 
+
+ Alias for --file
+
+.. option:: --help
+
+ Prints out the usage information for the LLDB debugger.
+
+.. option:: -h
+
+ Alias for --help
+
+.. option:: --no-use-colors
+
+ Do not use colors.
+
+.. option:: --replay 
+
+ Tells the debugger to replay a reproducer from .
+
+.. option:: --version
+
+ Prints out the current version number of the LLDB debugger.
+
+.. option:: -v
+
+ Alias for --version
+
+.. option:: -X
+
+ Alias for --no-use-color
+
+REPL
+
+
+.. option:: -r=
+
+ Alias for --repl=
+
+.. option:: --repl-language 
+
+ Chooses the language for the REPL.
+
+.. option:: --repl=
+
+ Runs lldb in REPL mode with a stub process with the given flags.
+
+.. option:: -R 
+
+ Alias for --repl-language
+
+SCRIPTING
+-
+
+.. option:: -l 
+
+ Alias for --script-language
+
+.. option:: --python-path
+
+ Prints out the path to the lldb.py file for this version of lldb.
+
+.. option:: -P
+
+ Alias for --python-path
+
+.. option:: --script-language 
+
+ Tells the debugger to use the specified scripting language for 

[Lldb-commits] [PATCH] D70517: [lldb][DataFormatters] Support pretty printing std::string when built with -funsigned-char.

2019-11-20 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
rupprecht added reviewers: labath, JDevlieghere, shafik.
Herald added subscribers: lldb-commits, christof.
Herald added a project: LLDB.

When built w/ `-funsigned-char`, `std::string` becomes equivalent to 
`std::basic_string`, causing these formatters to not match. This 
patch adds overloads for both libstdc++ and libc++ string formatters that 
accepts unsigned char.

Motivated by the following example:

  $ cat pretty_print.cc
  
  template 
  void print_val(T s) {
std::cerr << s << '\n';  // Set a breakpoint here!
  }
  
  int main() {
std::string val = "hello";
print_val(val);
return 0;
  }
  $ clang++ -stdlib=libc++ -funsigned-char -fstandalone-debug -g pretty_print.cc
  $ lldb ./a.out -b -o 'b pretty_print.cc:6' -o r -o 'fr v'
  ...
  (lldb) fr v
  (std::__1::basic_string, 
std::__1::allocator >) s = {
__r_ = {
  std::__1::__compressed_pair_elem, std::__1::allocator 
>::__rep, 0, false> = {
__value_ = {
   = {
__l = (__cap_ = 122511465736202, __size_ = 0, __data_ = 
0x)
__s = {
   = (__size_ = '\n', __lx = '\n')
  __data_ = {
[0] = 'h'
[1] = 'e'
[2] = 'l'
[3] = 'l'
[4] = 'o'
[5] = '\0'
  ...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70517

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -425,6 +425,13 @@
 "std::__[[:alnum:]]+::char_traits, "
 "std::__[[:alnum:]]+::allocator >$"),
 stl_summary_flags, true);
+  AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::LibcxxStringSummaryProviderASCII,
+"std::string summary provider",
+ConstString("^std::__[[:alnum:]]+::basic_string, "
+"std::__[[:alnum:]]+::allocator >$"),
+stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxStringSummaryProviderUTF16,
@@ -723,6 +730,10 @@
   ConstString("std::__cxx11::basic_string, "
   "std::allocator >"),
   cxx11_string_summary_sp);
+  cpp_category_sp->GetTypeSummariesContainer()->Add(
+  ConstString("std::__cxx11::basic_string, "
+  "std::allocator >"),
+  cxx11_string_summary_sp);
 
   // making sure we force-pick the summary for printing wstring (_M_p is a
   // wchar_t*)
Index: lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp
+++ lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/main.cpp
@@ -9,6 +9,7 @@
 std::string empty("");
 std::string q("hello world");
 std::string Q("quite a long std::strin with lots of info inside it");
+std::basic_string uchar(5, 'a');
 S.assign(L"!"); // Set break point at this line.
 return 0;
 }
Index: lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
@@ -59,26 +59,28 @@
 var_empty = self.frame().FindVariable('empty')
 var_q = self.frame().FindVariable('q')
 var_Q = self.frame().FindVariable('Q')
+var_uchar = self.frame().FindVariable('uchar')
 
 # TODO: This is currently broken
-# self.assertTrue(var_wempty.GetSummary() == 'L""', "wempty summary wrong")
-self.assertTrue(
-var_s.GetSummary() == 'L"hello world! מזל טוב!"',
+# self.assertEqual(var_wempty.GetSummary(), 'L""', 

[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: lldb/docs/man/lldb.rst:306
+started) will be read.
+
+SEE ALSO

This isn't quite right.  The actual rule is:

If the lldb library is loaded into an executable called Foo, lldb will first 
look for ~/.lldbinit-Foo, and if that exists will load and otherwise it will 
fall back on ~/.lldbinit.  That goes for any executable.

Also, if we find ~/.lldbinit- we don't read the ~/.lldbinit.

There is special handling for Xcode, because when using Xcode the lldb library 
is actually loaded into a binary called lldb-rpc-server.  So there's a little 
hack where IF the program happens to be lldb-rpc-server, we try .lldbinit-Xcode.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70514



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


[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 230346.
JDevlieghere marked 2 inline comments as done.
JDevlieghere added a comment.

Address Adrian's comments.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70514

Files:
  lldb/docs/CMakeLists.txt
  lldb/docs/conf.py
  lldb/docs/lldb.1
  lldb/docs/man/lldb.rst

Index: lldb/docs/man/lldb.rst
===
--- /dev/null
+++ lldb/docs/man/lldb.rst
@@ -0,0 +1,313 @@
+:orphan:
+
+lldb -- The Debugger
+
+
+.. program:: lldb
+
+SYNOPSIS
+
+
+| :program:`lldb` [*options*] *executable*
+
+DESCRIPTION
+---
+
+:program:`lldb` is a fully featured debugger. It is a command line interface to
+the LLDB debugger library.
+
+ATTACHING
+-
+
+.. option:: --attach-name 
+
+ Tells the debugger to attach to a process with the given name.
+
+.. option:: --attach-pid 
+
+ Tells the debugger to attach to a process with the given pid.
+
+.. option:: -n 
+
+ Alias for --attach-name
+
+.. option:: -p 
+
+ Alias for --attach-pid
+
+.. option:: --wait-for
+
+ Tells the debugger to wait for a process with the given pid or name to launch before attaching.
+
+.. option:: -w
+
+ Alias for --wait-for
+
+COMMANDS
+
+
+.. option:: --batch
+
+ Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.
+
+.. option:: -b
+
+ Alias for --batch
+
+.. option:: -K 
+
+ Alias for --source-on-crash
+
+.. option:: -k 
+
+ Alias for --one-line-on-crash
+
+.. option:: --local-lldbinit
+
+ Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.
+
+.. option:: --no-lldbinit
+
+ Do not automatically parse any '.lldbinit' files.
+
+.. option:: --one-line-before-file 
+
+ Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
+
+.. option::  --one-line-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --one-line 
+
+ Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
+
+.. option:: -O 
+
+ Alias for --one-line-before-file
+
+.. option:: -o 
+
+ Alias for --one-line
+
+.. option:: -Q
+
+ Alias for --source-quietly
+
+.. option:: --source-before-file 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
+
+.. option:: --source-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --source-quietly
+
+ Tells the debugger to execute this one-line lldb command before any file has been loaded.
+
+.. option:: --source 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
+
+.. option:: -S 
+
+ Alias for --source-before-file
+
+.. option:: -s 
+
+ Alias for --source
+
+.. option:: -x
+
+ Alias for --no-lldbinit
+
+OPTIONS
+---
+
+.. option:: --arch 
+
+ Tells the debugger to use the specified architecture when starting and running the program.
+
+.. option:: -a 
+
+ Alias for --arch
+
+.. option:: --capture-path 
+
+ Tells the debugger to use the given filename for the reproducer.
+
+.. option:: --capture
+
+ Tells the debugger to capture a reproducer.
+
+.. option:: --core 
+
+ Tells the debugger to use the full path to  as the core file.
+
+.. option:: -c 
+
+ Alias for --core
+
+.. option:: --debug
+
+ Tells the debugger to print out extra information for debugging itself.
+
+.. option:: -d
+
+ Alias for --debug
+
+.. option:: --editor
+
+ Tells the debugger to open source files using the host's "external editor" mechanism.
+
+.. option:: -e
+
+ Alias for --editor
+
+.. option:: --file 
+
+ Tells the debugger to use the file  as the program to be debugged.
+
+.. option:: -f 
+
+ Alias for --file
+
+.. option:: --help
+
+ Prints out the usage information for the LLDB debugger.
+
+.. option:: -h
+
+ Alias for --help
+
+.. option:: --no-use-colors
+
+ Do not use colors.
+
+.. option:: --replay 
+
+ Tells the debugger to replay a reproducer from .
+
+.. option:: --version
+
+ Prints out the current version number of the LLDB debugger.
+
+.. option:: -v
+
+ Alias for --version
+
+.. option:: -X
+
+ Alias for --no-use-color
+
+REPL
+
+
+.. option:: -r=
+
+ Alias for --repl=
+
+.. option:: --repl-language 
+
+ Chooses the language for the REPL.
+
+.. option:: --repl=
+
+ Runs lldb in REPL mode with a stub process with the given flags.
+
+.. option:: -R 
+
+ Alias for --repl-language
+
+SCRIPTING
+-
+
+.. option:: -l 
+
+ Alias for --script-language
+
+.. option:: --python-path
+
+ Prints out the path to the lldb.py file for this version of lldb.
+
+.. option:: -P
+
+ Alias for --python-path
+
+.. option:: --script-language 
+
+ Tells the debugger to use the 

[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 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.

Very nice!




Comment at: lldb/docs/man/lldb.rst:16
+
+:program:`lldb` is the command line interface for the LLDB debugger library.
+:program:`lldb` can debug C, C++, Objective‐C, and Objective‐C++ programs.

While this is technically correct, as an end-user this makes me wonder if I 
picked the wrong command when I'm looking for the debugger.

How about:

`lldb is a fully featured debugger. It is a command line interface to the LLDB 
debugger library.`



Comment at: lldb/docs/man/lldb.rst:290
+
+FILES
+-

CONFIGURATION FILES ?


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

https://reviews.llvm.org/D70514



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


[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 230341.
JDevlieghere added a comment.

Fix inconsistent newlines.


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

https://reviews.llvm.org/D70514

Files:
  lldb/docs/CMakeLists.txt
  lldb/docs/conf.py
  lldb/docs/lldb.1
  lldb/docs/man/lldb.rst

Index: lldb/docs/man/lldb.rst
===
--- /dev/null
+++ lldb/docs/man/lldb.rst
@@ -0,0 +1,313 @@
+:orphan:
+
+lldb -- The Debugger
+
+
+.. program:: lldb
+
+SYNOPSIS
+
+
+| :program:`lldb` [*options*] *executable*
+
+DESCRIPTION
+---
+
+:program:`lldb` is the command line interface for the LLDB debugger library.
+:program:`lldb` can debug C, C++, Objective‐C, and Objective‐C++ programs.
+
+ATTACHING
+-
+
+.. option:: --attach-name 
+
+ Tells the debugger to attach to a process with the given name.
+
+.. option:: --attach-pid 
+
+ Tells the debugger to attach to a process with the given pid.
+
+.. option:: -n 
+
+ Alias for --attach-name
+
+.. option:: -p 
+
+ Alias for --attach-pid
+
+.. option:: --wait-for
+
+ Tells the debugger to wait for a process with the given pid or name to launch before attaching.
+
+.. option:: -w
+
+ Alias for --wait-for
+
+COMMANDS
+
+
+.. option:: --batch
+
+ Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.
+
+.. option:: -b
+
+ Alias for --batch
+
+.. option:: -K 
+
+ Alias for --source-on-crash
+
+.. option:: -k 
+
+ Alias for --one-line-on-crash
+
+.. option:: --local-lldbinit
+
+ Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.
+
+.. option:: --no-lldbinit
+
+ Do not automatically parse any '.lldbinit' files.
+
+.. option:: --one-line-before-file 
+
+ Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
+
+.. option::  --one-line-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --one-line 
+
+ Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
+
+.. option:: -O 
+
+ Alias for --one-line-before-file
+
+.. option:: -o 
+
+ Alias for --one-line
+
+.. option:: -Q
+
+ Alias for --source-quietly
+
+.. option:: --source-before-file 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
+
+.. option:: --source-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --source-quietly
+
+ Tells the debugger to execute this one-line lldb command before any file has been loaded.
+
+.. option:: --source 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
+
+.. option:: -S 
+
+ Alias for --source-before-file
+
+.. option:: -s 
+
+ Alias for --source
+
+.. option:: -x
+
+ Alias for --no-lldbinit
+
+OPTIONS
+---
+
+.. option:: --arch 
+
+ Tells the debugger to use the specified architecture when starting and running the program.
+
+.. option:: -a 
+
+ Alias for --arch
+
+.. option:: --capture-path 
+
+ Tells the debugger to use the given filename for the reproducer.
+
+.. option:: --capture
+
+ Tells the debugger to capture a reproducer.
+
+.. option:: --core 
+
+ Tells the debugger to use the full path to  as the core file.
+
+.. option:: -c 
+
+ Alias for --core
+
+.. option:: --debug
+
+ Tells the debugger to print out extra information for debugging itself.
+
+.. option:: -d
+
+ Alias for --debug
+
+.. option:: --editor
+
+ Tells the debugger to open source files using the host's "external editor" mechanism.
+
+.. option:: -e
+
+ Alias for --editor
+
+.. option:: --file 
+
+ Tells the debugger to use the file  as the program to be debugged.
+
+.. option:: -f 
+
+ Alias for --file
+
+.. option:: --help
+
+ Prints out the usage information for the LLDB debugger.
+
+.. option:: -h
+
+ Alias for --help
+
+.. option:: --no-use-colors
+
+ Do not use colors.
+
+.. option:: --replay 
+
+ Tells the debugger to replay a reproducer from .
+
+.. option:: --version
+
+ Prints out the current version number of the LLDB debugger.
+
+.. option:: -v
+
+ Alias for --version
+
+.. option:: -X
+
+ Alias for --no-use-color
+
+REPL
+
+
+.. option:: -r=
+
+ Alias for --repl=
+
+.. option:: --repl-language 
+
+ Chooses the language for the REPL.
+
+.. option:: --repl=
+
+ Runs lldb in REPL mode with a stub process with the given flags.
+
+.. option:: -R 
+
+ Alias for --repl-language
+
+SCRIPTING
+-
+
+.. option:: -l 
+
+ Alias for --script-language
+
+.. option:: --python-path
+
+ Prints out the path to the lldb.py file for this version of lldb.
+
+.. option:: -P
+
+ Alias for --python-path
+
+.. option:: --script-language 
+
+ Tells the debugger to use the specified scripting language 

[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, mgorny, aprantl, ted.
Herald added a subscriber: abidh.
Herald added a project: LLDB.
JDevlieghere added a comment.

Here's what the output looks like: https://reviews.llvm.org/P8170

  $ ninja docs-lldb-man
  [1/1] Generating man Sphinx documentation for lldb into 
"/Volumes/Jonas/llvm/build-ra/tools/lldb/docs/man"
  $ nroff -man  /Volumes/Jonas/llvm/build-ra/tools/lldb/docs/man/LLDB.1 | col 
-bx


This patch replaces the existing out-of-date man page for lldb and
replaces it with an RST file from which sphinx generates the actual
troff file. This is similar to how man pages are generated for the rest
of the LLVM utilities.

The man page is generated by building the `docs-lldb-man` target.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D70514

Files:
  lldb/docs/CMakeLists.txt
  lldb/docs/conf.py
  lldb/docs/lldb.1
  lldb/docs/man/lldb.rst

Index: lldb/docs/man/lldb.rst
===
--- /dev/null
+++ lldb/docs/man/lldb.rst
@@ -0,0 +1,309 @@
+:orphan:
+
+lldb -- The Debugger
+
+
+.. program:: lldb
+
+SYNOPSIS
+
+
+| :program:`lldb` [*options*] *executable*
+
+DESCRIPTION
+---
+
+:program:`lldb` is the command line interface for the LLDB debugger library.
+:program:`lldb` can debug C, C++, Objective‐C, and Objective‐C++ programs.
+
+ATTACHING
+-
+
+.. option:: --attach-name 
+
+ Tells the debugger to attach to a process with the given name.
+
+.. option:: --attach-pid 
+
+ Tells the debugger to attach to a process with the given pid.
+
+.. option:: -n 
+
+ Alias for --attach-name
+
+.. option:: -p 
+
+ Alias for --attach-pid
+
+.. option:: --wait-for
+
+ Tells the debugger to wait for a process with the given pid or name to launch before attaching.
+
+.. option:: -w
+
+ Alias for --wait-for
+
+COMMANDS
+
+
+.. option:: --batch
+
+ Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.
+
+.. option:: -b
+
+ Alias for --batch
+
+.. option:: -K 
+
+ Alias for --source-on-crash
+
+.. option:: -k 
+
+ Alias for --one-line-on-crash
+
+.. option:: --local-lldbinit
+
+ Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.
+
+.. option:: --no-lldbinit
+
+ Do not automatically parse any '.lldbinit' files.
+
+.. option:: --one-line-before-file 
+
+ Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
+
+.. option::  --one-line-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --one-line 
+
+ Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
+
+.. option:: -O 
+
+ Alias for --one-line-before-file
+
+.. option:: -o 
+
+ Alias for --one-line
+
+.. option:: -Q
+
+ Alias for --source-quietly
+
+.. option:: --source-before-file 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
+
+.. option:: --source-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --source-quietly
+
+ Tells the debugger to execute this one-line lldb command before any file has been loaded.
+
+.. option:: --source 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
+
+.. option:: -S 
+
+ Alias for --source-before-file
+
+.. option:: -s 
+
+ Alias for --source
+
+.. option:: -x
+
+ Alias for --no-lldbinit
+
+OPTIONS
+---
+
+.. option:: --arch 
+ Tells the debugger to use the specified architecture when starting and running the program.
+.. option:: -a 
+ Alias for --arch
+.. option:: --capture-path 
+
+ Tells the debugger to use the given filename for the reproducer.
+
+.. option:: --capture
+
+ Tells the debugger to capture a reproducer.
+
+.. option:: --core 
+
+ Tells the debugger to use the full path to  as the core file.
+
+.. option:: -c 
+
+ Alias for --core
+
+.. option:: --debug
+
+ Tells the debugger to print out extra information for debugging itself.
+
+.. option:: -d
+
+ Alias for --debug
+
+.. option:: --editor
+
+ Tells the debugger to open source files using the host's "external editor" mechanism.
+
+.. option:: -e
+
+ Alias for --editor
+
+.. option:: --file 
+
+ Tells the debugger to use the file  as the program to be debugged.
+
+.. option:: -f 
+
+ Alias for --file
+
+.. option:: --help
+
+ Prints out the usage information for the LLDB debugger.
+
+.. option:: -h
+
+ Alias for --help
+
+.. option:: --no-use-colors
+
+ Do not use colors.
+
+.. option:: --replay 
+
+ Tells the debugger to replay a reproducer from .
+
+.. option:: --version
+
+ Prints out the current version number of the LLDB debugger.
+
+.. option:: -v
+
+ Alias for --version
+
+.. option:: 

[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Here's what the output looks like: https://reviews.llvm.org/P8170

  $ ninja docs-lldb-man
  [1/1] Generating man Sphinx documentation for lldb into 
"/Volumes/Jonas/llvm/build-ra/tools/lldb/docs/man"
  $ nroff -man  /Volumes/Jonas/llvm/build-ra/tools/lldb/docs/man/LLDB.1 | col 
-bx


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70514



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


[Lldb-commits] [lldb] 25f33d8 - [Reproducer] Limit signals to macro define sin

2019-11-20 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-20T14:28:37-08:00
New Revision: 25f33d8318a39673fea798b24faf68154c03fdc1

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

LOG: [Reproducer] Limit signals to macro define sin 

SIGBUS is not part of the signal macros defined in the header .

Added: 


Modified: 
lldb/source/Commands/CommandObjectReproducer.cpp
lldb/test/Shell/Reproducer/TestCrash.test

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectReproducer.cpp 
b/lldb/source/Commands/CommandObjectReproducer.cpp
index 7f97ba2875cb..2797f3c0a9f0 100644
--- a/lldb/source/Commands/CommandObjectReproducer.cpp
+++ b/lldb/source/Commands/CommandObjectReproducer.cpp
@@ -74,17 +74,11 @@ static constexpr OptionEnumValues ReproducerProviderType() {
 #include "CommandOptions.inc"
 
 enum ReproducerCrashSignal {
-  eReproducerCrashSigbus,
   eReproducerCrashSigill,
   eReproducerCrashSigsegv,
 };
 
 static constexpr OptionEnumValueElement g_reproducer_signaltype[] = {
-{
-eReproducerCrashSigbus,
-"SIGBUS",
-"Bus error",
-},
 {
 eReproducerCrashSigill,
 "SIGILL",
@@ -219,9 +213,6 @@ class CommandObjectReproducerXCrash : public 
CommandObjectParsed {
 case eReproducerCrashSigill:
   std::raise(SIGILL);
   break;
-case eReproducerCrashSigbus:
-  std::raise(SIGBUS);
-  break;
 case eReproducerCrashSigsegv:
   std::raise(SIGSEGV);
   break;

diff  --git a/lldb/test/Shell/Reproducer/TestCrash.test 
b/lldb/test/Shell/Reproducer/TestCrash.test
index 1f26a4ebf03d..cb0c09aad141 100644
--- a/lldb/test/Shell/Reproducer/TestCrash.test
+++ b/lldb/test/Shell/Reproducer/TestCrash.test
@@ -5,7 +5,6 @@
 # RUN: rm -rf %t.repro
 
 # RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s 
SIGSEGV' | FileCheck %s
-# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s 
SIGBUS' | FileCheck %s
 # RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s 
SIGILL' | FileCheck %s
 
 # CHECK: 



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


[Lldb-commits] [PATCH] D70417: Accept g packet responses that don't supply all registers

2019-11-20 Thread Jason Molenda via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf24ed3a05198: Handle the case where the g packet 
doesnt get all regs. lldb would silently… (authored by jasonmolenda).

Changed prior to commit:
  https://reviews.llvm.org/D70417?vs=230129=230334#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70417

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -89,6 +89,9 @@
 RegisterValue ) {
   // Read the register
   if (ReadRegisterBytes(reg_info, m_reg_data)) {
+const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
+if (m_reg_valid[reg] == false)
+  return false;
 const bool partial_data_ok = false;
 Status error(value.SetValueFromData(
 reg_info, m_reg_data, reg_info->byte_offset, partial_data_ok));
@@ -205,6 +208,18 @@
 if (buffer_sp->GetByteSize() >= m_reg_data.GetByteSize()) {
   SetAllRegisterValid(true);
   return true;
+} else if (buffer_sp->GetByteSize() > 0) {
+  const int regcount = m_reg_info.GetNumRegisters();
+  for (int i = 0; i < regcount; i++) {
+struct RegisterInfo *reginfo = m_reg_info.GetRegisterInfoAtIndex(i);
+if (reginfo->byte_offset + reginfo->byte_size 
+   <= buffer_sp->GetByteSize()) {
+  m_reg_valid[i] = true;
+} else {
+  m_reg_valid[i] = false;
+}
+  }
+  return true;
 } else {
   Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_THREAD |
 GDBR_LOG_PACKETS));
Index: lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
@@ -109,7 +109,9 @@
 if packet[0] == "g":
 return self.readRegisters()
 if packet[0] == "G":
-return self.writeRegisters(packet[1:])
+# Gxxx
+# Gxxx;thread:1234;
+return self.writeRegisters(packet[1:].split(';')[0])
 if packet[0] == "p":
 regnum = packet[1:].split(';')[0]
 return self.readRegister(int(regnum, 16))
Index: lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
@@ -0,0 +1,196 @@
+from __future__ import print_function
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+class TestJLink6Armv7RegisterDefinition(GDBRemoteTestBase):
+
+@skipIfXmlSupportMissing
+@skipIfRemote
+def test(self):
+"""
+Test lldb's parsing of SEGGER J-Link v6.54 register
+definition for a Cortex M-4 dev board, and the fact
+that the J-Link only supports g/G for reading/writing
+register AND the J-Link v6.54 doesn't provide anything
+but the general purpose registers."""
+class MyResponder(MockGDBServerResponder):
+
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return """
+
+
+
+
+  arm
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+
+
+
+
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+""", False
+else:
+return None, False
+
+def readRegister(self, regnum):
+return "E01"
+
+# Initial r1 bytes, in little-endian order
+r1_bytes = "0100"
+
+## readRegisters only provides reg values up through xpsr (0x6100)
+

[Lldb-commits] [lldb] f24ed3a - Handle the case where the 'g' packet doesn't get all regs.

2019-11-20 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2019-11-20T14:15:08-08:00
New Revision: f24ed3a05198003ef2c76ead91019561a45d26b5

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

LOG: Handle the case where the 'g' packet doesn't get all regs.
lldb would silently accept a response to the 'g' packet
(read all registers) which was too large; this handles the
case where it is too small.

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



Added: 

lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py

Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
new file mode 100644
index ..f0113fd9908b
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
@@ -0,0 +1,196 @@
+from __future__ import print_function
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+class TestJLink6Armv7RegisterDefinition(GDBRemoteTestBase):
+
+@skipIfXmlSupportMissing
+@skipIfRemote
+def test(self):
+"""
+Test lldb's parsing of SEGGER J-Link v6.54 register
+definition for a Cortex M-4 dev board, and the fact
+that the J-Link only supports g/G for reading/writing
+register AND the J-Link v6.54 doesn't provide anything
+but the general purpose registers."""
+class MyResponder(MockGDBServerResponder):
+
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return """
+
+
+
+
+  arm
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+
+
+
+
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+""", False
+else:
+return None, False
+
+def readRegister(self, regnum):
+return "E01"
+
+# Initial r1 bytes, in little-endian order
+r1_bytes = "0100"
+
+## readRegisters only provides reg values up through xpsr 
(0x6100)
+## it doesn't send up any of the exception registers or floating 
point
+## registers that the above register xml describes.
+def readRegisters(self):
+return "" + self.r1_bytes + 
"0100010001008c080020a8720120a07901208065012041ad0008a0720120692a00089e2600080061"
+
+## the J-Link accepts a register write packet with just the GPRs
+## defined.
+def writeRegisters(self, registers_hex):
+# Check that lldb returns the full 704 hex-byte register 
context, 
+# or the 136 hex-byte general purpose register reg ctx.
+if len(registers_hex) != 704 and len(register_hex) != 136:
+return "E06"
+if 
registers_hex.startswith("443322110100010001008c080020a8720120a07901208065012041ad0008a0720120692a00089e2600080061"):
+self.r1_bytes = "44332211"
+return "OK"
+else:
+return "E07"
+
+def haltReason(self):
+return "S05"
+
+def qfThreadInfo(self):
+return "mdead"
+
+def qC(self):
+return ""
+
+def qSupported(self, client_supported):
+return 
"PacketSize=4000;qXfer:memory-map:read-;QStartNoAckMode+;hwbreak+;qXfer:features:read+"
+
+def QThreadSuffixSupported(self):
+return "OK"
+
+def QListThreadsInStopReply(self):
+return "OK"
+
+self.server.responder = MyResponder()
+if self.TraceOn():
+self.runCmd("log enable gdb-remote packets")
+self.addTearDownHook(
+lambda: self.runCmd("log disable gdb-remote packets"))
+
+self.dbg.SetDefaultArchitecture("armv7em")
+target = 

[Lldb-commits] [lldb] b033745 - [Driver] Fix missing space in lldb --help output.

2019-11-20 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-20T13:49:22-08:00
New Revision: b03374584d6878e1fe06868a1cc03c28cc547e88

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

LOG: [Driver] Fix missing space in lldb --help output.

Added: 


Modified: 
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 9d685f2e35ba..806922bc860f 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -747,7 +747,7 @@ void reproducer_handler(void *) {
 }
 
 static void printHelp(LLDBOptTable , llvm::StringRef tool_name) {
-  std::string usage_str = tool_name.str() + "options";
+  std::string usage_str = tool_name.str() + " [options]";
   table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB", false);
 
   std::string examples = R"___(



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


[Lldb-commits] [lldb] 0ebb780 - [Docs] Fix Sphinx warning (treated as error)

2019-11-20 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-20T13:49:22-08:00
New Revision: 0ebb7803e6ae4919c1c782cafecaec237664efe3

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

LOG: [Docs] Fix Sphinx warning (treated as error)

Fixes "undefined label" warning: if the link has no caption the label
must precede a section header.

Added: 


Modified: 
lldb/docs/index.rst

Removed: 




diff  --git a/lldb/docs/index.rst b/lldb/docs/index.rst
index c765a650adfe..0dbb160c2b31 100644
--- a/lldb/docs/index.rst
+++ b/lldb/docs/index.rst
@@ -20,14 +20,14 @@ All of the code in the LLDB project is available under the
 Using LLDB
 --
 
-For an introduction into the LLDB command language, head over to the
-:ref:`LLDB Tutorial `. For users already familiar with
-GDB there is a cheat sheet listing common tasks and their LLDB
-equivalent in the :ref:`GDB to LLDB command map `.
-
-There are also multiple resources on how to script LLDB using Python
-:ref:`Python Reference ` is a great starting
-point for that.
+For an introduction into the LLDB command language, head over to the `LLDB
+Tutorial `_. For users already 
familiar
+with GDB there is a cheat sheet listing common tasks and their LLDB equivalent
+in the `GDB to LLDB command map `_.
+
+There are also multiple resources on how to script LLDB using Python `Python
+Reference `_ is a great
+starting point for that.
 
 Compiler Integration Benefits
 -



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


[Lldb-commits] [lldb] c8dfe90 - [Reproducer] Generate LLDB reproducer on crash

2019-11-20 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-20T13:14:16-08:00
New Revision: c8dfe907299e16aeb17175cb0896c17043fc7c81

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

LOG: [Reproducer] Generate LLDB reproducer on crash

This patch hooks the reproducer infrastructure with the signal handlers.
When lldb crashes with reproducers capture enabled, it will now generate
the reproducer and print a short message the standard out. This doesn't
affect the pretty stack traces, which are still printed before.

This patch also introduces a new reproducer sub-command that
intentionally raises a given signal to test the reproducer signal
handling.

Currently the signal handler is doing too much work. Instead of copying
over files into the reproducers in the signal handler, we should
re-invoke ourselves with a special command line flag that looks at the
VFS mapping and performs the copy.

This is a NO-OP when reproducers are disabled.

Differential revision: https://reviews.llvm.org/D70474

Added: 
lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
lldb/test/Shell/Reproducer/TestCrash.test

Modified: 
lldb/include/lldb/API/SBReproducer.h
lldb/source/API/SBReproducer.cpp
lldb/source/Commands/CommandObjectReproducer.cpp
lldb/source/Commands/Options.td
lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/include/lldb/API/SBReproducer.h 
b/lldb/include/lldb/API/SBReproducer.h
index 0f1739d0c5bd..93e567607aa8 100644
--- a/lldb/include/lldb/API/SBReproducer.h
+++ b/lldb/include/lldb/API/SBReproducer.h
@@ -21,6 +21,8 @@ class LLDB_API SBReproducer {
   static const char *Capture();
   static const char *Capture(const char *path);
   static const char *Replay(const char *path);
+  static const char *GetPath();
+  static bool Generate();
 };
 
 } // namespace lldb

diff  --git a/lldb/source/API/SBReproducer.cpp 
b/lldb/source/API/SBReproducer.cpp
index 6e11b2c6366f..d50d95ebb547 100644
--- a/lldb/source/API/SBReproducer.cpp
+++ b/lldb/source/API/SBReproducer.cpp
@@ -30,7 +30,7 @@ using namespace lldb_private;
 using namespace lldb_private::repro;
 
 SBRegistry::SBRegistry() {
-  Registry& R = *this;
+  Registry  = *this;
 
   RegisterMethods(R);
   RegisterMethods(R);
@@ -149,6 +149,22 @@ const char *SBReproducer::Replay(const char *path) {
   return nullptr;
 }
 
+bool SBReproducer::Generate() {
+  auto  = Reproducer::Instance();
+  if (auto generator = r.GetGenerator()) {
+generator->Keep();
+return true;
+  }
+  return false;
+}
+
+const char *SBReproducer::GetPath() {
+  static std::string path;
+  auto  = Reproducer::Instance();
+  path = r.GetReproducerPath().GetCString();
+  return path.c_str();
+}
+
 char lldb_private::repro::SBProvider::ID = 0;
 const char *SBProvider::Info::name = "sbapi";
 const char *SBProvider::Info::file = "sbapi.bin";

diff  --git a/lldb/source/Commands/CommandObjectReproducer.cpp 
b/lldb/source/Commands/CommandObjectReproducer.cpp
index a22c704ebd0f..7f97ba2875cb 100644
--- a/lldb/source/Commands/CommandObjectReproducer.cpp
+++ b/lldb/source/Commands/CommandObjectReproducer.cpp
@@ -17,6 +17,8 @@
 #include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionGroupBoolean.h"
 
+#include 
+
 using namespace lldb;
 using namespace llvm;
 using namespace lldb_private;
@@ -71,6 +73,37 @@ static constexpr OptionEnumValues ReproducerProviderType() {
 #define LLDB_OPTIONS_reproducer_dump
 #include "CommandOptions.inc"
 
+enum ReproducerCrashSignal {
+  eReproducerCrashSigbus,
+  eReproducerCrashSigill,
+  eReproducerCrashSigsegv,
+};
+
+static constexpr OptionEnumValueElement g_reproducer_signaltype[] = {
+{
+eReproducerCrashSigbus,
+"SIGBUS",
+"Bus error",
+},
+{
+eReproducerCrashSigill,
+"SIGILL",
+"Illegal instruction",
+},
+{
+eReproducerCrashSigsegv,
+"SIGSEGV",
+"Segmentation fault",
+},
+};
+
+static constexpr OptionEnumValues ReproducerSignalType() {
+  return OptionEnumValues(g_reproducer_signaltype);
+}
+
+#define LLDB_OPTIONS_reproducer_xcrash
+#include "CommandOptions.inc"
+
 class CommandObjectReproducerGenerate : public CommandObjectParsed {
 public:
   CommandObjectReproducerGenerate(CommandInterpreter )
@@ -117,12 +150,98 @@ class CommandObjectReproducerGenerate : public 
CommandObjectParsed {
   }
 };
 
+class CommandObjectReproducerXCrash : public CommandObjectParsed {
+public:
+  CommandObjectReproducerXCrash(CommandInterpreter )
+  : CommandObjectParsed(interpreter, "reproducer xcrash",
+"Intentionally force  the debugger to crash in "
+"order to trigger and test reproducer generation.",
+ 

[Lldb-commits] [PATCH] D70474: [Reproducer] Generate LLDB reproducer on crash

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc8dfe907299e: [Reproducer] Generate LLDB reproducer on crash 
(authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70474

Files:
  lldb/include/lldb/API/SBReproducer.h
  lldb/source/API/SBReproducer.cpp
  lldb/source/Commands/CommandObjectReproducer.cpp
  lldb/source/Commands/Options.td
  lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
  lldb/test/Shell/Reproducer/TestCrash.test
  lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -732,6 +732,20 @@
   signal(signo, sigcont_handler);
 }
 
+void reproducer_handler(void *) {
+  if (SBReproducer::Generate()) {
+llvm::outs() << "\n";
+llvm::outs() << "Crash reproducer for ";
+llvm::outs() << lldb::SBDebugger::GetVersionString() << '\n';
+llvm::outs() << "Reproducer written to '" << SBReproducer::GetPath()
+ << "'\n";
+llvm::outs()
+<< "Please have a look at the directory to assess if you're willing to "
+   "share the contained information.\n";
+llvm::outs() << "\n";
+  }
+}
+
 static void printHelp(LLDBOptTable , llvm::StringRef tool_name) {
   std::string usage_str = tool_name.str() + "options";
   table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB", false);
@@ -832,6 +846,9 @@
 return *exit_code;
   }
 
+  // Register the reproducer signal handler.
+  llvm::sys::AddSignalHandler(reproducer_handler, nullptr);
+
   SBError error = SBDebugger::InitializeWithErrorHandling();
   if (error.Fail()) {
 WithColor::error() << "initialization failed: " << error.GetCString()
Index: lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
===
--- lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
+++ lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
@@ -6,11 +6,18 @@
 # process. To ensure we're not actually running the original binary we check
 # that the string "testing" is not printed.
 
-# RUN: rm -rf %t.repro
 # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
+
+# Test reproducer generate command.
+# RUN: rm -rf %t.repro
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
 # RUN: env FOO=BAR %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
 
+# Test crash reproducer.
+# RUN: rm -rf %t.repro
+# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCrashCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
 # CHECK: Breakpoint 1
 # CHECK: Process {{.*}} stopped
 # CHECK: Process {{.*}} launched
Index: lldb/test/Shell/Reproducer/TestCrash.test
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/TestCrash.test
@@ -0,0 +1,14 @@
+# UNSUPPORTED: system-windows
+# This tests that a reproducer is generated when LLDB crashes.
+
+# Start clean.
+# RUN: rm -rf %t.repro
+
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGSEGV' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGBUS' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGILL' | FileCheck %s
+
+# CHECK: 
+# CHECK: Crash reproducer for
+# CHECK: Reproducer written to
+# CHECK: 
Index: lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
@@ -0,0 +1,6 @@
+breakpoint set -f simple.c -l 12
+run
+bt
+cont
+reproducer status
+reproducer xcrash -s SIGSEGV
Index: lldb/source/Commands/Options.td
===
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -438,6 +438,12 @@
 "provided, that reproducer is dumped.">;
 }
 
+let Command = "reproducer xcrash" in {
+  def reproducer_signal : Option<"signal", "s">, Group<1>,
+EnumArg<"None", "ReproducerSignalType()">,
+Required, Desc<"The signal to crash the debugger.">;
+}
+
 let Command = "memory read" in {
   def memory_read_num_per_line : Option<"num-per-line", "l">, Group<1>,
 Arg<"NumberPerLine">, Desc<"The number of items per line to display.">;
Index: lldb/source/Commands/CommandObjectReproducer.cpp

[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-20 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.

LGTM


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [lldb] af331cb - [debugserver] Set arch based on TARGET_TRIPLE

2019-11-20 Thread Vedant Kumar via lldb-commits

Author: Vedant Kumar
Date: 2019-11-20T12:12:47-08:00
New Revision: af331cbe14e8376c696441bb4c26a68be733b884

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

LOG: [debugserver] Set arch based on TARGET_TRIPLE

Use TARGET_TRIPLE instead of LLVM_DEFAULT_TARGET_TRIPLE, as the latter
isn't exported by LLVMConfig.cmake, which means arch detection fails if
lldb is built separately from llvm.

Added: 


Modified: 
lldb/tools/debugserver/source/MacOSX/CMakeLists.txt

Removed: 




diff  --git a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt 
b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
index cf08985ed6f2..73ba6492a0ef 100644
--- a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -1,17 +1,17 @@
 # The debugserver build needs to conditionally include files depending on the
 # target architecture.
 #
-# Switch on the architecture specified by LLVM_DEFAULT_TARGET_TRIPLE, as
+# Switch on the architecture specified by TARGET_TRIPLE, as
 # the llvm and swift build systems use this variable to identify the
-# target (the latter, indirectly, through LLVM_HOST_TRIPLE).
+# target (through LLVM_HOST_TRIPLE).
 #
 # It would be possible to switch on CMAKE_OSX_ARCHITECTURES, but the swift
 # build does not provide it, preferring instead to pass arch-specific
 # CFLAGS etc explicitly. Switching on LLVM_HOST_TRIPLE is also an option,
 # but it breaks down when cross-compiling.
 
-if(LLVM_DEFAULT_TARGET_TRIPLE)
-  string(REGEX MATCH "^[^-]*" LLDB_DEBUGSERVER_ARCH 
${LLVM_DEFAULT_TARGET_TRIPLE})
+if(TARGET_TRIPLE)
+  string(REGEX MATCH "^[^-]*" LLDB_DEBUGSERVER_ARCH ${TARGET_TRIPLE})
 else()
   set(LLDB_DEBUGSERVER_ARCH ${CMAKE_OSX_ARCHITECTURES})
 endif()



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


[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-20 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

  commit 6f4398d1b9950d48ead91b2b550792f2bbe4778e (HEAD -> master, 
origin/master, origin/HEAD)
  Author: Davide Italiano 
  Date:   Wed Nov 20 12:27:26 2019 -0800
  
  [lldb] Fix NSURL data formatter truncation issue
  
  Remove hardcoded string prefix length assumption causing issues when
  concatenating summary for NSURL in NSURLSummaryProvider. Provider relies
  on concatenation of NSStringProvider results for summary, and while the
  strings are prefixed with '@' in Objective-C, that is not the case in
  Swift causing part of the description to be truncated.
  
  This will be tested in the downstream fork.
  
  Patch by Martin Svensson!


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [PATCH] D70474: [Reproducer] Generate LLDB reproducer on crash

2019-11-20 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

This looks good to me.


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

https://reviews.llvm.org/D70474



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


[Lldb-commits] [PATCH] D70458: [NFC] Refactor and improve comments in CommandObjectTarget

2019-11-20 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth updated this revision to Diff 230303.
amccarth marked an inline comment as done.
amccarth added a comment.

Reverted unintended change caught by reviewer.


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

https://reviews.llvm.org/D70458

Files:
  lldb/source/Commands/CommandObjectTarget.cpp


Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -4044,7 +4044,13 @@
   bool AddModuleSymbols(Target *target, ModuleSpec _spec, bool ,
 CommandReturnObject ) {
 const FileSpec _fspec = module_spec.GetSymbolFileSpec();
-if (symbol_fspec) {
+if (!symbol_fspec) {
+  result.AppendError(
+  "one or more executable image paths must be specified");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
 char symfile_path[PATH_MAX];
 symbol_fspec.GetPath(symfile_path, sizeof(symfile_path));
 
@@ -4052,6 +4058,7 @@
   if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
 module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
 }
+
 // We now have a module that represents a symbol file that can be used
 // for a module that might exist in the current target, so we need to
 // find that module in the target
@@ -4112,18 +4119,16 @@
 while (num_matches == 0) {
   ConstString filename_no_extension(
   module_spec.GetFileSpec().GetFileNameStrippingExtension());
-// Empty string returned, lets bail
+  // Empty string returned, let's bail
   if (!filename_no_extension)
 break;
 
-// Check if there was no extension to strip and the basename is the
-// same
+  // Check if there was no extension to strip and the basename is the same
   if (filename_no_extension == module_spec.GetFileSpec().GetFilename())
 break;
 
-// Replace basename with one less extension
+  // Replace basename with one fewer extension
   module_spec.GetFileSpec().GetFilename() = filename_no_extension;
-
   target->GetImages().FindModules(module_spec, matching_module_list);
   num_matches = matching_module_list.GetSize();
 }
@@ -4186,27 +4191,18 @@
 }
 
 namespace fs = llvm::sys::fs;
-  if (module_spec.GetUUID().IsValid()) {
 StreamString ss_symfile_uuid;
+if (module_spec.GetUUID().IsValid()) {
+  ss_symfile_uuid << " (";
   module_spec.GetUUID().Dump(_symfile_uuid);
+  ss_symfile_uuid << ')';
+}
 result.AppendErrorWithFormat(
-"symbol file '%s' (%s) does not match any existing module%s\n",
+"symbol file '%s'%s does not match any existing module%s\n",
 symfile_path, ss_symfile_uuid.GetData(),
 !fs::is_regular_file(symbol_fspec.GetPath())
 ? "\n   please specify the full path to the symbol file"
 : "");
-  } else {
-result.AppendErrorWithFormat(
-"symbol file '%s' does not match any existing module%s\n",
-symfile_path,
-!fs::is_regular_file(symbol_fspec.GetPath())
-? "\n   please specify the full path to the symbol file"
-: "");
-  }
-} else {
-  result.AppendError(
-  "one or more executable image paths must be specified");
-}
 result.SetStatus(eReturnStatusFailed);
 return false;
   }


Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -4044,7 +4044,13 @@
   bool AddModuleSymbols(Target *target, ModuleSpec _spec, bool ,
 CommandReturnObject ) {
 const FileSpec _fspec = module_spec.GetSymbolFileSpec();
-if (symbol_fspec) {
+if (!symbol_fspec) {
+  result.AppendError(
+  "one or more executable image paths must be specified");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
 char symfile_path[PATH_MAX];
 symbol_fspec.GetPath(symfile_path, sizeof(symfile_path));
 
@@ -4052,6 +4058,7 @@
   if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
 module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
 }
+
 // We now have a module that represents a symbol file that can be used
 // for a module that might exist in the current target, so we need to
 // find that module in the target
@@ -4112,18 +4119,16 @@
 while (num_matches == 0) {
   ConstString filename_no_extension(
   module_spec.GetFileSpec().GetFileNameStrippingExtension());
-// Empty string returned, lets bail
+  // Empty string returned, let's bail
   if (!filename_no_extension)
 break;
 
-// Check if there was no 

[Lldb-commits] [PATCH] D70458: [NFC] Refactor and improve comments in CommandObjectTarget

2019-11-20 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth marked 2 inline comments as done.
amccarth added inline comments.



Comment at: lldb/source/Commands/CommandObjectTarget.cpp:4059
   if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
-  module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
+module_spec.GetFileSpec() = symbol_fspec;
 }

labath wrote:
> This does change behavior because previously the symbol file directory wasn't 
> being copied. I think that was intentional because the comment on line 4112 
> says "match up the file by basename" (and it also makes sense because if 
> you're adding symbols in an external file, then the main module file cannot 
> be the exact same path as the symbol file).
Oops.  Thanks for catching that.

ModuleSpec seems weird:  It exposes an internal members to be tweaked in 
arbitrary ways.  I would have expected that it would have to react to certain 
kinds of changes to keep itself consistent.  If it has no invariants to 
enforce, it could have been a plain struct with a bunch of public member 
variables.


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

https://reviews.llvm.org/D70458



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


[Lldb-commits] [PATCH] D70474: [Reproducer] Generate LLDB reproducer on crash

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 230288.
JDevlieghere added a comment.

Update the tests with uppercase signal names


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

https://reviews.llvm.org/D70474

Files:
  lldb/include/lldb/API/SBReproducer.h
  lldb/source/API/SBReproducer.cpp
  lldb/source/Commands/CommandObjectReproducer.cpp
  lldb/source/Commands/Options.td
  lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
  lldb/test/Shell/Reproducer/TestCrash.test
  lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -732,6 +732,20 @@
   signal(signo, sigcont_handler);
 }
 
+void reproducer_handler(void *) {
+  if (SBReproducer::Generate()) {
+llvm::outs() << "\n";
+llvm::outs() << "Crash reproducer for ";
+llvm::outs() << lldb::SBDebugger::GetVersionString() << '\n';
+llvm::outs() << "Reproducer written to '" << SBReproducer::GetPath()
+ << "'\n";
+llvm::outs()
+<< "Please have a look at the directory to assess if you're willing to "
+   "share the contained information.\n";
+llvm::outs() << "\n";
+  }
+}
+
 static void printHelp(LLDBOptTable , llvm::StringRef tool_name) {
   std::string usage_str = tool_name.str() + "options";
   table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB", false);
@@ -832,6 +846,9 @@
 return *exit_code;
   }
 
+  // Register the reproducer signal handler.
+  llvm::sys::AddSignalHandler(reproducer_handler, nullptr);
+
   SBError error = SBDebugger::InitializeWithErrorHandling();
   if (error.Fail()) {
 WithColor::error() << "initialization failed: " << error.GetCString()
Index: lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
===
--- lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
+++ lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
@@ -6,11 +6,18 @@
 # process. To ensure we're not actually running the original binary we check
 # that the string "testing" is not printed.
 
-# RUN: rm -rf %t.repro
 # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
+
+# Test reproducer generate command.
+# RUN: rm -rf %t.repro
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
 # RUN: env FOO=BAR %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
 
+# Test crash reproducer.
+# RUN: rm -rf %t.repro
+# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCrashCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
 # CHECK: Breakpoint 1
 # CHECK: Process {{.*}} stopped
 # CHECK: Process {{.*}} launched
Index: lldb/test/Shell/Reproducer/TestCrash.test
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/TestCrash.test
@@ -0,0 +1,14 @@
+# UNSUPPORTED: system-windows
+# This tests that a reproducer is generated when LLDB crashes.
+
+# Start clean.
+# RUN: rm -rf %t.repro
+
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGSEGV' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGBUS' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s SIGILL' | FileCheck %s
+
+# CHECK: 
+# CHECK: Crash reproducer for
+# CHECK: Reproducer written to
+# CHECK: 
Index: lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
@@ -0,0 +1,6 @@
+breakpoint set -f simple.c -l 12
+run
+bt
+cont
+reproducer status
+reproducer xcrash -s SIGSEGV
Index: lldb/source/Commands/Options.td
===
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -438,6 +438,12 @@
 "provided, that reproducer is dumped.">;
 }
 
+let Command = "reproducer xcrash" in {
+  def reproducer_signal : Option<"signal", "s">, Group<1>,
+EnumArg<"None", "ReproducerSignalType()">,
+Required, Desc<"The signal to crash the debugger.">;
+}
+
 let Command = "memory read" in {
   def memory_read_num_per_line : Option<"num-per-line", "l">, Group<1>,
 Arg<"NumberPerLine">, Desc<"The number of items per line to display.">;
Index: lldb/source/Commands/CommandObjectReproducer.cpp
===
--- lldb/source/Commands/CommandObjectReproducer.cpp
+++ lldb/source/Commands/CommandObjectReproducer.cpp
@@ -17,6 

[Lldb-commits] [PATCH] D70417: Accept g packet responses that don't supply all registers

2019-11-20 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda marked an inline comment as done.
jasonmolenda added a comment.

Thanks for looking this over Pavel.




Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp:215
+struct RegisterInfo *reginfo = 
m_reg_info.GetRegisterInfoAtIndex(i);
+if (reginfo->byte_offset < buffer_sp->GetByteSize()) {
+  m_reg_valid[i] = true;

labath wrote:
> Should this be something like `reginfo->byte_offset+reg_info->byte_size < 
> ...` ?
Yeah, that was my first thought too, then I thought, SURELY we'll have the 
correct # of bytes for complete registers, even if it's less registers than 
expected.  But that's maybe not a great assumption.  I'll change it.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp:215-220
+if (reginfo->byte_offset + reginfo->byte_size 
+   <= buffer_sp->GetByteSize()) {
+  m_reg_valid[i] = true;
+} else {
+  m_reg_valid[i] = false;
+}

labath wrote:
> maybe just `m_reg_valid[i] = reginfo->byte_offset + reginfo->byte_size <= 
> buffer_sp->GetByteSize()`
I think I like the more verbose form, but I don't feel strongly about it.  It 
takes up more screen real estate but I think it's easier to understand at a 
glance - purely a personal opinion.  I'm sure they compile to the same code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70417



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


[Lldb-commits] [PATCH] D70474: [Reproducer] Generate LLDB reproducer on crash

2019-11-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 230286.
JDevlieghere marked 4 inline comments as done.
JDevlieghere added a comment.

Address review feedback.


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

https://reviews.llvm.org/D70474

Files:
  lldb/include/lldb/API/SBReproducer.h
  lldb/source/API/SBReproducer.cpp
  lldb/source/Commands/CommandObjectReproducer.cpp
  lldb/source/Commands/Options.td
  lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
  lldb/test/Shell/Reproducer/TestCrash.test
  lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -732,6 +732,20 @@
   signal(signo, sigcont_handler);
 }
 
+void reproducer_handler(void *) {
+  if (SBReproducer::Generate()) {
+llvm::outs() << "\n";
+llvm::outs() << "Crash reproducer for ";
+llvm::outs() << lldb::SBDebugger::GetVersionString() << '\n';
+llvm::outs() << "Reproducer written to '" << SBReproducer::GetPath()
+ << "'\n";
+llvm::outs()
+<< "Please have a look at the directory to assess if you're willing to "
+   "share the contained information.\n";
+llvm::outs() << "\n";
+  }
+}
+
 static void printHelp(LLDBOptTable , llvm::StringRef tool_name) {
   std::string usage_str = tool_name.str() + "options";
   table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB", false);
@@ -832,6 +846,9 @@
 return *exit_code;
   }
 
+  // Register the reproducer signal handler.
+  llvm::sys::AddSignalHandler(reproducer_handler, nullptr);
+
   SBError error = SBDebugger::InitializeWithErrorHandling();
   if (error.Fail()) {
 WithColor::error() << "initialization failed: " << error.GetCString()
Index: lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
===
--- lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
+++ lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
@@ -6,11 +6,18 @@
 # process. To ensure we're not actually running the original binary we check
 # that the string "testing" is not printed.
 
-# RUN: rm -rf %t.repro
 # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
+
+# Test reproducer generate command.
+# RUN: rm -rf %t.repro
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
 # RUN: env FOO=BAR %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
 
+# Test crash reproducer.
+# RUN: rm -rf %t.repro
+# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCrashCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
 # CHECK: Breakpoint 1
 # CHECK: Process {{.*}} stopped
 # CHECK: Process {{.*}} launched
Index: lldb/test/Shell/Reproducer/TestCrash.test
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/TestCrash.test
@@ -0,0 +1,14 @@
+# UNSUPPORTED: system-windows
+# This tests that a reproducer is generated when LLDB crashes.
+
+# Start clean.
+# RUN: rm -rf %t.repro
+
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s sigsegv' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s sigbus' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s sigill' | FileCheck %s
+
+# CHECK: 
+# CHECK: Crash reproducer for
+# CHECK: Reproducer written to
+# CHECK: 
Index: lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
@@ -0,0 +1,6 @@
+breakpoint set -f simple.c -l 12
+run
+bt
+cont
+reproducer status
+reproducer xcrash -s sigsegv
Index: lldb/source/Commands/Options.td
===
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -438,6 +438,12 @@
 "provided, that reproducer is dumped.">;
 }
 
+let Command = "reproducer xcrash" in {
+  def reproducer_signal : Option<"signal", "s">, Group<1>,
+EnumArg<"None", "ReproducerSignalType()">,
+Required, Desc<"The signal to crash the debugger.">;
+}
+
 let Command = "memory read" in {
   def memory_read_num_per_line : Option<"num-per-line", "l">, Group<1>,
 Arg<"NumberPerLine">, Desc<"The number of items per line to display.">;
Index: lldb/source/Commands/CommandObjectReproducer.cpp
===
--- lldb/source/Commands/CommandObjectReproducer.cpp
+++ 

[Lldb-commits] [PATCH] D70415: Complete complete types early when importing types from Clang module DWARF.

2019-11-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70415



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


[Lldb-commits] [lldb] c502bae - [lldb][NFC] Simplify ClangASTContext::GetBasicTypes

2019-11-20 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-20T12:47:14+01:00
New Revision: c502bae52410c83947e5ad7184dff810083afe75

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

LOG: [lldb][NFC] Simplify ClangASTContext::GetBasicTypes

static convenience methods that do the clang::ASTContext -> ClangASTContext
conversion and handle errors by simply ignoring them are not a good idea.

Added: 


Modified: 
lldb/include/lldb/Symbol/ClangASTContext.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Symbol/ClangASTContext.cpp
lldb/unittests/Symbol/TestClangASTContext.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/ClangASTContext.h 
b/lldb/include/lldb/Symbol/ClangASTContext.h
index e68df0a4868a..c279bdb82c46 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -153,11 +153,7 @@ class ClangASTContext : public TypeSystem {
 
   CompilerType GetBasicType(lldb::BasicType type);
 
-  static CompilerType GetBasicType(clang::ASTContext *ast,
-   lldb::BasicType type);
-
-  static CompilerType GetBasicType(clang::ASTContext *ast,
-   ConstString name);
+  CompilerType GetBasicType(ConstString name);
 
   static lldb::BasicType GetBasicTypeEnumeration(ConstString name);
 

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index bbc03126ea24..f8e448ffcb6f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1724,17 +1724,15 @@ void 
ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext ,
   if (target == nullptr)
 return;
 
-  ASTContext *scratch_ast_context =
-  target->GetScratchClangASTContext()->getASTContext();
-
-  TypeFromUser user_type(
-  ClangASTContext::GetBasicType(scratch_ast_context, eBasicTypeVoid)
-  .GetPointerType()
-  .GetLValueReferenceType());
-  TypeFromParser parser_type(
-  ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid)
-  .GetPointerType()
-  .GetLValueReferenceType());
+  ClangASTContext *scratch_ast_context = target->GetScratchClangASTContext();
+
+  TypeFromUser user_type(scratch_ast_context->GetBasicType(eBasicTypeVoid)
+ .GetPointerType()
+ .GetLValueReferenceType());
+  ClangASTContext *own_context = ClangASTContext::GetASTContext(m_ast_context);
+  TypeFromParser parser_type(own_context->GetBasicType(eBasicTypeVoid)
+ .GetPointerType()
+ .GetLValueReferenceType());
   NamedDecl *var_decl = context.AddVarDecl(parser_type);
 
   std::string decl_name(context.m_decl_name.getAsString());
@@ -2024,8 +2022,9 @@ void 
ClangExpressionDeclMap::AddThisType(NameSearchContext ,
 
   if (copied_clang_type.IsAggregateType() &&
   copied_clang_type.GetCompleteType()) {
-CompilerType void_clang_type =
-ClangASTContext::GetBasicType(m_ast_context, eBasicTypeVoid);
+ClangASTContext *own_context =
+ClangASTContext::GetASTContext(m_ast_context);
+CompilerType void_clang_type = own_context->GetBasicType(eBasicTypeVoid);
 CompilerType void_ptr_clang_type = void_clang_type.GetPointerType();
 
 CompilerType method_type = ClangASTContext::CreateFunctionType(

diff  --git a/lldb/source/Symbol/ClangASTContext.cpp 
b/lldb/source/Symbol/ClangASTContext.cpp
index fbf5bd4cf406..bee72b219b5e 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -987,13 +987,9 @@ ClangASTContext::GetBasicTypeEnumeration(ConstString name) 
{
   return eBasicTypeInvalid;
 }
 
-CompilerType ClangASTContext::GetBasicType(ASTContext *ast,
-   ConstString name) {
-  if (ast) {
-lldb::BasicType basic_type = 
ClangASTContext::GetBasicTypeEnumeration(name);
-return ClangASTContext::GetBasicType(ast, basic_type);
-  }
-  return CompilerType();
+CompilerType ClangASTContext::GetBasicType(ConstString name) {
+  lldb::BasicType basic_type = ClangASTContext::GetBasicTypeEnumeration(name);
+  return GetBasicType(basic_type);
 }
 
 uint32_t ClangASTContext::GetPointerByteSize() {
@@ -1006,13 +1002,8 @@ uint32_t ClangASTContext::GetPointerByteSize() {
 }
 
 CompilerType ClangASTContext::GetBasicType(lldb::BasicType basic_type) {
-  return GetBasicType(getASTContext(), basic_type);
-}
+  clang::ASTContext *ast = getASTContext();
 
-CompilerType ClangASTContext::GetBasicType(ASTContext *ast,
-   

Re: [Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

2019-11-20 Thread Jan Kratochvil via lldb-commits
On Wed, 20 Nov 2019 11:57:46 +0100, Omair Javaid wrote:
> I am running Arm and AArch64 tests on docker containers running Ubuntu
> Xenial.

Could you run it outside of the docker if the problem still happens?

Could you suggests which variant should I try?  There are many:
http://cdimage.ubuntu.com/netboot/16.04/
HWE kernel or not?
generic or generic-lpae?
beagleboard or pandaboard or tegra or wandboard?


> Underlying hardware is Thunder X1 or D05 machines.

I have only Raspberry Pi 3B+, I hope it can run the images above from a flash
drive / MicroSD.


Jan

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


[Lldb-commits] [lldb] 51ad025 - [lldb][NFC] Move searching for $__lldb_objc_class into its own function

2019-11-20 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-20T16:10:24+01:00
New Revision: 51ad025ff313804674b4fb01f56f7b83e3ecc5e3

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

LOG: [lldb][NFC] Move searching for $__lldb_objc_class into its own function

Same as in commit e7cc833ddafdca10be4ef1322ab96ffee774045b but with 
$__lldb_objc_class.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index b95713b44672..7b8456257c62 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -938,178 +938,180 @@ void 
ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext ,
   }
 }
 
-void ClangExpressionDeclMap::FindExternalVisibleDecls(
-NameSearchContext , lldb::ModuleSP module_sp,
-CompilerDeclContext _decl, unsigned int current_id) {
-  assert(m_ast_context);
-
+void ClangExpressionDeclMap::LookUpLldbObjCClass(NameSearchContext ,
+ unsigned int current_id) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  SymbolContextList sc_list;
+  StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
 
-  const ConstString name(context.m_decl_name.getAsString().c_str());
-  if (IgnoreName(name, false))
-return;
+  if (m_ctx_obj) {
+Status status;
+lldb::ValueObjectSP ctx_obj_ptr = m_ctx_obj->AddressOf(status);
+if (!ctx_obj_ptr || status.Fail())
+  return;
 
-  // Only look for functions by name out in our symbols if the function doesn't
-  // start with our phony prefix of '$'
-  Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
-  StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
-  SymbolContext sym_ctx;
-  if (frame != nullptr)
-sym_ctx = frame->GetSymbolContext(lldb::eSymbolContextFunction |
-  lldb::eSymbolContextBlock);
+AddOneType(context, TypeFromUser(m_ctx_obj->GetCompilerType()), 
current_id);
 
-  // Try the persistent decls, which take precedence over all else.
-  if (!namespace_decl)
-SearchPersistenDecls(context, name, current_id);
+m_struct_vars->m_object_pointer_type =
+TypeFromUser(ctx_obj_ptr->GetCompilerType());
 
-  if (name.GetCString()[0] == '$' && !namespace_decl) {
-static ConstString g_lldb_class_name("$__lldb_class");
+return;
+  }
 
-if (name == g_lldb_class_name) {
-  LookUpLldbClass(context, current_id);
-  return;
-}
+  // Clang is looking for the type of "*self"
 
-static ConstString g_lldb_objc_class_name("$__lldb_objc_class");
-if (name == g_lldb_objc_class_name) {
-  if (m_ctx_obj) {
-Status status;
-lldb::ValueObjectSP ctx_obj_ptr = m_ctx_obj->AddressOf(status);
-if (!ctx_obj_ptr || status.Fail())
-  return;
+  if (!frame)
+return;
+
+  SymbolContext sym_ctx = frame->GetSymbolContext(lldb::eSymbolContextFunction 
|
+  lldb::eSymbolContextBlock);
 
-AddOneType(context, TypeFromUser(m_ctx_obj->GetCompilerType()),
-   current_id);
+  // Find the block that defines the function represented by "sym_ctx"
+  Block *function_block = sym_ctx.GetFunctionBlock();
 
-m_struct_vars->m_object_pointer_type =
-TypeFromUser(ctx_obj_ptr->GetCompilerType());
+  if (!function_block)
+return;
 
-return;
-  }
+  CompilerDeclContext function_decl_ctx = function_block->GetDeclContext();
 
-  // Clang is looking for the type of "*self"
+  if (!function_decl_ctx)
+return;
 
-  if (!frame)
-return;
+  clang::ObjCMethodDecl *method_decl =
+  ClangASTContext::DeclContextGetAsObjCMethodDecl(function_decl_ctx);
 
-  SymbolContext sym_ctx = frame->GetSymbolContext(
-  lldb::eSymbolContextFunction | lldb::eSymbolContextBlock);
+  if (method_decl) {
+ObjCInterfaceDecl *self_interface = method_decl->getClassInterface();
 
-  // Find the block that defines the function represented by "sym_ctx"
-  Block *function_block = sym_ctx.GetFunctionBlock();
+if (!self_interface)
+  return;
 
-  if (!function_block)
-return;
+const clang::Type *interface_type = self_interface->getTypeForDecl();
 
-  CompilerDeclContext function_decl_ctx = function_block->GetDeclContext();
+if (!interface_type)
+  return; // This is unlikely, but we have seen crashes where this
+  // occurred

[Lldb-commits] [lldb] 54b86b0 - [lldb][NFC] Remove unused ClangASTContext::GetUnknownAnyType

2019-11-20 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-20T13:07:43+01:00
New Revision: 54b86b010bf52ae3f1c5499e38dc8ea52e17a9f2

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

LOG: [lldb][NFC] Remove unused ClangASTContext::GetUnknownAnyType

Added: 


Modified: 
lldb/include/lldb/Symbol/ClangASTContext.h
lldb/source/Symbol/ClangASTContext.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/ClangASTContext.h 
b/lldb/include/lldb/Symbol/ClangASTContext.h
index c279bdb82c46..f4428c682182 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -163,12 +163,6 @@ class ClangASTContext : public TypeSystem {
 
   CompilerType GetCStringType(bool is_const);
 
-  static CompilerType GetUnknownAnyType(clang::ASTContext *ast);
-
-  CompilerType GetUnknownAnyType() {
-return ClangASTContext::GetUnknownAnyType(getASTContext());
-  }
-
   static clang::DeclContext *GetDeclContextForType(clang::QualType type);
 
   static clang::DeclContext *GetDeclContextForType(const CompilerType );

diff  --git a/lldb/source/Symbol/ClangASTContext.cpp 
b/lldb/source/Symbol/ClangASTContext.cpp
index bee72b219b5e..b35d264ceb9d 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1236,13 +1236,6 @@ CompilerType 
ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize(
   return CompilerType();
 }
 
-CompilerType ClangASTContext::GetUnknownAnyType(clang::ASTContext *ast) {
-  if (ast)
-return CompilerType(ClangASTContext::GetASTContext(ast),
-ast->UnknownAnyTy.getAsOpaquePtr());
-  return CompilerType();
-}
-
 CompilerType ClangASTContext::GetCStringType(bool is_const) {
   ASTContext *ast = getASTContext();
   QualType char_type(ast->CharTy);



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


[Lldb-commits] [lldb] c34478f - [lldb][NFC] Move ClangExpressionDeclMap's persistent decl search into its own function

2019-11-20 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-20T14:17:35+01:00
New Revision: c34478f5f6c7ef1ae8fb3605fbdec0634d543fed

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

LOG: [lldb][NFC] Move ClangExpressionDeclMap's persistent decl search into its 
own function

Searching persistent decls is a small subset of the things
FindExternalVisibleDecls does. It should be its own function instead
of being encapsulated in this `do { } while(false);` pattern.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index f8e448ffcb6f..da106f4f8f44 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -771,19 +771,64 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   ClangASTSource::FindExternalVisibleDecls(context);
 }
 
+void ClangExpressionDeclMap::MaybeRegisterFunctionBody(
+FunctionDecl *copied_function_decl) {
+  if (copied_function_decl->getBody() && m_parser_vars->m_code_gen) {
+clang::DeclGroupRef decl_group_ref(copied_function_decl);
+m_parser_vars->m_code_gen->HandleTopLevelDecl(decl_group_ref);
+  }
+}
+
+void ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext ,
+  const ConstString name,
+  unsigned int current_id) {
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
+  Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
+  if (!target)
+return;
+
+  ClangASTContext *scratch_clang_ast_context =
+  target->GetScratchClangASTContext();
+
+  if (!scratch_clang_ast_context)
+return;
+
+  ASTContext *scratch_ast_context = scratch_clang_ast_context->getASTContext();
+
+  if (!scratch_ast_context)
+return;
+
+  NamedDecl *persistent_decl =
+  m_parser_vars->m_persistent_vars->GetPersistentDecl(name);
+
+  if (!persistent_decl)
+return;
+
+  Decl *parser_persistent_decl = CopyDecl(persistent_decl);
+
+  if (!parser_persistent_decl)
+return;
+
+  NamedDecl *parser_named_decl = dyn_cast(parser_persistent_decl);
+
+  if (!parser_named_decl)
+return;
+
+  if (clang::FunctionDecl *parser_function_decl =
+  llvm::dyn_cast(parser_named_decl)) {
+MaybeRegisterFunctionBody(parser_function_decl);
+  }
+
+  LLDB_LOGF(log, "  CEDM::FEVD[%u] Found persistent decl %s", current_id,
+name.GetCString());
+
+  context.AddNamedDecl(parser_named_decl);
+}
 void ClangExpressionDeclMap::FindExternalVisibleDecls(
 NameSearchContext , lldb::ModuleSP module_sp,
 CompilerDeclContext _decl, unsigned int current_id) {
   assert(m_ast_context);
 
-  std::function MaybeRegisterFunctionBody =
-  [this](clang::FunctionDecl *copied_function_decl) {
-if (copied_function_decl->getBody() && m_parser_vars->m_code_gen) {
-  DeclGroupRef decl_group_ref(copied_function_decl);
-  m_parser_vars->m_code_gen->HandleTopLevelDecl(decl_group_ref);
-}
-  };
-
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
   SymbolContextList sc_list;
@@ -802,51 +847,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   lldb::eSymbolContextBlock);
 
   // Try the persistent decls, which take precedence over all else.
-  if (!namespace_decl) {
-do {
-  if (!target)
-break;
-
-  ClangASTContext *scratch_clang_ast_context =
-  target->GetScratchClangASTContext();
-
-  if (!scratch_clang_ast_context)
-break;
-
-  ASTContext *scratch_ast_context =
-  scratch_clang_ast_context->getASTContext();
-
-  if (!scratch_ast_context)
-break;
-
-  NamedDecl *persistent_decl =
-  m_parser_vars->m_persistent_vars->GetPersistentDecl(name);
-
-  if (!persistent_decl)
-break;
-
-  Decl *parser_persistent_decl = CopyDecl(persistent_decl);
-
-  if (!parser_persistent_decl)
-break;
-
-  NamedDecl *parser_named_decl =
-  dyn_cast(parser_persistent_decl);
-
-  if (!parser_named_decl)
-break;
-
-  if (clang::FunctionDecl *parser_function_decl =
-  llvm::dyn_cast(parser_named_decl)) {
-MaybeRegisterFunctionBody(parser_function_decl);
-  }
-
-  LLDB_LOGF(log, "  CEDM::FEVD[%u] Found persistent decl %s", current_id,
-name.GetCString());
-
-  context.AddNamedDecl(parser_named_decl);
-} 

[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-20 Thread Martin Svensson via Phabricator via lldb-commits
poya updated this revision to Diff 230251.

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

https://reviews.llvm.org/D70393

Files:
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp


Index: lldb/source/Plugins/Language/ObjC/Cocoa.cpp
===
--- lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -694,32 +694,42 @@
   CompilerType type(valobj.GetCompilerType());
   ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, 
true));
   ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, 
true));
-  if (!text)
-return false;
-  if (text->GetValueAsUnsigned(0) == 0)
+  if (!text || text->GetValueAsUnsigned(0) == 0)
 return false;
+
+  StreamString base_summary;
+  if (base && base->GetValueAsUnsigned(0)) {
+if (!NSURLSummaryProvider(*base, base_summary, options))
+  base_summary.Clear();
+  }
+  if (base_summary.Empty())
+return NSStringSummaryProvider(*text, stream, options);
+
   StreamString summary;
-  if (!NSStringSummaryProvider(*text, summary, options))
+  if (!NSStringSummaryProvider(*text, summary, options) || summary.Empty())
 return false;
-  if (base && base->GetValueAsUnsigned(0)) {
-std::string summary_str = summary.GetString();
-
-if (!summary_str.empty())
-  summary_str.pop_back();
-summary_str += " -- ";
-StreamString base_summary;
-if (NSURLSummaryProvider(*base, base_summary, options) &&
-!base_summary.Empty()) {
-  llvm::StringRef base_str = base_summary.GetString();
-  if (base_str.size() > 2)
-base_str = base_str.drop_front(2);
-  summary_str += base_str;
+
+  const char quote_char = '"';
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+if (!language->GetFormatterPrefixSuffix(*text, ConstString("NSString"),
+prefix, suffix)) {
+  prefix.clear();
+  suffix.clear();
 }
-summary.Clear();
-summary.PutCString(summary_str);
   }
-  if (!summary.Empty()) {
-stream.PutCString(summary.GetString());
+  // @"A" -> @"A
+  llvm::StringRef summary_str = summary.GetString();
+  bool back_consumed = summary_str.consume_back(quote_char + suffix);
+  assert(back_consumed); UNUSED_IF_ASSERT_DISABLED(back_consumed);
+  // @"B" -> B"
+  llvm::StringRef base_summary_str = base_summary.GetString();
+  bool front_consumed = base_summary_str.consume_front(prefix + quote_char);
+  assert(front_consumed); UNUSED_IF_ASSERT_DISABLED(front_consumed);
+  // @"A -- B"
+  if (!summary_str.empty() && !base_summary_str.empty()) {
+stream.Printf("%s -- %s", summary_str.str().c_str(),
+  base_summary_str.str().c_str());
 return true;
   }
 


Index: lldb/source/Plugins/Language/ObjC/Cocoa.cpp
===
--- lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -694,32 +694,42 @@
   CompilerType type(valobj.GetCompilerType());
   ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, true));
   ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, true));
-  if (!text)
-return false;
-  if (text->GetValueAsUnsigned(0) == 0)
+  if (!text || text->GetValueAsUnsigned(0) == 0)
 return false;
+
+  StreamString base_summary;
+  if (base && base->GetValueAsUnsigned(0)) {
+if (!NSURLSummaryProvider(*base, base_summary, options))
+  base_summary.Clear();
+  }
+  if (base_summary.Empty())
+return NSStringSummaryProvider(*text, stream, options);
+
   StreamString summary;
-  if (!NSStringSummaryProvider(*text, summary, options))
+  if (!NSStringSummaryProvider(*text, summary, options) || summary.Empty())
 return false;
-  if (base && base->GetValueAsUnsigned(0)) {
-std::string summary_str = summary.GetString();
-
-if (!summary_str.empty())
-  summary_str.pop_back();
-summary_str += " -- ";
-StreamString base_summary;
-if (NSURLSummaryProvider(*base, base_summary, options) &&
-!base_summary.Empty()) {
-  llvm::StringRef base_str = base_summary.GetString();
-  if (base_str.size() > 2)
-base_str = base_str.drop_front(2);
-  summary_str += base_str;
+
+  const char quote_char = '"';
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+if (!language->GetFormatterPrefixSuffix(*text, ConstString("NSString"),
+prefix, suffix)) {
+  prefix.clear();
+  suffix.clear();
 }
-summary.Clear();
-summary.PutCString(summary_str);
   }
-  if (!summary.Empty()) {
-stream.PutCString(summary.GetString());
+  // @"A" -> @"A
+  llvm::StringRef summary_str = summary.GetString();
+  bool back_consumed = summary_str.consume_back(quote_char + suffix);
+  

[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-20 Thread Martin Svensson via Phabricator via lldb-commits
poya updated this revision to Diff 230248.
poya added a comment.

Remove helper function
Hardcode quote character to " with assert to catch future changes


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

https://reviews.llvm.org/D70393

Files:
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp


Index: lldb/source/Plugins/Language/ObjC/Cocoa.cpp
===
--- lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -694,32 +694,42 @@
   CompilerType type(valobj.GetCompilerType());
   ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, 
true));
   ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, 
true));
-  if (!text)
-return false;
-  if (text->GetValueAsUnsigned(0) == 0)
+  if (!text || text->GetValueAsUnsigned(0) == 0)
 return false;
+
+  StreamString base_summary;
+  if (base && base->GetValueAsUnsigned(0)) {
+if (!NSURLSummaryProvider(*base, base_summary, options))
+  base_summary.Clear();
+  }
+  if (base_summary.Empty())
+return NSStringSummaryProvider(*text, stream, options);
+
   StreamString summary;
-  if (!NSStringSummaryProvider(*text, summary, options))
+  if (!NSStringSummaryProvider(*text, summary, options) || summary.Empty())
 return false;
-  if (base && base->GetValueAsUnsigned(0)) {
-std::string summary_str = summary.GetString();
-
-if (!summary_str.empty())
-  summary_str.pop_back();
-summary_str += " -- ";
-StreamString base_summary;
-if (NSURLSummaryProvider(*base, base_summary, options) &&
-!base_summary.Empty()) {
-  llvm::StringRef base_str = base_summary.GetString();
-  if (base_str.size() > 2)
-base_str = base_str.drop_front(2);
-  summary_str += base_str;
+
+  const char quote_char = '"';
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+if (!language->GetFormatterPrefixSuffix(valobj, ConstString("NSString"),
+prefix, suffix)) {
+  prefix.clear();
+  suffix.clear();
 }
-summary.Clear();
-summary.PutCString(summary_str);
   }
-  if (!summary.Empty()) {
-stream.PutCString(summary.GetString());
+  // @"A" -> @"A
+  llvm::StringRef summary_str = summary.GetString();
+  bool back_consumed = summary_str.consume_back(quote_char + suffix);
+  assert(back_consumed); UNUSED_IF_ASSERT_DISABLED(back_consumed);
+  // @"B" -> B"
+  llvm::StringRef base_summary_str = base_summary.GetString();
+  bool front_consumed = base_summary_str.consume_front(prefix + quote_char);
+  assert(front_consumed); UNUSED_IF_ASSERT_DISABLED(front_consumed);
+  // @"A -- B"
+  if (!summary_str.empty() && !base_summary_str.empty()) {
+stream.Printf("%s -- %s", summary_str.str().c_str(),
+  base_summary_str.str().c_str());
 return true;
   }
 


Index: lldb/source/Plugins/Language/ObjC/Cocoa.cpp
===
--- lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -694,32 +694,42 @@
   CompilerType type(valobj.GetCompilerType());
   ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, true));
   ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, true));
-  if (!text)
-return false;
-  if (text->GetValueAsUnsigned(0) == 0)
+  if (!text || text->GetValueAsUnsigned(0) == 0)
 return false;
+
+  StreamString base_summary;
+  if (base && base->GetValueAsUnsigned(0)) {
+if (!NSURLSummaryProvider(*base, base_summary, options))
+  base_summary.Clear();
+  }
+  if (base_summary.Empty())
+return NSStringSummaryProvider(*text, stream, options);
+
   StreamString summary;
-  if (!NSStringSummaryProvider(*text, summary, options))
+  if (!NSStringSummaryProvider(*text, summary, options) || summary.Empty())
 return false;
-  if (base && base->GetValueAsUnsigned(0)) {
-std::string summary_str = summary.GetString();
-
-if (!summary_str.empty())
-  summary_str.pop_back();
-summary_str += " -- ";
-StreamString base_summary;
-if (NSURLSummaryProvider(*base, base_summary, options) &&
-!base_summary.Empty()) {
-  llvm::StringRef base_str = base_summary.GetString();
-  if (base_str.size() > 2)
-base_str = base_str.drop_front(2);
-  summary_str += base_str;
+
+  const char quote_char = '"';
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+if (!language->GetFormatterPrefixSuffix(valobj, ConstString("NSString"),
+prefix, suffix)) {
+  prefix.clear();
+  suffix.clear();
 }
-summary.Clear();
-summary.PutCString(summary_str);
   }
-  if (!summary.Empty()) {
-stream.PutCString(summary.GetString());
+  // @"A" -> @"A
+  llvm::StringRef 

[Lldb-commits] [lldb] 02e9113 - [lldb][NFC] Remove ClangASTContext::FieldIsBitfield overload

2019-11-20 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-20T12:15:25+01:00
New Revision: 02e9113665602ca3a4b987a78db7147a648766d1

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

LOG: [lldb][NFC] Remove ClangASTContext::FieldIsBitfield overload

Added: 


Modified: 
lldb/include/lldb/Symbol/ClangASTContext.h
lldb/source/Symbol/ClangASTContext.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/ClangASTContext.h 
b/lldb/include/lldb/Symbol/ClangASTContext.h
index 53580c08bdde..38047583412e 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -319,9 +319,6 @@ class ClangASTContext : public TypeSystem {
 
   bool FieldIsBitfield(clang::FieldDecl *field, uint32_t _bit_size);
 
-  static bool FieldIsBitfield(clang::ASTContext *ast, clang::FieldDecl *field,
-  uint32_t _bit_size);
-
   static bool RecordHasFields(const clang::RecordDecl *record_decl);
 
   CompilerType CreateObjCClass(const char *name, clang::DeclContext *decl_ctx,

diff  --git a/lldb/source/Symbol/ClangASTContext.cpp 
b/lldb/source/Symbol/ClangASTContext.cpp
index cf1dfeae359e..12b49618366c 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -1703,11 +1703,7 @@ 
ClangASTContext::UnifyAccessSpecifiers(clang::AccessSpecifier lhs,
 
 bool ClangASTContext::FieldIsBitfield(FieldDecl *field,
   uint32_t _bit_size) {
-  return FieldIsBitfield(getASTContext(), field, bitfield_bit_size);
-}
-
-bool ClangASTContext::FieldIsBitfield(ASTContext *ast, FieldDecl *field,
-  uint32_t _bit_size) {
+  ASTContext *ast = getASTContext();
   if (ast == nullptr || field == nullptr)
 return false;
 
@@ -6696,8 +6692,7 @@ CompilerType ClangASTContext::GetChildCompilerTypeAtIndex(
   // Figure out the field offset within the current struct/union/class
   // type
   bit_offset = record_layout.getFieldOffset(field_idx);
-  if (ClangASTContext::FieldIsBitfield(getASTContext(), *field,
-   child_bitfield_bit_size)) {
+  if (FieldIsBitfield(*field, child_bitfield_bit_size)) {
 child_bitfield_bit_offset = bit_offset % child_bit_size;
 const uint32_t child_bit_offset =
 bit_offset - child_bitfield_bit_offset;
@@ -6820,8 +6815,7 @@ CompilerType ClangASTContext::GetChildCompilerTypeAtIndex(
 // offset from, we still need to get the bit offset for
 // bitfields from the layout.
 
-if (ClangASTContext::FieldIsBitfield(getASTContext(), 
ivar_decl,
- child_bitfield_bit_size)) 
{
+if (FieldIsBitfield(ivar_decl, child_bitfield_bit_size)) {
   if (bit_offset == INT32_MAX)
 bit_offset = interface_layout.getFieldOffset(
 child_idx - superclass_idx);
@@ -9119,8 +9113,7 @@ void ClangASTContext::DumpValue(
 field_byte_offset = field_bit_offset / 8;
 uint32_t field_bitfield_bit_size = 0;
 uint32_t field_bitfield_bit_offset = 0;
-if (ClangASTContext::FieldIsBitfield(getASTContext(), *field,
- field_bitfield_bit_size))
+if (FieldIsBitfield(*field, field_bitfield_bit_size))
   field_bitfield_bit_offset = field_bit_offset % 8;
 
 if (show_types) {



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


[Lldb-commits] [lldb] e7cc833 - [lldb][NFC] Move searching for $__lldb_class into its own function in ClangExpressionDeclMap

2019-11-20 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-20T15:12:31+01:00
New Revision: e7cc833ddafdca10be4ef1322ab96ffee774045b

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

LOG: [lldb][NFC] Move searching for $__lldb_class into its own function in 
ClangExpressionDeclMap

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index da106f4f8f44..b95713b44672 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -824,138 +824,151 @@ void 
ClangExpressionDeclMap::SearchPersistenDecls(NameSearchContext ,
 
   context.AddNamedDecl(parser_named_decl);
 }
-void ClangExpressionDeclMap::FindExternalVisibleDecls(
-NameSearchContext , lldb::ModuleSP module_sp,
-CompilerDeclContext _decl, unsigned int current_id) {
-  assert(m_ast_context);
 
+void ClangExpressionDeclMap::LookUpLldbClass(NameSearchContext ,
+ unsigned int current_id) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  SymbolContextList sc_list;
-
-  const ConstString name(context.m_decl_name.getAsString().c_str());
-  if (IgnoreName(name, false))
-return;
-
-  // Only look for functions by name out in our symbols if the function doesn't
-  // start with our phony prefix of '$'
-  Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
   StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
   SymbolContext sym_ctx;
   if (frame != nullptr)
 sym_ctx = frame->GetSymbolContext(lldb::eSymbolContextFunction |
   lldb::eSymbolContextBlock);
 
-  // Try the persistent decls, which take precedence over all else.
-  if (!namespace_decl)
-SearchPersistenDecls(context, name, current_id);
+  if (m_ctx_obj) {
+Status status;
+lldb::ValueObjectSP ctx_obj_ptr = m_ctx_obj->AddressOf(status);
+if (!ctx_obj_ptr || status.Fail())
+  return;
 
-  if (name.GetCString()[0] == '$' && !namespace_decl) {
-static ConstString g_lldb_class_name("$__lldb_class");
+AddThisType(context, TypeFromUser(m_ctx_obj->GetCompilerType()),
+current_id);
 
-if (name == g_lldb_class_name) {
-  if (m_ctx_obj) {
-Status status;
-lldb::ValueObjectSP ctx_obj_ptr = m_ctx_obj->AddressOf(status);
-if (!ctx_obj_ptr || status.Fail())
-  return;
+m_struct_vars->m_object_pointer_type =
+TypeFromUser(ctx_obj_ptr->GetCompilerType());
 
-AddThisType(context, TypeFromUser(m_ctx_obj->GetCompilerType()),
-current_id);
+return;
+  }
 
-m_struct_vars->m_object_pointer_type =
-TypeFromUser(ctx_obj_ptr->GetCompilerType());
+  // Clang is looking for the type of "this"
 
-return;
-  }
+  if (frame == nullptr)
+return;
 
-  // Clang is looking for the type of "this"
+  // Find the block that defines the function represented by "sym_ctx"
+  Block *function_block = sym_ctx.GetFunctionBlock();
 
-  if (frame == nullptr)
-return;
+  if (!function_block)
+return;
 
-  // Find the block that defines the function represented by "sym_ctx"
-  Block *function_block = sym_ctx.GetFunctionBlock();
+  CompilerDeclContext function_decl_ctx = function_block->GetDeclContext();
 
-  if (!function_block)
-return;
+  if (!function_decl_ctx)
+return;
 
-  CompilerDeclContext function_decl_ctx = function_block->GetDeclContext();
+  clang::CXXMethodDecl *method_decl =
+  ClangASTContext::DeclContextGetAsCXXMethodDecl(function_decl_ctx);
 
-  if (!function_decl_ctx)
-return;
+  if (method_decl) {
+clang::CXXRecordDecl *class_decl = method_decl->getParent();
 
-  clang::CXXMethodDecl *method_decl =
-  ClangASTContext::DeclContextGetAsCXXMethodDecl(function_decl_ctx);
+QualType class_qual_type(class_decl->getTypeForDecl(), 0);
 
-  if (method_decl) {
-clang::CXXRecordDecl *class_decl = method_decl->getParent();
+TypeFromUser class_user_type(
+class_qual_type.getAsOpaquePtr(),
+ClangASTContext::GetASTContext(_decl->getASTContext()));
 
-QualType class_qual_type(class_decl->getTypeForDecl(), 0);
+if (log) {
+  ASTDumper ast_dumper(class_qual_type);
+  LLDB_LOGF(log, "  CEDM::FEVD[%u] Adding type for $__lldb_class: %s",
+current_id, ast_dumper.GetCString());
+}
 
-TypeFromUser 

[Lldb-commits] [PATCH] D70417: Accept g packet responses that don't supply all registers

2019-11-20 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

looks good to me




Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp:215-220
+if (reginfo->byte_offset + reginfo->byte_size 
+   <= buffer_sp->GetByteSize()) {
+  m_reg_valid[i] = true;
+} else {
+  m_reg_valid[i] = false;
+}

maybe just `m_reg_valid[i] = reginfo->byte_offset + reginfo->byte_size <= 
buffer_sp->GetByteSize()`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70417



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


Re: [Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

2019-11-20 Thread Omair Javaid via lldb-commits
I am running Arm and AArch64 tests on docker containers running Ubuntu
Xenial.

Underlying hardware is Thunder X1 or D05 machines.

On Tue, 19 Nov 2019, 3:31 pm Jan Kratochvil via Phabricator, <
revi...@reviews.llvm.org> wrote:

> jankratochvil added a comment.
>
> @omjavaid I guess it depends on some system library - what OS
> vendor/release do you have the regression reproducible on?
> Still not reproducible for me.  Trying
> `bfbbf0aba81a84da8b53d4d159d080e77ad8ee70` with applied D70155 <
> https://reviews.llvm.org/D70155> and applied/unapplied this D63540 <
> https://reviews.llvm.org/D63540> on Fedora 30 armv7l and it has no
> difference in testsuite (except for the added/removed testcase of this
> D63540 ).
> In both cases I get these:
>
>   Unexpected Passing Tests (5):
>   lldb-api :: functionalities/archives/TestBSDArchives.py
>   lldb-api :: functionalities/inferior-assert/TestInferiorAssert.py
>   lldb-api ::
> functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneSignal.py
>   lldb-api :: linux/builtin_trap/TestBuiltinTrap.py
>   lldb-api ::
> linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
>   Failing Tests (103):
>   lldb-api ::
> commands/expression/argument_passing_restrictions/TestArgumentPassingRestrictions.py
>   lldb-api ::
> commands/expression/call-function/TestCallStdStringFunction.py
>   lldb-api ::
> commands/expression/call-function/TestCallStopAndContinue.py
>   lldb-api ::
> commands/expression/call-function/TestCallUserDefinedFunction.py
>   lldb-api ::
> commands/expression/call-overridden-method/TestCallOverriddenMethod.py
>   lldb-api :: commands/expression/call-restarts/TestCallThatRestarts.py
>   lldb-api :: commands/expression/char/TestExprsChar.py
>   lldb-api ::
> commands/expression/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py
>   lldb-api :: commands/expression/context-object/TestContextObject.py
>   lldb-api :: commands/expression/dont_allow_jit/TestAllowJIT.py
>   lldb-api :: commands/expression/entry-bp/TestExprEntryBP.py
>   lldb-api ::
> commands/expression/expr-in-syscall/TestExpressionInSyscall.py
>   lldb-api :: commands/expression/formatters/TestFormatters.py
>   lldb-api ::
> commands/expression/inline-namespace/TestInlineNamespace.py
>   lldb-api :: commands/expression/no-deadlock/TestExprDoesntBlock.py
>   lldb-api ::
> commands/expression/persistent_types/TestNestedPersistentTypes.py
>   lldb-api ::
> commands/expression/persistent_types/TestPersistentTypes.py
>   lldb-api :: commands/expression/pr35310/TestExprsBug35310.py
>   lldb-api :: commands/expression/radar_9531204/TestPrintfAfterUp.py
>   lldb-api :: commands/expression/radar_9673664/TestExprHelpExamples.py
>   lldb-api :: commands/expression/rdar44436068/Test128BitsInteger.py
>   lldb-api ::
> commands/expression/static-initializers/TestStaticInitializers.py
>   lldb-api :: commands/expression/test/TestExprs.py
>   lldb-api :: commands/expression/timeout/TestCallWithTimeout.py
>   lldb-api ::
> commands/expression/unwind_expression/TestUnwindExpression.py
>   lldb-api :: commands/expression/xvalue/TestXValuePrinting.py
>   lldb-api ::
> commands/register/register/register_command/TestRegisters.py
>   lldb-api ::
> commands/watchpoints/hello_watchlocation/TestWatchLocation.py
>   lldb-api ::
> commands/watchpoints/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
>   lldb-api ::
> commands/watchpoints/watchpoint_size/TestWatchpointSizes.py
>   lldb-api ::
> functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
>   lldb-api ::
> functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
>   lldb-api ::
> functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
>   lldb-api :: functionalities/load_unload/TestLoadUnload.py
>   lldb-api :: functionalities/load_using_paths/TestLoadUsingPaths.py
>   lldb-api :: functionalities/memory/find/TestMemoryFind.py
>   lldb-api :: functionalities/process_group/TestChangeProcessGroup.py
>   lldb-api :: functionalities/return-value/TestReturnValue.py
>   lldb-api :: functionalities/show_location/TestShowLocationDwarf5.py
>   lldb-api :: functionalities/thread/num_threads/TestNumThreads.py
>   lldb-api :: lang/c/bitfields/TestBitfields.py
>   lldb-api :: lang/c/function_types/TestFunctionTypes.py
>   lldb-api :: lang/c/shared_lib/TestSharedLib.py
>   lldb-api :: lang/c/strings/TestCStrings.py
>   lldb-api :: lang/c/struct_types/TestStructTypes.py
>   lldb-api :: lang/cpp/auto/TestCPPAuto.py
>   lldb-api :: lang/cpp/call-function/TestCallCPPFunction.py
>   lldb-api :: lang/cpp/chained-calls/TestCppChainedCalls.py
>   lldb-api ::
> 

[Lldb-commits] [PATCH] D68206: [clang] Remove the DIFlagArgumentNotModified debug info flag

2019-11-20 Thread Djordje Todorovic via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGce1f95a6e077: Reland [clang] Remove the 
DIFlagArgumentNotModified debug info flag (authored by djtodoro).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68206

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGen/debug-info-param-modification.c
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py

Index: lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py
@@ -6,7 +6,8 @@
 supported_platforms.extend(lldbplatformutil.getDarwinOSTriples())
 
 lldbinline.MakeInlineTest(__file__, globals(),
-[decorators.skipUnlessPlatform(supported_platforms),
+[decorators.skipIf(bugnumber="llvm.org/pr44059"),
+ decorators.skipUnlessPlatform(supported_platforms),
  decorators.skipIf(compiler="clang", compiler_version=['<', '10.0']),
  decorators.skipUnlessArch('x86_64'),
  decorators.skipUnlessHasCallSiteInfo,
Index: clang/test/CodeGen/debug-info-param-modification.c
===
--- clang/test/CodeGen/debug-info-param-modification.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target x86_64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target arm-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target aarch64-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -Xclang -disable-llvm-passes -S -target armeb-none-linux-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-ENTRY-VAL-OPT
-
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "a", arg: 1, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}})
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK-ENTRY-VAL-OPT: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-//
-// RUN: %clang -g -O2 -Xclang -disable-llvm-passes -target x86_64-none-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
-// CHECK-NOT: !DILocalVariable(name: "b", arg: 2, scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: {{.*}}, flags: DIFlagArgumentNotModified)
-//
-// For the os_log_helper:
-// CHECK: !DILocalVariable(name: "buffer", arg: 1, {{.*}}, flags: DIFlagArtificial)
-
-int fn2 (int a, int b) {
-  ++a;
-  return b;
-}
-
-void test_builtin_os_log(void *buf, int i, const char *data) {
-  __builtin_os_log_format(buf, "%d %{public}s %{private}.16P", i, data, data);
-}
Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -146,10 +146,6 @@
 
   llvm::DenseMap DIFileCache;
   llvm::DenseMap SPCache;
-  /// Cache function definitions relevant to use for parameters mutation
-  /// analysis.
-  llvm::DenseMap SPDefCache;
-  llvm::DenseMap ParamCache;
   /// Cache declarations relevant to DW_TAG_imported_declarations (C++
   /// using declarations) that aren't covered by other more specific caches.
   llvm::DenseMap DeclCache;
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -18,7 +18,6 @@
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
 #include "ConstantEmitter.h"
-#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
@@ -3686,15 +3685,6 @@
   if (HasDecl && isa(D))
 DeclCache[D->getCanonicalDecl()].reset(SP);
 
-  // We use the SPDefCache only in the case when the debug entry values option
-  // is set, in order to speed up parameters modification analysis.
-  //
-  // FIXME: Use AbstractCallee here to support ObjCMethodDecl.
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl)
-if (auto 

[Lldb-commits] [PATCH] D70474: [Reproducer] Generate LLDB reproducer on crash

2019-11-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I think this looks pretty good. This is going to do a _lot_ of work in the 
signal handler, which may or may not work. However, at the point when this code 
gets invoked, we're already in undefined behavior territory anyway, so we might 
as well give it a shot. The dumping code can be gradually hardened later if we 
find that a lot of reproducers are failing to complete the dumping process.

I was expecting that the raise(SIGWHATEVER) stuff will not work on windows, but 
it looks like it should at least compile 
.
 I have no idea what will that do at runtime, but reproducers don't work on 
windows anyway.




Comment at: lldb/source/Commands/CommandObjectReproducer.cpp:86
+eReproducerCrashSigbus,
+"sigbus",
+"Bus error",

everywhere else we use capital letters for signal names



Comment at: lldb/source/Commands/CommandObjectReproducer.cpp:99-103
+{
+eReproducerCrashNone,
+"none",
+"None",
+},

What's the reason for the "none" value? Can we remove it? I am assuming noone 
would ever want to write "reproducer (x)crash -s none"...



Comment at: lldb/source/Commands/CommandObjectReproducer.cpp:159
 
+class CommandObjectReproducerCrash : public CommandObjectParsed {
+public:

Maybe also call this xcrash?



Comment at: lldb/source/Commands/Options.td:441
 
+let Command = "reproducer crash" in {
+  def reproducer_signal : Option<"signal", "s">, Group<1>,

xcrash?



Comment at: lldb/tools/driver/Driver.cpp:739-744
+llvm::outs() << lldb::SBDebugger::GetVersionString() << '\n';
+llvm::outs() << "Reproducer written to '" << SBReproducer::GetPath()
+ << "'\n";
+llvm::outs()
+<< "Please have a look at the directory to assess if you're willing to 
"
+   "share the contained information.\n";

I'm thinking if there's a way to centralize the printing of this message. Right 
now it is duplicated here and in the "reproducer generate" implementation, and 
it's already accumulating subtle differences (e.g., this copy includes the 
version string while the other one does not -- it seems like this would be 
useful everywhere). Maybe if the Generate call takes an SBFile object -- the 
stream where this message gets written to, and then we have some lldb_private 
function writing that message?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70474



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


[Lldb-commits] [lldb] ce1f95a - Reland "[clang] Remove the DIFlagArgumentNotModified debug info flag"

2019-11-20 Thread Djordje Todorovic via lldb-commits

Author: Djordje Todorovic
Date: 2019-11-20T10:08:07+01:00
New Revision: ce1f95a6e077693f93d8869245f911aff3eb7e4c

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

LOG: Reland "[clang] Remove the DIFlagArgumentNotModified debug info flag"

It turns out that the ExprMutationAnalyzer can be very slow when AST
gets huge in some cases. The idea is to move this analysis to the LLVM
back-end level (more precisely, in the LiveDebugValues pass). The new
approach will remove the performance regression, simplify the
implementation and give us front-end independent implementation.

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

Added: 


Modified: 
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h

lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py

Removed: 
clang/test/CodeGen/debug-info-param-modification.c



diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 116517a9cb99..a9b3831aa0b5 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -18,7 +18,6 @@
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
 #include "ConstantEmitter.h"
-#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclFriend.h"
 #include "clang/AST/DeclObjC.h"
@@ -3686,15 +3685,6 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, 
SourceLocation Loc,
   if (HasDecl && isa(D))
 DeclCache[D->getCanonicalDecl()].reset(SP);
 
-  // We use the SPDefCache only in the case when the debug entry values option
-  // is set, in order to speed up parameters modification analysis.
-  //
-  // FIXME: Use AbstractCallee here to support ObjCMethodDecl.
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl)
-if (auto *FD = dyn_cast(D))
-  if (FD->hasBody() && !FD->param_empty())
-SPDefCache[FD].reset(SP);
-
   // Push the function onto the lexical block stack.
   LexicalBlockStack.emplace_back(SP);
 
@@ -4097,11 +4087,6 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const 
VarDecl *VD,
  llvm::DebugLoc::get(Line, Column, Scope, 
CurInlinedAt),
  Builder.GetInsertBlock());
 
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && ArgNo) {
-if (auto *PD = dyn_cast(VD))
-  ParamCache[PD].reset(D);
-  }
-
   return D;
 }
 
@@ -4717,29 +4702,6 @@ void CGDebugInfo::setDwoId(uint64_t Signature) {
   TheCU->setDWOId(Signature);
 }
 
-/// Analyzes each function parameter to determine whether it is constant
-/// throughout the function body.
-static void analyzeParametersModification(
-ASTContext ,
-llvm::DenseMap ,
-llvm::DenseMap ) {
-  for (auto  : SPDefCache) {
-auto *FD = SP.first;
-assert(FD->hasBody() && "Functions must have body here");
-const Stmt *FuncBody = (*FD).getBody();
-for (auto Parm : FD->parameters()) {
-  ExprMutationAnalyzer FuncAnalyzer(*FuncBody, Ctx);
-  if (FuncAnalyzer.isMutated(Parm))
-continue;
-
-  auto I = ParamCache.find(Parm);
-  assert(I != ParamCache.end() && "Parameters should be already cached");
-  auto *DIParm = cast(I->second);
-  DIParm->setIsNotModified();
-}
-  }
-}
-
 void CGDebugInfo::finalize() {
   // Creating types might create further types - invalidating the current
   // element and the size(), so don't cache/reference them.
@@ -4812,10 +4774,6 @@ void CGDebugInfo::finalize() {
 if (auto MD = TypeCache[RT])
   DBuilder.retainType(cast(MD));
 
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues)
-// This will be used to emit debug entry values.
-analyzeParametersModification(CGM.getContext(), SPDefCache, ParamCache);
-
   DBuilder.finalize();
 }
 

diff  --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 9a097615b4b4..5341bfa7f350 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -146,10 +146,6 @@ class CGDebugInfo {
 
   llvm::DenseMap DIFileCache;
   llvm::DenseMap SPCache;
-  /// Cache function definitions relevant to use for parameters mutation
-  /// analysis.
-  llvm::DenseMap SPDefCache;
-  llvm::DenseMap ParamCache;
   /// Cache declarations relevant to DW_TAG_imported_declarations (C++
   /// using declarations) that aren't covered by other more specific caches.
   llvm::DenseMap DeclCache;

diff  --git a/clang/test/CodeGen/debug-info-param-modification.c 
b/clang/test/CodeGen/debug-info-param-modification.c
deleted file mode 100644
index f0a13a3777db..
--- a/clang/test/CodeGen/debug-info-param-modification.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 

[Lldb-commits] [PATCH] D70458: [NFC] Refactor and improve comments in CommandObjectTarget

2019-11-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/source/Commands/CommandObjectTarget.cpp:4059
   if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
-  module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
+module_spec.GetFileSpec() = symbol_fspec;
 }

This does change behavior because previously the symbol file directory wasn't 
being copied. I think that was intentional because the comment on line 4112 
says "match up the file by basename" (and it also makes sense because if you're 
adding symbols in an external file, then the main module file cannot be the 
exact same path as the symbol file).


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

https://reviews.llvm.org/D70458



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