[Lldb-commits] [lldb] c7b7f76 - [lldb]: fix typo in lldb-gdb-remote.txt

2020-02-20 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2020-02-20T14:30:12+01:00
New Revision: c7b7f76ae6ae2a5f3d9753b37ef811da15386cd4

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

LOG: [lldb]: fix typo in lldb-gdb-remote.txt

Summary: The logic of the sentence made more sense when "with" is replaced with 
"without".

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/docs/lldb-gdb-remote.txt

Removed: 




diff  --git a/lldb/docs/lldb-gdb-remote.txt b/lldb/docs/lldb-gdb-remote.txt
index 06cd09d77c41..276beedd047c 100644
--- a/lldb/docs/lldb-gdb-remote.txt
+++ b/lldb/docs/lldb-gdb-remote.txt
@@ -3,7 +3,7 @@ remote debugging. Why? Normally you need to start the correct 
GDB and the
 correct GDB server when debugging. If you have mismatch, then things go wrong
 very quickly. LLDB makes extensive use of the GDB remote protocol and we
 wanted to make sure that the experience was a bit more dynamic where we can
-discover information about a remote target with having to know anything up
+discover information about a remote target without having to know anything up
 front. We also ran into performance issues with the existing GDB remote
 protocol that can be overcome when using a reliable communications layer.
 Some packets improve performance, others allow for remote process launching



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


[Lldb-commits] [lldb] 4436178 - [lldb] fix typo in comment for lldbtest.py

2020-03-19 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2020-03-19T10:08:11-04:00
New Revision: 44361782e2c252c8886cd77f6b7d4ebe64fb6e8d

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

LOG: [lldb] fix typo in comment for lldbtest.py

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbtest.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index f8f916036f9a..966d460ea13d 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1,7 +1,7 @@
 """
 LLDB module which provides the abstract base class of lldb test case.
 
-The concrete subclass can override lldbtest.TesBase in order to inherit the
+The concrete subclass can override lldbtest.TestBase in order to inherit the
 common behavior for unitest.TestCase.setUp/tearDown implemented in this file.
 
 The subclass should override the attribute mydir in order for the python 
runtime



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


[Lldb-commits] [lldb] 107200a - [lldb][nfc] early exit/continue

2020-04-03 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2020-04-03T14:50:08+02:00
New Revision: 107200ae0a032f2e6024f45d665a0f2b7c732a62

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

LOG: [lldb][nfc] early exit/continue

Summary:
This commit just tries to invert some `if`'s logic to
`return`/`continue` early.

Reviewers: jankratochvil, teemperor

Reviewed By: jankratochvil, teemperor

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/source/Breakpoint/BreakpointResolverName.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp 
b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 2eb0d3ab5888..25f5bb3f6eed 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -332,65 +332,66 @@ BreakpointResolverName::SearchCallback(SearchFilter 
&filter,
 
   // Remove any duplicates between the function list and the symbol list
   SymbolContext sc;
-  if (func_list.GetSize()) {
-for (uint32_t i = 0; i < func_list.GetSize(); i++) {
-  if (func_list.GetContextAtIndex(i, sc)) {
-bool is_reexported = false;
-
-if (sc.block && sc.block->GetInlinedFunctionInfo()) {
-  if (!sc.block->GetStartAddress(break_addr))
-break_addr.Clear();
-} else if (sc.function) {
-  break_addr = sc.function->GetAddressRange().GetBaseAddress();
-  if (m_skip_prologue && break_addr.IsValid()) {
-const uint32_t prologue_byte_size =
-sc.function->GetPrologueByteSize();
-if (prologue_byte_size)
-  break_addr.SetOffset(break_addr.GetOffset() + 
prologue_byte_size);
-  }
-} else if (sc.symbol) {
-  if (sc.symbol->GetType() == eSymbolTypeReExported) {
-const Symbol *actual_symbol =
-sc.symbol->ResolveReExportedSymbol(breakpoint.GetTarget());
-if (actual_symbol) {
-  is_reexported = true;
-  break_addr = actual_symbol->GetAddress();
-}
-  } else {
-break_addr = sc.symbol->GetAddress();
-  }
-
-  if (m_skip_prologue && break_addr.IsValid()) {
-const uint32_t prologue_byte_size =
-sc.symbol->GetPrologueByteSize();
-if (prologue_byte_size)
-  break_addr.SetOffset(break_addr.GetOffset() + 
prologue_byte_size);
-else {
-  const Architecture *arch =
-  breakpoint.GetTarget().GetArchitecturePlugin();
-  if (arch)
-arch->AdjustBreakpointAddress(*sc.symbol, break_addr);
-}
-  }
+  if (!func_list.GetSize())
+return Searcher::eCallbackReturnContinue;
+
+  for (uint32_t i = 0; i < func_list.GetSize(); i++) {
+if (!func_list.GetContextAtIndex(i, sc))
+  continue;
+
+bool is_reexported = false;
+
+if (sc.block && sc.block->GetInlinedFunctionInfo()) {
+  if (!sc.block->GetStartAddress(break_addr))
+break_addr.Clear();
+} else if (sc.function) {
+  break_addr = sc.function->GetAddressRange().GetBaseAddress();
+  if (m_skip_prologue && break_addr.IsValid()) {
+const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
+if (prologue_byte_size)
+  break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
+  }
+} else if (sc.symbol) {
+  if (sc.symbol->GetType() == eSymbolTypeReExported) {
+const Symbol *actual_symbol =
+sc.symbol->ResolveReExportedSymbol(breakpoint.GetTarget());
+if (actual_symbol) {
+  is_reexported = true;
+  break_addr = actual_symbol->GetAddress();
 }
+  } else {
+break_addr = sc.symbol->GetAddress();
+  }
 
-if (break_addr.IsValid()) {
-  if (filter.AddressPasses(break_addr)) {
-bool new_location;
-BreakpointLocationSP bp_loc_sp(
-AddLocation(break_addr, &new_location));
-bp_loc_sp->SetIsReExported(is_reexported);
-if (bp_loc_sp && new_location && !breakpoint.IsInternal()) {
-  if (log) {
-StreamString s;
-bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-LLDB_LOGF(log, "Added location: %s\n", s.GetData());
-  }
-}
-  }
+  if (m_skip_prologue && break_addr.IsValid()) {
+const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
+if (prologue_byte_size)
+  break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
+else {
+  const Architecture *arch =
+  breakpoint.Get

[Lldb-commits] [lldb] 9072df8 - [lldb][nfc] remove overriden funcs with default impl

2020-04-06 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2020-04-06T10:05:59-04:00
New Revision: 9072df8ac1431dba51394b77ead766aada82867f

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

LOG: [lldb][nfc] remove overriden funcs with default impl

Summary:
These `SearchFilter` methods all return `true` by their default
implementation:

```lang=c++
virtual bool ModulePasses(const FileSpec &spec);
virtual bool ModulePasses(const lldb::ModuleSP &module_sp);
virtual bool AddressPasses(Address &addr);
virtual bool CompUnitPasses(FileSpec &fileSpec);
virtual bool CompUnitPasses(CompileUnit &compUnit);
```

That's why I've documented the default behavior and remove the overrides
(except for `AddressPasses`) in these `SearchFilter`-subclasses which all just
repeated the default implementation: `SearchFilterByModule`,
`SearchFilterByModuleList`.

Reviewers: jankratochvil, labath

Reviewed By: jankratochvil, labath

Subscribers: labath, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Core/SearchFilter.h
lldb/source/Core/SearchFilter.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/SearchFilter.h 
b/lldb/include/lldb/Core/SearchFilter.h
index 178489a88f3d..9f56bbe40324 100644
--- a/lldb/include/lldb/Core/SearchFilter.h
+++ b/lldb/include/lldb/Core/SearchFilter.h
@@ -98,6 +98,8 @@ class SearchFilter {
   ///The file spec to check against the filter.
   /// \return
   ///\b true if \a spec passes, and \b false otherwise.
+  ///
+  /// \note the default implementation always returns \c true.
   virtual bool ModulePasses(const FileSpec &spec);
 
   /// Call this method with a Module to see if that module passes the filter.
@@ -107,6 +109,8 @@ class SearchFilter {
   ///
   /// \return
   ///\b true if \a module passes, and \b false otherwise.
+  ///
+  /// \note the default implementation always returns \c true.
   virtual bool ModulePasses(const lldb::ModuleSP &module_sp);
 
   /// Call this method with a Address to see if \a address passes the filter.
@@ -116,6 +120,8 @@ class SearchFilter {
   ///
   /// \return
   ///\b true if \a address passes, and \b false otherwise.
+  ///
+  /// \note the default implementation always returns \c true.
   virtual bool AddressPasses(Address &addr);
 
   /// Call this method with a FileSpec to see if \a file spec passes the
@@ -126,6 +132,8 @@ class SearchFilter {
   ///
   /// \return
   ///\b true if \a file spec passes, and \b false otherwise.
+  ///
+  /// \note the default implementation always returns \c true.
   virtual bool CompUnitPasses(FileSpec &fileSpec);
 
   /// Call this method with a CompileUnit to see if \a comp unit passes the
@@ -136,6 +144,8 @@ class SearchFilter {
   ///
   /// \return
   ///\b true if \a Comp Unit passes, and \b false otherwise.
+  ///
+  /// \note the default implementation always returns \c true.
   virtual bool CompUnitPasses(CompileUnit &compUnit);
 
   /// Call this method with a Function to see if \a function passes the
@@ -321,10 +331,6 @@ class SearchFilterByModule : public SearchFilter {
 
   bool AddressPasses(Address &address) override;
 
-  bool CompUnitPasses(FileSpec &fileSpec) override;
-
-  bool CompUnitPasses(CompileUnit &compUnit) override;
-
   void GetDescription(Stream *s) override;
 
   uint32_t GetFilterRequiredItems() override;
@@ -372,10 +378,6 @@ class SearchFilterByModuleList : public SearchFilter {
 
   bool AddressPasses(Address &address) override;
 
-  bool CompUnitPasses(FileSpec &fileSpec) override;
-
-  bool CompUnitPasses(CompileUnit &compUnit) override;
-
   void GetDescription(Stream *s) override;
 
   uint32_t GetFilterRequiredItems() override;

diff  --git a/lldb/source/Core/SearchFilter.cpp 
b/lldb/source/Core/SearchFilter.cpp
index 494e88dde267..ea51fb379181 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -417,12 +417,6 @@ bool SearchFilterByModule::AddressPasses(Address &address) 
{
   return true;
 }
 
-bool SearchFilterByModule::CompUnitPasses(FileSpec &fileSpec) { return true; }
-
-bool SearchFilterByModule::CompUnitPasses(CompileUnit &compUnit) {
-  return true;
-}
-
 void SearchFilterByModule::Search(Searcher &searcher) {
   if (!m_target_sp)
 return;
@@ -543,14 +537,6 @@ bool SearchFilterByModuleList::AddressPasses(Address 
&address) {
   return true;
 }
 
-bool SearchFilterByModuleList::CompUnitPasses(FileSpec &fileSpec) {
-  return true;
-}
-
-bool SearchFilterByModuleList::CompUnitPasses(CompileUnit &compUnit) {
-  return true;
-}
-
 void SearchFilterByModuleList::Search(Searcher &searcher) {
   if (!m_target_sp)
 return;



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https:

[Lldb-commits] [lldb] r373891 - [lldb][ELF] Read symbols from .gnu_debugdata sect.

2019-10-07 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Mon Oct  7 03:32:16 2019
New Revision: 373891

URL: http://llvm.org/viewvc/llvm-project?rev=373891&view=rev
Log:
[lldb][ELF] Read symbols from .gnu_debugdata sect.

Summary:
If the .symtab section is stripped from the binary it might be that
there's a .gnu_debugdata section which contains a smaller .symtab in
order to provide enough information to create a backtrace with function
names or to set and hit a breakpoint on a function name.

This change looks for a .gnu_debugdata section in the ELF object file.
The .gnu_debugdata section contains a xz-compressed ELF file with a
.symtab section inside. Symbols from that compressed .symtab section
are merged with the main object file's .dynsym symbols (if any).
In addition we always load the .dynsym even if there's a .symtab
section.

For example, the Fedora and RHEL operating systems strip their binaries
but keep a .gnu_debugdata section. While gdb already can read this
section, LLDB until this patch couldn't. To test this patch on a
Fedora or RHEL operating system, try to set a breakpoint on the "help"
symbol in the "zip" binary. Before this patch, only GDB can set this
breakpoint; now LLDB also can do so without installing extra debug
symbols:

lldb /usr/bin/zip -b -o "b help" -o "r" -o "bt" -- -h

The above line runs LLDB in batch mode and on the "/usr/bin/zip -h"
target:

(lldb) target create "/usr/bin/zip"
Current executable set to '/usr/bin/zip' (x86_64).
(lldb) settings set -- target.run-args  "-h"

Before the program starts, we set a breakpoint on the "help" symbol:

(lldb) b help
Breakpoint 1: where = zip`help, address = 0x004093b0

Once the program is run and has hit the breakpoint we ask for a
backtrace:

(lldb) r
Process 10073 stopped
* thread #1, name = 'zip', stop reason = breakpoint 1.1
frame #0: 0x004093b0 zip`help
zip`help:
->  0x4093b0 <+0>:  pushq  %r12
0x4093b2 <+2>:  movq   0x2af5f(%rip), %rsi   ;  + 4056
0x4093b9 <+9>:  movl   $0x1, %edi
0x4093be <+14>: xorl   %eax, %eax

Process 10073 launched: '/usr/bin/zip' (x86_64)
(lldb) bt
* thread #1, name = 'zip', stop reason = breakpoint 1.1
  * frame #0: 0x004093b0 zip`help
frame #1: 0x00403970 zip`main + 3248
frame #2: 0x77d8bf33 libc.so.6`__libc_start_main + 243
frame #3: 0x00408cee zip`_start + 46

In order to support the .gnu_debugdata section, one has to have LZMA
development headers installed. The CMake section, that controls this
part looks for the LZMA headers and enables .gnu_debugdata support by
default if they are found; otherwise or if explicitly requested, the
minidebuginfo support is disabled.

GDB supports the "mini debuginfo" section .gnu_debugdata since v7.6
(2013).

Reviewers: espindola, labath, jankratochvil, alexshap

Reviewed By: labath

Subscribers: rnkovacs, wuzish, shafik, emaste, mgorny, arichardson, hiraditya, 
MaskRay, lldb-commits

Tags: #lldb, #llvm

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

Added:
lldb/trunk/include/lldb/Host/LZMA.h
lldb/trunk/lit/Modules/ELF/Inputs/minidebuginfo-main.c
lldb/trunk/lit/Modules/ELF/minidebuginfo-corrupt-xz.yaml
lldb/trunk/lit/Modules/ELF/minidebuginfo-find-symbols.yaml
lldb/trunk/lit/Modules/ELF/minidebuginfo-no-lzma.yaml
lldb/trunk/lit/Modules/ELF/minidebuginfo-set-and-hit-breakpoint.test
lldb/trunk/source/Host/common/LZMA.cpp
Modified:
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/include/lldb/Host/Config.h.cmake
lldb/trunk/lit/CMakeLists.txt
lldb/trunk/lit/lit.cfg.py
lldb/trunk/lit/lit.site.cfg.py.in
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=373891&r1=373890&r2=373891&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Mon Oct  7 03:32:16 2019
@@ -1,5 +1,6 @@
 include(CheckCXXSymbolExists)
 include(CheckTypeSize)
+include(CMakeDependentOption)
 
 set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
@@ -384,6 +385,13 @@ endif()
 set(LLDB_VERSION 
"${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}")
 message(STATUS "LLDB version: ${LLDB_VERSION}")
 
+find_package(LibLZMA)
+cmake_dependent_option(LLDB_ENABLE_LZMA "Support LZMA compression" ON 
"LIBLZMA_FOUND" OFF)
+if (LLDB_ENABLE_LZMA)
+  include_directories(${LIBLZMA_INCLUDE_DIRS})
+endif()
+llvm_canonicalize_cmake_booleans(LLDB_ENABLE_LZMA)
+
 include_directories(BEFORE
   ${CMAKE_CURRENT_BINARY_DIR}/include
   ${CMAKE_CURRENT_SOURCE_DIR}/inc

[Lldb-commits] [lldb] r374069 - Simplify LZMA decoding by using ArrayRef::take_back

2019-10-08 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Tue Oct  8 08:43:29 2019
New Revision: 374069

URL: http://llvm.org/viewvc/llvm-project?rev=374069&view=rev
Log:
Simplify LZMA decoding by using ArrayRef::take_back

Summary: Follow-up for D66791#inline-616303

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/source/Host/common/LZMA.cpp

Modified: lldb/trunk/source/Host/common/LZMA.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/LZMA.cpp?rev=374069&r1=374068&r2=374069&view=diff
==
--- lldb/trunk/source/Host/common/LZMA.cpp (original)
+++ lldb/trunk/source/Host/common/LZMA.cpp Tue Oct  8 08:43:29 2019
@@ -76,7 +76,7 @@ getUncompressedSize(llvm::ArrayRefhttps://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r374071 - [lldb] Avoid resource leak

2019-10-08 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Tue Oct  8 08:56:02 2019
New Revision: 374071

URL: http://llvm.org/viewvc/llvm-project?rev=374071&view=rev
Log:
[lldb] Avoid resource leak

Summary:
Before the pointer variable `args_dict` was assigned the result of an
allocation with `new` and then `args_dict` is passed to
`GetValueForKeyAsDictionary` which immediatly and unconditionally
assigns `args_dict` to `nullptr`:

```
bool GetValueForKeyAsDictionary(llvm::StringRef key,
Dictionary *&result) const {
  result = nullptr;
```

This caused a memory leak which was found in my coverity scan instance
under CID 224753: https://scan.coverity.com/projects/kwk-llvm-project.

Reviewers: jankratochvil, teemperor

Reviewed By: teemperor

Subscribers: teemperor, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/source/Breakpoint/BreakpointResolverScripted.cpp

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverScripted.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverScripted.cpp?rev=374071&r1=374070&r2=374071&view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointResolverScripted.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverScripted.cpp Tue Oct  8 
08:56:02 2019
@@ -92,7 +92,7 @@ BreakpointResolverScripted::CreateFromSt
   depth = (lldb::SearchDepth) depth_as_int;
   
   StructuredDataImpl *args_data_impl = new StructuredDataImpl();
-  StructuredData::Dictionary *args_dict = new StructuredData::Dictionary();
+  StructuredData::Dictionary *args_dict = nullptr;
   success = options_dict.GetValueForKeyAsDictionary(
 GetKey(OptionNames::ScriptArgs), args_dict);
   if (success) {


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


[Lldb-commits] [lldb] 9129a28 - [lldb] drop .symtab removal in minidebuginfo tests

2019-10-21 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2019-10-21T14:11:21Z
New Revision: 9129a281cd5b8b1fb804be1de396de4a42676570

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

LOG: [lldb] drop .symtab removal in minidebuginfo tests

Summary:
After D69041, we no longer have to manually remove the .symtab section
once yaml2obj was run.

Reviewers: espindola, alexshap

Subscribers: emaste, arichardson, MaskRay, lldb-commits

Tags: #lldb

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

llvm-svn: 375415

Added: 


Modified: 
lldb/test/Shell/ObjectFile/ELF/minidebuginfo-corrupt-xz.yaml
lldb/test/Shell/ObjectFile/ELF/minidebuginfo-find-symbols.yaml
lldb/test/Shell/ObjectFile/ELF/minidebuginfo-no-lzma.yaml

Removed: 




diff  --git a/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-corrupt-xz.yaml 
b/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-corrupt-xz.yaml
index cec34b9c6233..938688cdfe61 100644
--- a/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-corrupt-xz.yaml
+++ b/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-corrupt-xz.yaml
@@ -5,11 +5,6 @@
 
 # RUN: yaml2obj %s > %t.obj
 
-# TODO(kwk): once yaml2obj doesn't auto-generate a .symtab section
-# when there's none in YAML, remove the following line:
-
-# RUN: llvm-objcopy --remove-section=.symtab %t.obj
-
 # RUN: %lldb -b -o 'image dump symtab' %t.obj 2>&1 | FileCheck %s
 
 # CHECK: warning: (x86_64) {{.*}}.obj An error occurred while decompression 
the section .gnu_debugdata: lzma_stream_buffer_decode()=lzma error: 
LZMA_DATA_ERROR

diff  --git a/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-find-symbols.yaml 
b/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-find-symbols.yaml
index 230ce8bb1c33..e6ebb0381439 100644
--- a/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-find-symbols.yaml
+++ b/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-find-symbols.yaml
@@ -2,11 +2,6 @@
 
 # RUN: yaml2obj %s > %t.obj
 
-# TODO(kwk): once yaml2obj doesn't auto-generate a .symtab section
-# when there's none in YAML, remove the following line:
-
-# RUN: llvm-objcopy --remove-section=.symtab %t.obj
-
 # RUN: %lldb -b -o 'image dump symtab' %t.obj | FileCheck %s
 
 # CHECK: [ 0] 1 X Code 0x004005b0 0x000f 0x0012 
multiplyByFour

diff  --git a/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-no-lzma.yaml 
b/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-no-lzma.yaml
index a127109e991a..63c82baf07e2 100644
--- a/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-no-lzma.yaml
+++ b/lldb/test/Shell/ObjectFile/ELF/minidebuginfo-no-lzma.yaml
@@ -5,11 +5,6 @@
 
 # RUN: yaml2obj %s > %t.obj
 
-# TODO(kwk): once yaml2obj doesn't auto-generate a .symtab section
-# when there's none in YAML, remove the following line:
-
-# RUN: llvm-objcopy --remove-section=.symtab %t.obj
-
 # RUN: %lldb -b -o 'image dump symtab' %t.obj 2>&1 | FileCheck %s
 
 # CHECK: warning: (x86_64) {{.*}}.obj No LZMA support found for reading 
.gnu_debugdata section



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


[Lldb-commits] [lldb] r371599 - [LLDB][ELF] Load both, .symtab and .dynsym sections

2019-09-11 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Wed Sep 11 03:00:30 2019
New Revision: 371599

URL: http://llvm.org/viewvc/llvm-project?rev=371599&view=rev
Log:
[LLDB][ELF] Load both, .symtab and .dynsym sections

Summary:
This change ensures that the .dynsym section will be parsed even when there's 
already is a .symtab.

It is motivated because of minidebuginfo 
(https://sourceware.org/gdb/current/onlinedocs/gdb/MiniDebugInfo.html#MiniDebugInfo).

There it says:

Keep all the function symbols not already in the dynamic symbol table.

That means the .symtab embedded inside the .gnu_debugdata does NOT contain the 
symbols from .dynsym. But in order to put a breakpoint on all symbols we need 
to load both. I hope this makes sense.

My other patch D66791 implements support for minidebuginfo, that's why I need 
this change.

Reviewers: labath, espindola, alexshap

Subscribers: JDevlieghere, emaste, arichardson, MaskRay, lldb-commits

Tags: #lldb

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

Added:
lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c
lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c
lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test
lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test
Modified:
lldb/trunk/lit/helper/toolchain.py
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Added: lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c?rev=371599&view=auto
==
--- lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c (added)
+++ lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c Wed Sep 11 
03:00:30 2019
@@ -0,0 +1,7 @@
+// This function will be embedded within the .dynsym section of the main 
binary.
+int functionInDynsym(int num) { return num * 3; }
+
+int main(int argc, char *argv[]) {
+  int y = functionInDynsym(argc);
+  return y;
+}

Added: lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c?rev=371599&view=auto
==
--- lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c (added)
+++ lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c Wed Sep 11 
03:00:30 2019
@@ -0,0 +1,12 @@
+// This function will be embedded within the .symtab section of the
+// .gnu_debugdata section.
+int functionInSymtab(int num) { return num * 4; }
+
+// This function will be embedded within the .dynsym section of the main 
binary.
+int functionInDynsym(int num) { return num * 3; }
+
+int main(int argc, char *argv[]) {
+  int x = functionInSymtab(argc);
+  int y = functionInDynsym(x);
+  return y;
+}

Added: lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test?rev=371599&view=auto
==
--- lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test (added)
+++ lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test Wed Sep 11 03:00:30 
2019
@@ -0,0 +1,33 @@
+# REQUIRES: system-linux
+
+# This test ensures that we will load .dynsym even if there's no .symtab 
section.
+# We do this by compiling a small C program with a function and we direct the
+# linker where to put the symbols so that in the end the layout is as follows:
+#
+#   Symbol table '.dynsym' contains 4 entries:
+#  Num:Value  Size TypeBind   Vis  Ndx Name
+#0:  0 NOTYPE  LOCAL  DEFAULT  UND 
+#1:  0 FUNCGLOBAL DEFAULT  UND 
__libc_start_main@GLIBC_2.2.5
+#2:  0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
+#3: 0040111013 FUNCGLOBAL DEFAULT   10 functionInDynsym
+
+# We want to keep the symbol "functionInDynsym" in the .dynamic section and not
+# have it put the default .symtab section.
+# RUN: echo "{functionInDynsym;};" > %T/dynmic-symbols.txt
+# RUN: %clang -Wl,--dynamic-list=%T/dynmic-symbols.txt -g -o %t.binary 
%p/Inputs/load-from-dynsym-alone.c
+
+# Remove not needed symbols
+# RUN: echo "functionInDynsym" > %t.keep_symbols
+# RUN: llvm-objcopy --strip-all --remove-section .gdb_index --remove-section 
.comment --keep-symbols=%t.keep_symbols %t.binary
+
+# Remove functionInDynsym symbol from .symtab (will leave symbol in .dynsym 
intact)
+# RUN: llvm-strip --strip-symbol=functionInDynsym %t.binary
+
+# RUN: %lldb -b -o 'b functionInDynsym' -o 'run' -o 'continue' %t.binary | 
FileCheck %s
+
+# CHECK: (lldb) b functionInDynsym
+# CHECK-NEXT: Breakpoint 1: where = {{.*}}.binary`functionInDynsym, address = 
0x{{.*}}
+
+# CHECK: (lldb) run
+# CHECK-NEXT: Process {{.*}} stopped
+# CHECK-NEXT: * thread #1, name = 'load-from-dynsy', sto

[Lldb-commits] [lldb] r371600 - [LLDB][ELF] Fixup for comments in D67390

2019-09-11 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Wed Sep 11 03:12:36 2019
New Revision: 371600

URL: http://llvm.org/viewvc/llvm-project?rev=371600&view=rev
Log:
[LLDB][ELF] Fixup for comments in D67390

Modified:
lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test
lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test?rev=371600&r1=371599&r2=371600&view=diff
==
--- lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test (original)
+++ lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test Wed Sep 11 03:12:36 
2019
@@ -11,7 +11,7 @@
 #2:  0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
 #3: 0040111013 FUNCGLOBAL DEFAULT   10 functionInDynsym
 
-# We want to keep the symbol "functionInDynsym" in the .dynamic section and not
+# We want to keep the symbol "functionInDynsym" in the .dynsym section and not
 # have it put the default .symtab section.
 # RUN: echo "{functionInDynsym;};" > %T/dynmic-symbols.txt
 # RUN: %clang -Wl,--dynamic-list=%T/dynmic-symbols.txt -g -o %t.binary 
%p/Inputs/load-from-dynsym-alone.c

Modified: lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test?rev=371600&r1=371599&r2=371600&view=diff
==
--- lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test (original)
+++ lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test Wed Sep 11 03:12:36 
2019
@@ -16,7 +16,7 @@
 # 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 # 1: 0040111015 FUNCGLOBAL DEFAULT   10 functionInSymtab
 
-# We want to keep the symbol "functionInDynsym" in the .dynamic section and not
+# We want to keep the symbol "functionInDynsym" in the .dynsym section and not
 # have it put the default .symtab section.
 # RUN: echo "{functionInDynsym;};" > %T/dynmic-symbols.txt
 # RUN: %clang -Wl,--dynamic-list=%T/dynmic-symbols.txt -g -o %t.binary 
%p/Inputs/load-symtab-and-dynsym.c

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=371600&r1=371599&r2=371600&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Sep 11 
03:12:36 2019
@@ -2644,12 +2644,11 @@ Symtab *ObjectFileELF::GetSymtab() {
 
 // Sharable objects and dynamic executables usually have 2 distinct symbol
 // tables, one named ".symtab", and the other ".dynsym". The dynsym is a
-// smaller version of the symtab that only contains global symbols. The
-// information found in the dynsym is therefore also found in the symtab,
-// while the reverse is not necessarily true.
-// One exception to the above rule is when we have minidebuginfo embedded
-// into a compressed .gnu_debugdata section. This section contains a 
.symtab
-// from which all symbols already contained in the .dynsym are stripped.
+// smaller version of the symtab that only contains global symbols.
+// Information in the dynsym section is *usually* also found in the symtab,
+// but this is not required as symtab entries can be removed after linking.
+// The minidebuginfo format makes use of this facility to create smaller
+// symbol tables.
 Section *symtab =
 section_list->FindSectionByType(eSectionTypeELFSymbolTable, 
true).get();
 if (symtab) {


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


[Lldb-commits] [lldb] r371624 - Revert "[LLDB][ELF] Fixup for comments in D67390"

2019-09-11 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Wed Sep 11 07:33:21 2019
New Revision: 371624

URL: http://llvm.org/viewvc/llvm-project?rev=371624&view=rev
Log:
Revert "[LLDB][ELF] Fixup for comments in D67390"

This reverts commit 813f05915d29904878d926f9849ca3dbe78096af.

Modified:
lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test
lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test?rev=371624&r1=371623&r2=371624&view=diff
==
--- lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test (original)
+++ lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test Wed Sep 11 07:33:21 
2019
@@ -11,7 +11,7 @@
 #2:  0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
 #3: 0040111013 FUNCGLOBAL DEFAULT   10 functionInDynsym
 
-# We want to keep the symbol "functionInDynsym" in the .dynsym section and not
+# We want to keep the symbol "functionInDynsym" in the .dynamic section and not
 # have it put the default .symtab section.
 # RUN: echo "{functionInDynsym;};" > %T/dynmic-symbols.txt
 # RUN: %clang -Wl,--dynamic-list=%T/dynmic-symbols.txt -g -o %t.binary 
%p/Inputs/load-from-dynsym-alone.c

Modified: lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test?rev=371624&r1=371623&r2=371624&view=diff
==
--- lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test (original)
+++ lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test Wed Sep 11 07:33:21 
2019
@@ -16,7 +16,7 @@
 # 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 # 1: 0040111015 FUNCGLOBAL DEFAULT   10 functionInSymtab
 
-# We want to keep the symbol "functionInDynsym" in the .dynsym section and not
+# We want to keep the symbol "functionInDynsym" in the .dynamic section and not
 # have it put the default .symtab section.
 # RUN: echo "{functionInDynsym;};" > %T/dynmic-symbols.txt
 # RUN: %clang -Wl,--dynamic-list=%T/dynmic-symbols.txt -g -o %t.binary 
%p/Inputs/load-symtab-and-dynsym.c

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=371624&r1=371623&r2=371624&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Sep 11 
07:33:21 2019
@@ -2644,11 +2644,12 @@ Symtab *ObjectFileELF::GetSymtab() {
 
 // Sharable objects and dynamic executables usually have 2 distinct symbol
 // tables, one named ".symtab", and the other ".dynsym". The dynsym is a
-// smaller version of the symtab that only contains global symbols.
-// Information in the dynsym section is *usually* also found in the symtab,
-// but this is not required as symtab entries can be removed after linking.
-// The minidebuginfo format makes use of this facility to create smaller
-// symbol tables.
+// smaller version of the symtab that only contains global symbols. The
+// information found in the dynsym is therefore also found in the symtab,
+// while the reverse is not necessarily true.
+// One exception to the above rule is when we have minidebuginfo embedded
+// into a compressed .gnu_debugdata section. This section contains a 
.symtab
+// from which all symbols already contained in the .dynsym are stripped.
 Section *symtab =
 section_list->FindSectionByType(eSectionTypeELFSymbolTable, 
true).get();
 if (symtab) {


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


[Lldb-commits] [lldb] r371625 - Revert "[LLDB][ELF] Load both, .symtab and .dynsym sections"

2019-09-11 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Wed Sep 11 07:33:37 2019
New Revision: 371625

URL: http://llvm.org/viewvc/llvm-project?rev=371625&view=rev
Log:
Revert "[LLDB][ELF] Load both, .symtab and .dynsym sections"

This reverts commit 3a4781bbf4f39a25562b4c61c9a9ab2483a96b41.

Removed:
lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c
lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c
lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test
lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test
Modified:
lldb/trunk/lit/helper/toolchain.py
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Removed: lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c?rev=371624&view=auto
==
--- lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c (original)
+++ lldb/trunk/lit/Modules/ELF/Inputs/load-from-dynsym-alone.c (removed)
@@ -1,7 +0,0 @@
-// This function will be embedded within the .dynsym section of the main 
binary.
-int functionInDynsym(int num) { return num * 3; }
-
-int main(int argc, char *argv[]) {
-  int y = functionInDynsym(argc);
-  return y;
-}

Removed: lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c?rev=371624&view=auto
==
--- lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c (original)
+++ lldb/trunk/lit/Modules/ELF/Inputs/load-symtab-and-dynsym.c (removed)
@@ -1,12 +0,0 @@
-// This function will be embedded within the .symtab section of the
-// .gnu_debugdata section.
-int functionInSymtab(int num) { return num * 4; }
-
-// This function will be embedded within the .dynsym section of the main 
binary.
-int functionInDynsym(int num) { return num * 3; }
-
-int main(int argc, char *argv[]) {
-  int x = functionInSymtab(argc);
-  int y = functionInDynsym(x);
-  return y;
-}

Removed: lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test?rev=371624&view=auto
==
--- lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test (original)
+++ lldb/trunk/lit/Modules/ELF/load-from-dynsym-alone.test (removed)
@@ -1,33 +0,0 @@
-# REQUIRES: system-linux
-
-# This test ensures that we will load .dynsym even if there's no .symtab 
section.
-# We do this by compiling a small C program with a function and we direct the
-# linker where to put the symbols so that in the end the layout is as follows:
-#
-#   Symbol table '.dynsym' contains 4 entries:
-#  Num:Value  Size TypeBind   Vis  Ndx Name
-#0:  0 NOTYPE  LOCAL  DEFAULT  UND 
-#1:  0 FUNCGLOBAL DEFAULT  UND 
__libc_start_main@GLIBC_2.2.5
-#2:  0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
-#3: 0040111013 FUNCGLOBAL DEFAULT   10 functionInDynsym
-
-# We want to keep the symbol "functionInDynsym" in the .dynamic section and not
-# have it put the default .symtab section.
-# RUN: echo "{functionInDynsym;};" > %T/dynmic-symbols.txt
-# RUN: %clang -Wl,--dynamic-list=%T/dynmic-symbols.txt -g -o %t.binary 
%p/Inputs/load-from-dynsym-alone.c
-
-# Remove not needed symbols
-# RUN: echo "functionInDynsym" > %t.keep_symbols
-# RUN: llvm-objcopy --strip-all --remove-section .gdb_index --remove-section 
.comment --keep-symbols=%t.keep_symbols %t.binary
-
-# Remove functionInDynsym symbol from .symtab (will leave symbol in .dynsym 
intact)
-# RUN: llvm-strip --strip-symbol=functionInDynsym %t.binary
-
-# RUN: %lldb -b -o 'b functionInDynsym' -o 'run' -o 'continue' %t.binary | 
FileCheck %s
-
-# CHECK: (lldb) b functionInDynsym
-# CHECK-NEXT: Breakpoint 1: where = {{.*}}.binary`functionInDynsym, address = 
0x{{.*}}
-
-# CHECK: (lldb) run
-# CHECK-NEXT: Process {{.*}} stopped
-# CHECK-NEXT: * thread #1, name = 'load-from-dynsy', stop reason = breakpoint 
1.1

Removed: lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test?rev=371624&view=auto
==
--- lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test (original)
+++ lldb/trunk/lit/Modules/ELF/load-symtab-and-dynsym.test (removed)
@@ -1,48 +0,0 @@
-# REQUIRES: system-linux
-
-# This test ensures that we will load .dynsym even if there's a .symtab 
section.
-# We do this by compiling a small C program with two functions and we direct 
the
-# linker where to put the symbols so that in the end the layout is as follows:
-#
-#   Symbol table '.dynsym' contains 4 en

[Lldb-commits] [lldb] r372608 - [LLDB] Fix logically dead code

2019-09-23 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Mon Sep 23 07:05:51 2019
New Revision: 372608

URL: http://llvm.org/viewvc/llvm-project?rev=372608&view=rev
Log:
[LLDB] Fix logically dead code

Summary:
The indicated dead code may have performed some action; that action will never 
occur.

In lldb_private::LoadedModuleInfoList::LoadedModuleInfo::operator 
==(lldb_private::LoadedModuleInfoList::LoadedModuleInfo const &): Code can 
never be reached because of a logical contradiction (CWE-561)

Coverity Scan: https://scan.coverity.com/projects/kwk-llvm-project?tab=overview

CID 221581

Subscribers: lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/include/lldb/Core/LoadedModuleInfoList.h

Modified: lldb/trunk/include/lldb/Core/LoadedModuleInfoList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/LoadedModuleInfoList.h?rev=372608&r1=372607&r2=372608&view=diff
==
--- lldb/trunk/include/lldb/Core/LoadedModuleInfoList.h (original)
+++ lldb/trunk/include/lldb/Core/LoadedModuleInfoList.h Mon Sep 23 07:05:51 2019
@@ -84,9 +84,6 @@ public:
 }
 
 bool operator==(LoadedModuleInfo const &rhs) const {
-  if (e_num != rhs.e_num)
-return false;
-
   for (size_t i = 0; i < e_num; ++i) {
 if (m_has[i] != rhs.m_has[i])
   return false;


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


[Lldb-commits] [lldb] r361383 - Added a dot at the end of comment

2019-05-22 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Wed May 22 06:23:15 2019
New Revision: 361383

URL: http://llvm.org/viewvc/llvm-project?rev=361383&view=rev
Log:
Added a dot at the end of comment

Summary: to test SVN commit access with a simple change.

Reviewers: jankratochvil

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=361383&r1=361382&r2=361383&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed May 22 06:23:15 2019
@@ -4,7 +4,7 @@ if(POLICY CMP0075)
   cmake_policy(SET CMP0075 NEW)
 endif()
 
-# Add path for custom modules
+# Add path for custom modules.
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
@@ -15,7 +15,7 @@ include(LLDBStandalone)
 include(LLDBConfig)
 include(AddLLDB)
 
-# Define the LLDB_CONFIGURATION_xxx matching the build type
+# Define the LLDB_CONFIGURATION_xxx matching the build type.
 if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   add_definitions( -DLLDB_CONFIGURATION_DEBUG )
 else()
@@ -172,7 +172,7 @@ if (NOT LLDB_DISABLE_PYTHON)
 get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
 
 # Add a Post-Build Event to copy over Python files and create the symlink
-# to liblldb.so for the Python API(hardlink on Windows)
+# to liblldb.so for the Python API(hardlink on Windows).
 add_custom_target(finish_swig ALL
 COMMAND
${PYTHON_EXECUTABLE} 
${LLDB_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py


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


[Lldb-commits] [lldb] r361503 - [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

2019-05-23 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Thu May 23 08:17:39 2019
New Revision: 361503

URL: http://llvm.org/viewvc/llvm-project?rev=361503&view=rev
Log:
[lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

Summary:
On Windows `lldb::thread_result_t` resolves to `typedef unsigned 
thread_result_t;` and on other platforms it resolves to `typedef void 
*thread_result_t;`.
 Therefore one cannot use `nullptr` when returning from a function that returns 
`thread_result_t`.

I've made this change because a windows build bot fails with these errors:

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362):
 error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
```

and

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619):
 error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664):
 error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
```

This is the failing build: 
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5035/steps/build/logs/stdio

Reviewers: JDevlieghere, teemperor, jankratochvil, labath, clayborg, RKSimon, 
courbet, jhenderson

Reviewed By: labath, clayborg

Subscribers: labath, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/source/Core/Communication.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Host/common/TaskPool.cpp
lldb/trunk/source/Host/windows/HostProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp

Modified: lldb/trunk/source/Core/Communication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=361503&r1=361502&r2=361503&view=diff
==
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Thu May 23 08:17:39 2019
@@ -359,7 +359,7 @@ lldb::thread_result_t Communication::Rea
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return {};
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=361503&r1=361502&r2=361503&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu May 23 08:17:39 2019
@@ -1616,7 +1616,7 @@ void Debugger::DefaultEventHandler() {
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::StartEventHandlerThread() {
@@ -1661,7 +1661,7 @@ lldb::thread_result_t Debugger::IOHandle
   Debugger *debugger = (Debugger *)arg;
   debugger->ExecuteIOHandlers();
   debugger->StopEventHandlerThread();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); 
}

Modified: lldb/trunk/source/Host/common/TaskPool.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/TaskPool.cpp?rev=361503&r1=361502&r2=361503&view=diff
==
--- lldb/trunk/source/Host/common/TaskPool.cpp (original)
+++ lldb/trunk/source/Host/common/TaskPool.cpp Thu May 23 08:17:39 2019
@@ -73,7 +73,7 @@ void TaskPoolImpl::AddTask(std::function
 
 lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
   Worker((TaskPoolImpl *)pool);
-  return nullptr;
+  return {};
 }
 
 void TaskPoolImpl::Worker(TaskPoolImpl *pool) {

Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=361503&r1=361502&r2=361503&view=diff
==
--- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Thu May 23 08:17:39 
2019
@@ -109,7 +109,7 @@ lldb::thread_r

[Lldb-commits] [lldb] r361565 - [lldb] followup fix for https://reviews.llvm.org/D62305

2019-05-23 Thread Konrad Kleine via lldb-commits
Author: kwk
Date: Thu May 23 15:39:13 2019
New Revision: 361565

URL: http://llvm.org/viewvc/llvm-project?rev=361565&view=rev
Log:
[lldb] followup fix for https://reviews.llvm.org/D62305

Summary:
Fixing this error on windows build bot:

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 error C2440: 'initializing': cannot convert from 'nullptr' to 
'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(21):
 error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could not 
be initialized
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include\lldb/Host/HostNativeThreadBase.h(48):
 note: see declaration of 'lldb_private::HostNativeThreadBase::m_result'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 error C2440: 'initializing': cannot convert from 'nullptr' to 
'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(24):
 error C2439: 'lldb_private::HostNativeThreadBase::m_result': member could not 
be initialized
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\include\lldb/Host/HostNativeThreadBase.h(48):
 note: see declaration of 'lldb_private::HostNativeThreadBase::m_result'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(40):
 error C2440: '=': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(40):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(50):
 error C2440: '=': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Host\common\HostNativeThreadBase.cpp(50):
 note: A native nullptr can only be converted to bool or, using 
reinterpret_cast, to an integral type
```

see 
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5050/steps/build/logs/stdio

Reviewers: stella.stamenova, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/source/Host/common/HostNativeThreadBase.cpp

Modified: lldb/trunk/source/Host/common/HostNativeThreadBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostNativeThreadBase.cpp?rev=361565&r1=361564&r2=361565&view=diff
==
--- lldb/trunk/source/Host/common/HostNativeThreadBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostNativeThreadBase.cpp Thu May 23 15:39:13 
2019
@@ -18,10 +18,10 @@ using namespace lldb;
 using namespace lldb_private;
 
 HostNativeThreadBase::HostNativeThreadBase()
-: m_thread(LLDB_INVALID_HOST_THREAD), m_result(0) {}
+: m_thread(LLDB_INVALID_HOST_THREAD), m_result({}) {}
 
 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
-: m_thread(thread), m_result(0) {}
+: m_thread(thread), m_result({}) {}
 
 lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
   return m_thread;
@@ -37,7 +37,7 @@ bool HostNativeThreadBase::IsJoinable()
 
 void HostNativeThreadBase::Reset() {
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 }
 
 bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
@@ -47,7 +47,7 @@ bool HostNativeThreadBase::EqualsThread(
 lldb::thread_t HostNativeThreadBase::Release() {
   lldb::thread_t result = m_thread;
   m_thread = LLDB_INVALID_HOST_THREAD;
-  m_result = 0;
+  m_result = {};
 
   return result;
 }


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


[Lldb-commits] [lldb] 4bfa438 - [lldb] fix typo in docs: withing -> within

2020-06-24 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2020-06-24T05:19:47-04:00
New Revision: 4bfa43809fe6780159a4980cf601c504cbec6f32

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

LOG: [lldb] fix typo in docs: withing -> within

Added: 


Modified: 
lldb/docs/resources/caveats.rst

Removed: 




diff  --git a/lldb/docs/resources/caveats.rst b/lldb/docs/resources/caveats.rst
index 780fb349051b..7a77b0dce9fd 100644
--- a/lldb/docs/resources/caveats.rst
+++ b/lldb/docs/resources/caveats.rst
@@ -10,7 +10,7 @@ Python
 --
 
 LLDB has a powerful scripting interface which is accessible through Python.
-Python is available either from withing LLDB through a (interactive) script
+Python is available either from within LLDB through a (interactive) script
 interpreter, or as a Python module which you can import from the Python
 interpreter.
 



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


[Lldb-commits] [lldb] ecfa01e - [lldb] on s390x fix override issue

2020-07-10 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2020-07-10T15:11:49-04:00
New Revision: ecfa01e956a49ed349683f1cfcfbbec423114b68

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

LOG: [lldb] on s390x fix override issue

Summary:
This fixes an override issue by marking a function as const so that the
signature maps to the signature of the function in the base class.

This is the original error:

In file included from 
/root/llvm/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp:11:
/root/llvm/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h:79:10:
 error: 'size_t 
lldb_private::process_linux::NativeRegisterContextLinux_s390x::GetGPRSize()' 
marked 'override', but does not override
   79 |   size_t GetGPRSize() override { return sizeof(m_regs); }
  |  ^~

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h
index 69714e400113..5ed78810a18b 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.h
@@ -76,7 +76,7 @@ class NativeRegisterContextLinux_s390x : public 
NativeRegisterContextLinux {
   Status WriteFPR() override;
 
   void *GetGPRBuffer() override { return &m_regs; }
-  size_t GetGPRSize() override { return sizeof(m_regs); }
+  size_t GetGPRSize() const override { return sizeof(m_regs); }
   void *GetFPRBuffer() override { return &m_fp_regs; }
   size_t GetFPRSize() override { return sizeof(m_fp_regs); }
 



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


[Lldb-commits] [lldb] 373e2a4 - [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2019-11-28T14:00:38+01:00
New Revision: 373e2a4f69d623e59329ff801f261d8b299e12d2

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

LOG: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

Summary:
I found the above named method hard to read because it had

a) many nested blocks and
b) one return statement at the end with some logic involved.

I decided to refactor this function by employing an early exit strategy.
In order to capture the logic in the return statement and to not have it
repeated more than once I chose to implement a very small lamda function
that captures all the variables it needs.

This is a non-functional change (NFC).

Reviewers: jdoerfert

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Symbol/CompileUnit.h
lldb/source/API/SBThread.cpp
lldb/source/Core/AddressResolverFileLine.cpp
lldb/source/Symbol/CompileUnit.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h 
b/lldb/include/lldb/Symbol/CompileUnit.h
index 7efbf792b1a9..b5f37f678900 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -381,14 +381,11 @@ class CompileUnit : public 
std::enable_shared_from_this,
   /// A SymbolContext list class that will get any matching
   /// entries appended to.
   ///
-  /// \return
-  /// The number of new matches that were added to \a sc_list.
-  ///
   /// \see enum SymbolContext::Scope
-  uint32_t ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
-bool check_inlines, bool exact,
-lldb::SymbolContextItem resolve_scope,
-SymbolContextList &sc_list);
+  void ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
+bool check_inlines, bool exact,
+lldb::SymbolContextItem resolve_scope,
+SymbolContextList &sc_list);
 
   /// Get whether compiler optimizations were enabled for this compile unit
   ///

diff  --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 8d4930bf6edb..2dada9a6118d 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -914,9 +914,10 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
 const bool exact = false;
 
 SymbolContextList sc_list;
-const uint32_t num_matches = frame_sc.comp_unit->ResolveSymbolContext(
-step_file_spec, line, check_inlines, exact, eSymbolContextLineEntry,
-sc_list);
+frame_sc.comp_unit->ResolveSymbolContext(step_file_spec, line,
+ check_inlines, exact,
+ eSymbolContextLineEntry, sc_list);
+const uint32_t num_matches = sc_list.GetSize();
 if (num_matches > 0) {
   SymbolContext sc;
   for (uint32_t i = 0; i < num_matches; ++i) {

diff  --git a/lldb/source/Core/AddressResolverFileLine.cpp 
b/lldb/source/Core/AddressResolverFileLine.cpp
index 4a14260c6c72..4122b5d3b747 100644
--- a/lldb/source/Core/AddressResolverFileLine.cpp
+++ b/lldb/source/Core/AddressResolverFileLine.cpp
@@ -40,14 +40,13 @@ Searcher::CallbackReturn
 AddressResolverFileLine::SearchCallback(SearchFilter &filter,
 SymbolContext &context, Address *addr) 
{
   SymbolContextList sc_list;
-  uint32_t sc_list_size;
   CompileUnit *cu = context.comp_unit;
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
 
-  sc_list_size =
-  cu->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines, false,
-   eSymbolContextEverything, sc_list);
+  cu->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines, false,
+   eSymbolContextEverything, sc_list);
+  uint32_t sc_list_size = sc_list.GetSize();
   for (uint32_t i = 0; i < sc_list_size; i++) {
 SymbolContext sc;
 if (sc_list.GetContextAtIndex(i, sc)) {

diff  --git a/lldb/source/Symbol/CompileUnit.cpp 
b/lldb/source/Symbol/CompileUnit.cpp
index b37636c3bafc..62a1d690da42 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -244,11 +244,11 @@ uint32_t CompileUnit::FindLineEntry(uint32_t start_idx, 
uint32_t line,
   return UINT32_MAX;
 }
 
-uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
-   uint32_t line, bool check_inlines,
-   bool exact,
-   SymbolContextItem resolve_scope,
-   

[Lldb-commits] [lldb] c671639 - [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2019-11-28T21:37:31+01:00
New Revision: c671639af6a96c31d3c0e5487051bef28bad1640

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

LOG: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

Summary:
I found the above named method hard to read because it had

a) many nested blocks,
b) one return statement at the end with some logic involved,
c) a duplicated while-loop with just small differences in it.

I decided to refactor this function by employing an early exit strategy.
In order to capture the logic in the return statement and to not have it
repeated more than once I chose to implement a very small lamda function
that captures all the variables it needs.
I also replaced the two while-loops with just one.

This is a non-functional change (NFC).

Reviewers: jdoerfert, teemperor

Reviewed By: teemperor

Subscribers: labath, teemperor, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Symbol/CompileUnit.h
lldb/source/API/SBThread.cpp
lldb/source/Core/AddressResolverFileLine.cpp
lldb/source/Symbol/CompileUnit.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h 
b/lldb/include/lldb/Symbol/CompileUnit.h
index 7efbf792b1a9..b5f37f678900 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -381,14 +381,11 @@ class CompileUnit : public 
std::enable_shared_from_this,
   /// A SymbolContext list class that will get any matching
   /// entries appended to.
   ///
-  /// \return
-  /// The number of new matches that were added to \a sc_list.
-  ///
   /// \see enum SymbolContext::Scope
-  uint32_t ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
-bool check_inlines, bool exact,
-lldb::SymbolContextItem resolve_scope,
-SymbolContextList &sc_list);
+  void ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
+bool check_inlines, bool exact,
+lldb::SymbolContextItem resolve_scope,
+SymbolContextList &sc_list);
 
   /// Get whether compiler optimizations were enabled for this compile unit
   ///

diff  --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 8d4930bf6edb..2dada9a6118d 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -914,9 +914,10 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
 const bool exact = false;
 
 SymbolContextList sc_list;
-const uint32_t num_matches = frame_sc.comp_unit->ResolveSymbolContext(
-step_file_spec, line, check_inlines, exact, eSymbolContextLineEntry,
-sc_list);
+frame_sc.comp_unit->ResolveSymbolContext(step_file_spec, line,
+ check_inlines, exact,
+ eSymbolContextLineEntry, sc_list);
+const uint32_t num_matches = sc_list.GetSize();
 if (num_matches > 0) {
   SymbolContext sc;
   for (uint32_t i = 0; i < num_matches; ++i) {

diff  --git a/lldb/source/Core/AddressResolverFileLine.cpp 
b/lldb/source/Core/AddressResolverFileLine.cpp
index 4a14260c6c72..4122b5d3b747 100644
--- a/lldb/source/Core/AddressResolverFileLine.cpp
+++ b/lldb/source/Core/AddressResolverFileLine.cpp
@@ -40,14 +40,13 @@ Searcher::CallbackReturn
 AddressResolverFileLine::SearchCallback(SearchFilter &filter,
 SymbolContext &context, Address *addr) 
{
   SymbolContextList sc_list;
-  uint32_t sc_list_size;
   CompileUnit *cu = context.comp_unit;
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
 
-  sc_list_size =
-  cu->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines, false,
-   eSymbolContextEverything, sc_list);
+  cu->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines, false,
+   eSymbolContextEverything, sc_list);
+  uint32_t sc_list_size = sc_list.GetSize();
   for (uint32_t i = 0; i < sc_list_size; i++) {
 SymbolContext sc;
 if (sc_list.GetContextAtIndex(i, sc)) {

diff  --git a/lldb/source/Symbol/CompileUnit.cpp 
b/lldb/source/Symbol/CompileUnit.cpp
index b37636c3bafc..82074367ec8f 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -244,11 +244,11 @@ uint32_t CompileUnit::FindLineEntry(uint32_t start_idx, 
uint32_t line,
   return UINT32_MAX;
 }
 
-uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
-   uint32_t line, bool check_inlines,
-

[Lldb-commits] [lldb] 51ce067 - [lldb] NFC: less nesting in SearchFilter.cpp

2019-12-05 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2019-12-06T08:38:33+01:00
New Revision: 51ce067a442ee6381527b12d113f51906b0245a8

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

LOG: [lldb] NFC: less nesting in SearchFilter.cpp

I was working on SearchFilter.cpp and felt it a bit too complex in some cases 
in terms of nesting and logic flow.

Reviewers: teemperor, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/source/Core/SearchFilter.cpp

Removed: 




diff  --git a/lldb/source/Core/SearchFilter.cpp 
b/lldb/source/Core/SearchFilter.cpp
index 077aa8967425..9902166be522 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -208,10 +208,12 @@ void SearchFilter::Search(Searcher &searcher) {
 return;
   empty_sc.target_sp = m_target_sp;
 
-  if (searcher.GetDepth() == lldb::eSearchDepthTarget)
+  if (searcher.GetDepth() == lldb::eSearchDepthTarget) {
 searcher.SearchCallback(*this, empty_sc, nullptr);
-  else
-DoModuleIteration(empty_sc, searcher);
+return;
+  }
+  
+  DoModuleIteration(empty_sc, searcher);
 }
 
 void SearchFilter::SearchInModuleList(Searcher &searcher, ModuleList &modules) 
{
@@ -221,20 +223,20 @@ void SearchFilter::SearchInModuleList(Searcher &searcher, 
ModuleList &modules) {
 return;
   empty_sc.target_sp = m_target_sp;
 
-  if (searcher.GetDepth() == lldb::eSearchDepthTarget)
+  if (searcher.GetDepth() == lldb::eSearchDepthTarget) {
 searcher.SearchCallback(*this, empty_sc, nullptr);
-  else {
-std::lock_guard guard(modules.GetMutex());
-const size_t numModules = modules.GetSize();
-
-for (size_t i = 0; i < numModules; i++) {
-  ModuleSP module_sp(modules.GetModuleAtIndexUnlocked(i));
-  if (ModulePasses(module_sp)) {
-if (DoModuleIteration(module_sp, searcher) ==
-Searcher::eCallbackReturnStop)
-  return;
-  }
-}
+return;
+  }
+
+  std::lock_guard guard(modules.GetMutex());
+  const size_t numModules = modules.GetSize();
+
+  for (size_t i = 0; i < numModules; i++) {
+ModuleSP module_sp(modules.GetModuleAtIndexUnlocked(i));
+if (!ModulePasses(module_sp))
+  continue;
+if (DoModuleIteration(module_sp, searcher) == 
Searcher::eCallbackReturnStop)
+  return;
   }
 }
 
@@ -248,45 +250,47 @@ SearchFilter::DoModuleIteration(const lldb::ModuleSP 
&module_sp,
 Searcher::CallbackReturn
 SearchFilter::DoModuleIteration(const SymbolContext &context,
 Searcher &searcher) {
-  if (searcher.GetDepth() >= lldb::eSearchDepthModule) {
-if (context.module_sp) {
-  if (searcher.GetDepth() == lldb::eSearchDepthModule) {
-SymbolContext matchingContext(context.module_sp.get());
-searcher.SearchCallback(*this, matchingContext, nullptr);
-  } else {
-return DoCUIteration(context.module_sp, context, searcher);
-  }
+  if (searcher.GetDepth() < lldb::eSearchDepthModule)
+return Searcher::eCallbackReturnContinue;
+
+  if (context.module_sp) {
+if (searcher.GetDepth() != lldb::eSearchDepthModule)
+  return DoCUIteration(context.module_sp, context, searcher);
+
+SymbolContext matchingContext(context.module_sp.get());
+searcher.SearchCallback(*this, matchingContext, nullptr);
+return Searcher::eCallbackReturnContinue;
+  }
+
+  const ModuleList &target_images = m_target_sp->GetImages();
+  std::lock_guard guard(target_images.GetMutex());
+
+  size_t n_modules = target_images.GetSize();
+  for (size_t i = 0; i < n_modules; i++) {
+// If this is the last level supplied, then call the callback directly,
+// otherwise descend.
+ModuleSP module_sp(target_images.GetModuleAtIndexUnlocked(i));
+if (!ModulePasses(module_sp))
+  continue;
+
+if (searcher.GetDepth() == lldb::eSearchDepthModule) {
+  SymbolContext matchingContext(m_target_sp, module_sp);
+
+  Searcher::CallbackReturn shouldContinue =
+  searcher.SearchCallback(*this, matchingContext, nullptr);
+  if (shouldContinue == Searcher::eCallbackReturnStop ||
+  shouldContinue == Searcher::eCallbackReturnPop)
+return shouldContinue;
 } else {
-  const ModuleList &target_images = m_target_sp->GetImages();
-  std::lock_guard guard(target_images.GetMutex());
-
-  size_t n_modules = target_images.GetSize();
-  for (size_t i = 0; i < n_modules; i++) {
-// If this is the last level supplied, then call the callback directly,
-// otherwise descend.
-ModuleSP module_sp(target_images.GetModuleAtIndexUnlocked(i));
-if (!ModulePasses(module_sp))
-  continue;
-
-if (searcher.GetDepth() == lldb::eSearchDepthModule) {
-  Sy

[Lldb-commits] [lldb] b89131c - [lldb] removed no longer needed CMakeDependentOption

2020-02-07 Thread Konrad Kleine via lldb-commits

Author: Konrad Kleine
Date: 2020-02-07T09:23:35+01:00
New Revision: b89131cdda5871731a9139664aef2b70c6d72bbd

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

LOG: [lldb] removed no longer needed CMakeDependentOption

Summary:
In D66791 I've introduced this [[ 
https://cmake.org/cmake/help/latest/module/CMakeDependentOption.html | 
`CMakeDependentOption` ]] but in
D71306 @JDevlieghere has changed the way optional dependencies
are handled in LLDB. Today there's no occurence of
`cmake_dependent_option` inside the lldb source tree.

That's why this include can be removed.

Reviewers: JDevlieghere, labath

Reviewed By: labath

Subscribers: labath, mgorny, lldb-commits, JDevlieghere

Tags: #lldb

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

Added: 


Modified: 
lldb/cmake/modules/LLDBConfig.cmake

Removed: 




diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 4a15a343ee1d..fb4512a87998 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -1,6 +1,5 @@
 include(CheckCXXSymbolExists)
 include(CheckTypeSize)
-include(CMakeDependentOption)
 
 set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")



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