[Lldb-commits] [PATCH] D69309: Support template instantiation in the expression evaluator

2019-11-28 Thread Vassil Vassilev via Phabricator via lldb-commits
v.g.vassilev added a comment.

https://reviews.llvm.org/D41416 could be relevant. I am not an expert but I 
think when reading the DWARF you could only register 'lazy' specializations 
which will be imported only when really required.


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

https://reviews.llvm.org/D69309



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


[Lldb-commits] [PATCH] D70774: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc671639af6a9: [lldb] NFC: refactor 
CompileUnit::ResolveSymbolContext (authored by kwk).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70774

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

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -244,11 +244,11 @@
   return UINT32_MAX;
 }
 
-uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
-   uint32_t line, bool check_inlines,
-   bool exact,
-   SymbolContextItem resolve_scope,
-   SymbolContextList &sc_list) {
+void CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
+   uint32_t line, bool check_inlines,
+   bool exact,
+   SymbolContextItem resolve_scope,
+   SymbolContextList &sc_list) {
   // First find all of the file indexes that match our "file_spec". If
   // "file_spec" has an empty directory, then only compare the basenames when
   // finding file indexes
@@ -260,7 +260,7 @@
   // If we are not looking for inlined functions and our file spec doesn't
   // match then we are done...
   if (!file_spec_matches_cu_file_spec && !check_inlines)
-return 0;
+return;
 
   uint32_t file_idx =
   GetSupportFiles().FindFileIndex(1, file_spec, true);
@@ -271,84 +271,67 @@
 
   const size_t num_file_indexes = file_indexes.size();
   if (num_file_indexes == 0)
-return 0;
-
-  const uint32_t prev_size = sc_list.GetSize();
+return;
 
   SymbolContext sc(GetModule());
   sc.comp_unit = this;
 
-  if (line != 0) {
-LineTable *line_table = sc.comp_unit->GetLineTable();
-
-if (line_table != nullptr) {
-  uint32_t found_line;
-  uint32_t line_idx;
-
-  if (num_file_indexes == 1) {
-// We only have a single support file that matches, so use the line
-// table function that searches for a line entries that match a single
-// support file index
-LineEntry line_entry;
-line_idx = line_table->FindLineEntryIndexByFileIndex(
-0, file_indexes.front(), line, exact, &line_entry);
-
-// If "exact == true", then "found_line" will be the same as "line". If
-// "exact == false", the "found_line" will be the closest line entry
-// with a line number greater than "line" and we will use this for our
-// subsequent line exact matches below.
-found_line = line_entry.line;
-
-while (line_idx != UINT32_MAX) {
-  // If they only asked for the line entry, then we're done, we can
-  // just copy that over. But if they wanted more than just the line
-  // number, fill it in.
-  if (resolve_scope == eSymbolContextLineEntry) {
-sc.line_entry = line_entry;
-  } else {
-line_entry.range.GetBaseAddress().CalculateSymbolContext(
-&sc, resolve_scope);
-  }
-
-  sc_list.Append(sc);
-  line_idx = line_table->FindLineEntryIndexByFileIndex(
-  line_idx + 1, file_indexes.front(), found_line, true,
-  &line_entry);
-}
-  } else {
-// We found multiple support files that match "file_spec" so use the
-// line table function that searches for a line entries that match a
-// multiple support file indexes.
-LineEntry line_entry;
-line_idx = line_table->FindLineEntryIndexByFileIndex(
-0, file_indexes, line, exact, &line_entry);
-
-// If "exact == true", then "found_line" will be the same as "line". If
-// "exact == false", the "found_line" will be the closest line entry
-// with a line number greater than "line" and we will use this for our
-// subsequent line exact matches below.
-found_line = line_entry.line;
-
-while (line_idx != UINT32_MAX) {
-  if (resolve_scope == eSymbolContextLineEntry) {
-sc.line_entry = line_entry;
-  } else {
-line_entry.range.GetBaseAddress().CalculateSymbolContext(
-&sc, resolve_scope);
-  }
-
-  sc_list.Append(sc);
-  line_idx = line_table->FindLineEntryIndexByFileIndex(
-  line_idx + 1, file_indexes, found_line, true, &line_entry);
-}
-  }
+  if (line == 0) {
+if (file_spec_matches_cu_file_spec && !check_inlines) {
+  // only append the context i

[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] [PATCH] D70442: [LLDB] Force message formatting to English

2019-11-28 Thread Alexandre Ganea via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbdad3ec75ab3: [LLDB] On Windows, force error message 
formatting to English (authored by aganea).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70442

Files:
  lldb/source/Utility/Status.cpp


Index: lldb/source/Utility/Status.cpp
===
--- lldb/source/Utility/Status.cpp
+++ lldb/source/Utility/Status.cpp
@@ -100,14 +100,23 @@
   char *buffer = nullptr;
   std::string message;
   // Retrieve win32 system error.
+  // First, attempt to load a en-US message
   if (::FormatMessageA(
   FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
   FORMAT_MESSAGE_MAX_WIDTH_MASK,
-  NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+  NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
   (LPSTR)&buffer, 0, NULL)) {
 message.assign(buffer);
 ::LocalFree(buffer);
   }
+  // If the previous didn't work, use the default OS language
+  else if (::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+FORMAT_MESSAGE_FROM_SYSTEM |
+FORMAT_MESSAGE_MAX_WIDTH_MASK,
+NULL, error_code, 0, (LPSTR)&buffer, 0, NULL)) {
+message.assign(buffer);
+::LocalFree(buffer);
+  }
   return message;
 }
 #endif


Index: lldb/source/Utility/Status.cpp
===
--- lldb/source/Utility/Status.cpp
+++ lldb/source/Utility/Status.cpp
@@ -100,14 +100,23 @@
   char *buffer = nullptr;
   std::string message;
   // Retrieve win32 system error.
+  // First, attempt to load a en-US message
   if (::FormatMessageA(
   FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
   FORMAT_MESSAGE_MAX_WIDTH_MASK,
-  NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+  NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
   (LPSTR)&buffer, 0, NULL)) {
 message.assign(buffer);
 ::LocalFree(buffer);
   }
+  // If the previous didn't work, use the default OS language
+  else if (::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+FORMAT_MESSAGE_FROM_SYSTEM |
+FORMAT_MESSAGE_MAX_WIDTH_MASK,
+NULL, error_code, 0, (LPSTR)&buffer, 0, NULL)) {
+message.assign(buffer);
+::LocalFree(buffer);
+  }
   return message;
 }
 #endif
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] bdad3ec - [LLDB] On Windows, force error message formatting to English

2019-11-28 Thread Alexandre Ganea via lldb-commits

Author: Alexandre Ganea
Date: 2019-11-28T14:15:13-05:00
New Revision: bdad3ec75ab35ade2433b1278689d483dcf9abc4

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

LOG: [LLDB] On Windows, force error message formatting to English

This fixes the Utility/StatusTest.ErrorWin32 unit test on non-English locales.

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

Added: 


Modified: 
lldb/source/Utility/Status.cpp

Removed: 




diff  --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp
index 3b5094d64b75..b74db72773dd 100644
--- a/lldb/source/Utility/Status.cpp
+++ b/lldb/source/Utility/Status.cpp
@@ -100,14 +100,23 @@ static std::string RetrieveWin32ErrorString(uint32_t 
error_code) {
   char *buffer = nullptr;
   std::string message;
   // Retrieve win32 system error.
+  // First, attempt to load a en-US message
   if (::FormatMessageA(
   FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
   FORMAT_MESSAGE_MAX_WIDTH_MASK,
-  NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+  NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
   (LPSTR)&buffer, 0, NULL)) {
 message.assign(buffer);
 ::LocalFree(buffer);
   }
+  // If the previous didn't work, use the default OS language
+  else if (::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+FORMAT_MESSAGE_FROM_SYSTEM |
+FORMAT_MESSAGE_MAX_WIDTH_MASK,
+NULL, error_code, 0, (LPSTR)&buffer, 0, NULL)) {
+message.assign(buffer);
+::LocalFree(buffer);
+  }
   return message;
 }
 #endif



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


[Lldb-commits] [PATCH] D70830: [LLDB] Disable MSVC warning C4190

2019-11-28 Thread Alexandre Ganea via Phabricator via lldb-commits
aganea updated this revision to Diff 231455.

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

https://reviews.llvm.org/D70830

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp


Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -62,6 +62,14 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP &sb_frame,
@@ -70,6 +78,10 @@
   return false;
 }
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -77,11 +77,23 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP &sb_frame,
 const lldb::BreakpointLocationSP &sb_bp_loc, StructuredDataImpl 
*args_impl);
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(


Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -62,6 +62,14 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP &sb_frame,
@@ -70,6 +78,10 @@
   return false;
 }
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -77,11 +77,23 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP &sb_frame,
 const lldb::BreakpointLocationSP &sb_bp_loc, StructuredDataImpl *args_impl);
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70448: [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

2019-11-28 Thread Alexandre Ganea via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb4dfc5508f92: [LLDB] Fix wrong argument in 
CommandObjectThreadStepWithTypeAndScope (authored by aganea).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70448

Files:
  lldb/source/Commands/CommandObjectThread.cpp


Index: lldb/source/Commands/CommandObjectThread.cpp
===
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -526,7 +526,7 @@
 eCommandProcessMustBeLaunched |
 eCommandProcessMustBePaused),
 m_step_type(step_type), m_step_scope(step_scope), m_options(),
-m_class_options("scripted step", 'C') {
+m_class_options("scripted step") {
 CommandArgumentEntry arg;
 CommandArgumentData thread_id_arg;
 


Index: lldb/source/Commands/CommandObjectThread.cpp
===
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -526,7 +526,7 @@
 eCommandProcessMustBeLaunched |
 eCommandProcessMustBePaused),
 m_step_type(step_type), m_step_scope(step_scope), m_options(),
-m_class_options("scripted step", 'C') {
+m_class_options("scripted step") {
 CommandArgumentEntry arg;
 CommandArgumentData thread_id_arg;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] b4dfc55 - [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

2019-11-28 Thread Alexandre Ganea via lldb-commits

Author: Alexandre Ganea
Date: 2019-11-28T14:00:56-05:00
New Revision: b4dfc5508f9239f50a3c44dd64e82a488b698b29

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

LOG: [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

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

Added: 


Modified: 
lldb/source/Commands/CommandObjectThread.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectThread.cpp 
b/lldb/source/Commands/CommandObjectThread.cpp
index c93bd9d5c232..a74eec01933b 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -526,7 +526,7 @@ class CommandObjectThreadStepWithTypeAndScope : public 
CommandObjectParsed {
 eCommandProcessMustBeLaunched |
 eCommandProcessMustBePaused),
 m_step_type(step_type), m_step_scope(step_scope), m_options(),
-m_class_options("scripted step", 'C') {
+m_class_options("scripted step") {
 CommandArgumentEntry arg;
 CommandArgumentData thread_id_arg;
 



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


[Lldb-commits] [PATCH] D70830: [LLDB] Disable MSVC warning C4190

2019-11-28 Thread Alexandre Ganea via Phabricator via lldb-commits
aganea created this revision.
aganea added reviewers: JDevlieghere, lawrence_danna.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Before this patch, when compiling with MSVC 15.9.17 (latest), we would see:

  
F:\llvm-project\lldb\source\Plugins\ScriptInterpreter\Python\ScriptInterpreterPython.cpp(83):
 warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has C-linkage 
specified, but returns UDT 'llvm::Expected' which is incompatible with C


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70830

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -77,11 +77,23 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP &sb_frame,
 const lldb::BreakpointLocationSP &sb_bp_loc, StructuredDataImpl 
*args_impl);
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -77,11 +77,23 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
 
+// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
+// C-linkage specified, but returns UDT 'llvm::Expected' which is
+// incompatible with C
+#if _MSC_VER
+#pragma warning (push)
+#pragma warning (disable : 4190)
+#endif
+
 extern "C" llvm::Expected LLDBSwigPythonBreakpointCallbackFunction(
 const char *python_function_name, const char *session_dictionary_name,
 const lldb::StackFrameSP &sb_frame,
 const lldb::BreakpointLocationSP &sb_bp_loc, StructuredDataImpl *args_impl);
 
+#if _MSC_VER
+#pragma warning (pop)
+#endif
+
 #pragma clang diagnostic pop
 
 extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70774: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk planned changes to this revision.
kwk added a comment.

Running tests locally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70774



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


[Lldb-commits] [PATCH] D70774: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk updated this revision to Diff 231440.
kwk added a comment.

- Fixed logic error


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70774

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

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -244,11 +244,11 @@
   return UINT32_MAX;
 }
 
-uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
-   uint32_t line, bool check_inlines,
-   bool exact,
-   SymbolContextItem resolve_scope,
-   SymbolContextList &sc_list) {
+void CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
+   uint32_t line, bool check_inlines,
+   bool exact,
+   SymbolContextItem resolve_scope,
+   SymbolContextList &sc_list) {
   // First find all of the file indexes that match our "file_spec". If
   // "file_spec" has an empty directory, then only compare the basenames when
   // finding file indexes
@@ -260,7 +260,7 @@
   // If we are not looking for inlined functions and our file spec doesn't
   // match then we are done...
   if (!file_spec_matches_cu_file_spec && !check_inlines)
-return 0;
+return;
 
   uint32_t file_idx =
   GetSupportFiles().FindFileIndex(1, file_spec, true);
@@ -271,84 +271,67 @@
 
   const size_t num_file_indexes = file_indexes.size();
   if (num_file_indexes == 0)
-return 0;
-
-  const uint32_t prev_size = sc_list.GetSize();
+return;
 
   SymbolContext sc(GetModule());
   sc.comp_unit = this;
 
-  if (line != 0) {
-LineTable *line_table = sc.comp_unit->GetLineTable();
-
-if (line_table != nullptr) {
-  uint32_t found_line;
-  uint32_t line_idx;
-
-  if (num_file_indexes == 1) {
-// We only have a single support file that matches, so use the line
-// table function that searches for a line entries that match a single
-// support file index
-LineEntry line_entry;
-line_idx = line_table->FindLineEntryIndexByFileIndex(
-0, file_indexes.front(), line, exact, &line_entry);
-
-// If "exact == true", then "found_line" will be the same as "line". If
-// "exact == false", the "found_line" will be the closest line entry
-// with a line number greater than "line" and we will use this for our
-// subsequent line exact matches below.
-found_line = line_entry.line;
-
-while (line_idx != UINT32_MAX) {
-  // If they only asked for the line entry, then we're done, we can
-  // just copy that over. But if they wanted more than just the line
-  // number, fill it in.
-  if (resolve_scope == eSymbolContextLineEntry) {
-sc.line_entry = line_entry;
-  } else {
-line_entry.range.GetBaseAddress().CalculateSymbolContext(
-&sc, resolve_scope);
-  }
-
-  sc_list.Append(sc);
-  line_idx = line_table->FindLineEntryIndexByFileIndex(
-  line_idx + 1, file_indexes.front(), found_line, true,
-  &line_entry);
-}
-  } else {
-// We found multiple support files that match "file_spec" so use the
-// line table function that searches for a line entries that match a
-// multiple support file indexes.
-LineEntry line_entry;
-line_idx = line_table->FindLineEntryIndexByFileIndex(
-0, file_indexes, line, exact, &line_entry);
-
-// If "exact == true", then "found_line" will be the same as "line". If
-// "exact == false", the "found_line" will be the closest line entry
-// with a line number greater than "line" and we will use this for our
-// subsequent line exact matches below.
-found_line = line_entry.line;
-
-while (line_idx != UINT32_MAX) {
-  if (resolve_scope == eSymbolContextLineEntry) {
-sc.line_entry = line_entry;
-  } else {
-line_entry.range.GetBaseAddress().CalculateSymbolContext(
-&sc, resolve_scope);
-  }
-
-  sc_list.Append(sc);
-  line_idx = line_table->FindLineEntryIndexByFileIndex(
-  line_idx + 1, file_indexes, found_line, true, &line_entry);
-}
-  }
+  if (line == 0) {
+if (file_spec_matches_cu_file_spec && !check_inlines) {
+  // only append the context if we aren't looking for inline call sites by
+  // file and line and if the file spec matches

[Lldb-commits] [PATCH] D70827: [lldb] Remove FileSpec->CompileUnit inheritance

2019-11-28 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 231438.
labath added a comment.

- add doxygen for the new member
- avoid using the magic pointer constructor in SearchFilter.cpp


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70827

Files:
  lldb/include/lldb/Symbol/CompileUnit.h
  lldb/source/API/SBCompileUnit.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
  lldb/source/Commands/CommandCompletions.cpp
  lldb/source/Commands/CommandObjectSource.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Core/FileLineResolver.cpp
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/SearchFilter.cpp
  lldb/source/Core/SourceManager.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/SymbolContext.cpp
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -549,7 +549,8 @@
 CompUnitSP CU;
 for (size_t Ind = 0; !CU && Ind < Module.GetNumCompileUnits(); ++Ind) {
   CompUnitSP Candidate = Module.GetCompileUnitAtIndex(Ind);
-  if (!Candidate || Candidate->GetFilename().GetStringRef() != File)
+  if (!Candidate ||
+  Candidate->GetPrimaryFile().GetFilename().GetStringRef() != File)
 continue;
   if (CU)
 return make_string_error("Multiple compile units for file `{0}` found.",
@@ -653,7 +654,8 @@
 if (!comp_unit)
   return make_string_error("Connot parse compile unit {0}.", i);
 
-outs() << "Processing '" << comp_unit->GetFilename().AsCString()
+outs() << "Processing '"
+   << comp_unit->GetPrimaryFile().GetFilename().AsCString()
<< "' compile unit.\n";
 
 LineTable *lt = comp_unit->GetLineTable();
Index: lldb/source/Symbol/SymbolContext.cpp
===
--- lldb/source/Symbol/SymbolContext.cpp
+++ lldb/source/Symbol/SymbolContext.cpp
@@ -316,7 +316,7 @@
   *s << "CompileUnit  = " << comp_unit;
   if (comp_unit != nullptr)
 s->Format(" {{{0:x-16}} {1}", comp_unit->GetID(),
-  *static_cast(comp_unit));
+  comp_unit->GetPrimaryFile());
   s->EOL();
   s->Indent();
   *s << "Function = " << function;
@@ -1055,7 +1055,8 @@
   // Next check the comp unit, but only if the SymbolContext was not
   // inlined.
   if (!was_inlined && sc.comp_unit != nullptr) {
-if (!FileSpec::Equal(*(sc.comp_unit), *(m_file_spec_up.get()), false))
+if (!FileSpec::Equal(sc.comp_unit->GetPrimaryFile(), *m_file_spec_up,
+ false))
   return false;
   }
 }
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -340,7 +340,8 @@
   "error: unable to find module "
   "shared pointer for function '%s' "
   "in %s\n",
-  GetName().GetCString(), m_comp_unit->GetPath().c_str());
+  GetName().GetCString(),
+  m_comp_unit->GetPrimaryFile().GetPath().c_str());
 }
 m_block.SetBlockInfoHasBeenParsed(true, true);
   }
Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -21,30 +21,21 @@
  const char *pathname, const lldb::user_id_t cu_sym_id,
  lldb::LanguageType language,
  lldb_private::LazyBool is_optimized)
-: ModuleChild(module_sp), FileSpec(pathname), UserID(cu_sym_id),
-  m_user_data(user_data), m_language(language), m_flags(0),
-  m_support_files(), m_line_table_up(), m_variables(),
-  m_is_optimized(is_optimized) {
-  if (language != eLanguageTypeUnknown)
-m_flags.Set(flagsParsedLanguage);
-  assert(module_sp);
-}
+: CompileUnit(module_sp, user_data, FileSpec(pathname), cu_sym_id, language,
+  is_optimized) {}
 
 CompileUnit::CompileUnit(const lldb::ModuleSP &module_sp, void *user_data,
  const FileSpec &fspec, const lldb::user_id_t cu_sym_id,
  lldb::LanguageType language,
  lldb_private::LazyBool is_optimized)
-: ModuleChild(m

[Lldb-commits] [PATCH] D70774: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk reopened this revision.
kwk added a comment.
This revision is now accepted and ready to land.

Reopening because I did find the logic error.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70774



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


[Lldb-commits] [PATCH] D70827: [lldb] Remove FileSpec->CompileUnit inheritance

2019-11-28 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 2 inline comments as done.
labath added inline comments.



Comment at: lldb/source/Commands/CommandObjectThread.cpp:1196
 start_idx_ptr = sc.comp_unit->FindLineEntry(
-start_idx_ptr, line_number, sc.comp_unit, exact, &line_entry);
+start_idx_ptr, line_number, nullptr, exact, &line_entry);
 if (start_idx_ptr == UINT32_MAX)

The reason the is equivalent is a bit unobvious. CompileUnit::FindLineEntry 
will automatically pick the primary file (the support file at index zero) if 
this argument is null.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp:607
   for (uint32_t i = 0; i < cu_count; ++i) {
-if (comp_unit == m_compile_unit_infos[i].compile_unit_sp.get())
+if (&comp_unit == m_compile_unit_infos[i].compile_unit_sp.get())
   return &m_compile_unit_infos[i];

This used to be a pointer comparison, until the type of comp_unit was changed 
to a reference in D56564, and the whole thing still miraculously compiled.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70827



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


[Lldb-commits] [PATCH] D70827: [lldb] Remove FileSpec->CompileUnit inheritance

2019-11-28 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: teemperor, JDevlieghere.
Herald added a reviewer: jdoerfert.
Herald added a project: LLDB.
labath marked 2 inline comments as done.
labath added inline comments.



Comment at: lldb/source/Commands/CommandObjectThread.cpp:1196
 start_idx_ptr = sc.comp_unit->FindLineEntry(
-start_idx_ptr, line_number, sc.comp_unit, exact, &line_entry);
+start_idx_ptr, line_number, nullptr, exact, &line_entry);
 if (start_idx_ptr == UINT32_MAX)

The reason the is equivalent is a bit unobvious. CompileUnit::FindLineEntry 
will automatically pick the primary file (the support file at index zero) if 
this argument is null.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp:607
   for (uint32_t i = 0; i < cu_count; ++i) {
-if (comp_unit == m_compile_unit_infos[i].compile_unit_sp.get())
+if (&comp_unit == m_compile_unit_infos[i].compile_unit_sp.get())
   return &m_compile_unit_infos[i];

This used to be a pointer comparison, until the type of comp_unit was changed 
to a reference in D56564, and the whole thing still miraculously compiled.


CompileUnit is a complicated class. Having it be implicitly convertible
to a FileSpec makes reasoning about it even harder.

This patch replaces the inheritance by a simple member and an accessor
function. This avoid the need for casting in places where one needed to
force a CompileUnit to be treated as a FileSpec, and does not add much
verbosity elsewhere.

It also fixes a bug where we were wrongly comparing CompileUnit& and a
CompileUnit*, which compiled due to a combination of this inheritance
and the FileSpec*->FileSpec implicit constructor.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70827

Files:
  lldb/include/lldb/Symbol/CompileUnit.h
  lldb/source/API/SBCompileUnit.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
  lldb/source/Commands/CommandCompletions.cpp
  lldb/source/Commands/CommandObjectSource.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Core/FileLineResolver.cpp
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/SearchFilter.cpp
  lldb/source/Core/SourceManager.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/SymbolContext.cpp
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -549,7 +549,8 @@
 CompUnitSP CU;
 for (size_t Ind = 0; !CU && Ind < Module.GetNumCompileUnits(); ++Ind) {
   CompUnitSP Candidate = Module.GetCompileUnitAtIndex(Ind);
-  if (!Candidate || Candidate->GetFilename().GetStringRef() != File)
+  if (!Candidate ||
+  Candidate->GetPrimaryFile().GetFilename().GetStringRef() != File)
 continue;
   if (CU)
 return make_string_error("Multiple compile units for file `{0}` found.",
@@ -653,7 +654,8 @@
 if (!comp_unit)
   return make_string_error("Connot parse compile unit {0}.", i);
 
-outs() << "Processing '" << comp_unit->GetFilename().AsCString()
+outs() << "Processing '"
+   << comp_unit->GetPrimaryFile().GetFilename().AsCString()
<< "' compile unit.\n";
 
 LineTable *lt = comp_unit->GetLineTable();
Index: lldb/source/Symbol/SymbolContext.cpp
===
--- lldb/source/Symbol/SymbolContext.cpp
+++ lldb/source/Symbol/SymbolContext.cpp
@@ -316,7 +316,7 @@
   *s << "CompileUnit  = " << comp_unit;
   if (comp_unit != nullptr)
 s->Format(" {{{0:x-16}} {1}", comp_unit->GetID(),
-  *static_cast(comp_unit));
+  comp_unit->GetPrimaryFile());
   s->EOL();
   s->Indent();
   *s << "Function = " << function;
@@ -1055,7 +1055,8 @@
   // Next check the comp unit, but only if the SymbolContext was not
   // inlined.
   if (!was_inlined && sc.comp_unit != nullptr) {
-if (!FileSpec::Equal(*(sc.comp_unit), *(m_file_spec_up.get()), false))
+if (!FileSpec::Equal(sc.comp_unit->GetPrimaryFile(), *m_file_spec_up,
+ false))
   return false;
   }
 }
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -340,7 +340,8 @@
  

[Lldb-commits] [lldb] c2dd84e - [lldb][NFC] Remove CompilerDeclContext::IsClang

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

Author: Raphael Isemann
Date: 2019-11-28T15:54:11+01:00
New Revision: c2dd84e396d091ca61b06b59c622b444ffc17234

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

LOG: [lldb][NFC] Remove CompilerDeclContext::IsClang

This method is only used in ClangASTContext.

Also removes the includes we only needed for the ClangASTContext RTTI check
in the CompilerDecl[Context].cpp files.

Added: 


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

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerDeclContext.h 
b/lldb/include/lldb/Symbol/CompilerDeclContext.h
index c140a3df13d0..fe8539ab30e6 100644
--- a/lldb/include/lldb/Symbol/CompilerDeclContext.h
+++ b/lldb/include/lldb/Symbol/CompilerDeclContext.h
@@ -38,8 +38,6 @@ class CompilerDeclContext {
 return m_type_system != nullptr && m_opaque_decl_ctx != nullptr;
   }
 
-  bool IsClang() const;
-
   std::vector FindDeclByName(ConstString name,
const bool ignore_using_decls);
 

diff  --git a/lldb/source/Symbol/ClangASTContext.cpp 
b/lldb/source/Symbol/ClangASTContext.cpp
index e413029f0300..e70b005550d1 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -10199,16 +10199,20 @@ bool ClangASTContext::DeclContextIsContainedInLookup(
   return false;
 }
 
+static bool IsClangDeclContext(const CompilerDeclContext &dc) {
+  return dc.IsValid() && isa(dc.GetTypeSystem());
+}
+
 clang::DeclContext *
 ClangASTContext::DeclContextGetAsDeclContext(const CompilerDeclContext &dc) {
-  if (dc.IsClang())
+  if (IsClangDeclContext(dc))
 return (clang::DeclContext *)dc.GetOpaqueDeclContext();
   return nullptr;
 }
 
 ObjCMethodDecl *
 ClangASTContext::DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc) 
{
-  if (dc.IsClang())
+  if (IsClangDeclContext(dc))
 return llvm::dyn_cast(
 (clang::DeclContext *)dc.GetOpaqueDeclContext());
   return nullptr;
@@ -10216,7 +10220,7 @@ ClangASTContext::DeclContextGetAsObjCMethodDecl(const 
CompilerDeclContext &dc) {
 
 CXXMethodDecl *
 ClangASTContext::DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc) {
-  if (dc.IsClang())
+  if (IsClangDeclContext(dc))
 return llvm::dyn_cast(
 (clang::DeclContext *)dc.GetOpaqueDeclContext());
   return nullptr;
@@ -10224,7 +10228,7 @@ ClangASTContext::DeclContextGetAsCXXMethodDecl(const 
CompilerDeclContext &dc) {
 
 clang::FunctionDecl *
 ClangASTContext::DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc) {
-  if (dc.IsClang())
+  if (IsClangDeclContext(dc))
 return llvm::dyn_cast(
 (clang::DeclContext *)dc.GetOpaqueDeclContext());
   return nullptr;
@@ -10232,7 +10236,7 @@ ClangASTContext::DeclContextGetAsFunctionDecl(const 
CompilerDeclContext &dc) {
 
 clang::NamespaceDecl *
 ClangASTContext::DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc) {
-  if (dc.IsClang())
+  if (IsClangDeclContext(dc))
 return llvm::dyn_cast(
 (clang::DeclContext *)dc.GetOpaqueDeclContext());
   return nullptr;

diff  --git a/lldb/source/Symbol/CompilerDecl.cpp 
b/lldb/source/Symbol/CompilerDecl.cpp
index 017e541bd203..48d9169c1a7a 100644
--- a/lldb/source/Symbol/CompilerDecl.cpp
+++ b/lldb/source/Symbol/CompilerDecl.cpp
@@ -7,7 +7,6 @@
 
//===--===//
 
 #include "lldb/Symbol/CompilerDecl.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
 #include "lldb/Symbol/TypeSystem.h"
 

diff  --git a/lldb/source/Symbol/CompilerDeclContext.cpp 
b/lldb/source/Symbol/CompilerDeclContext.cpp
index 7d45f47ad133..672de6ec34d1 100644
--- a/lldb/source/Symbol/CompilerDeclContext.cpp
+++ b/lldb/source/Symbol/CompilerDeclContext.cpp
@@ -7,7 +7,6 @@
 
//===--===//
 
 #include "lldb/Symbol/CompilerDeclContext.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/TypeSystem.h"
 #include 
@@ -24,10 +23,6 @@ CompilerDeclContext::FindDeclByName(ConstString name,
 return std::vector();
 }
 
-bool CompilerDeclContext::IsClang() const {
-  return IsValid() && llvm::isa(m_type_system);
-}
-
 ConstString CompilerDeclContext::GetName() const {
   if (IsValid())
 return m_type_system->DeclContextGetName(m_opaque_decl_ctx);



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


[Lldb-commits] [lldb] f39277c - [lldb][NFC] Remove unused variable in ClangASTSource::CompleteType

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

Author: Raphael Isemann
Date: 2019-11-28T15:32:56+01:00
New Revision: f39277c1d370ccbbec2e20a20375ee6fb7281ae4

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

LOG: [lldb][NFC] Remove unused variable in ClangASTSource::CompleteType

Now that CompilerDeclContext is a trivial class, Clang started warning
that this unused variable is in fact unused. Let's remove it.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 7440f6a0c363..2b484db3a188 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -363,7 +363,6 @@ void ClangASTSource::CompleteType(TagDecl *tag_decl) {
   TypeList types;
 
   ConstString name(tag_decl->getName().str().c_str());
-  CompilerDeclContext namespace_decl;
 
   const ModuleList &module_list = m_target->GetImages();
 



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


[Lldb-commits] [lldb] e0203b2 - [lldb][NFC] Simplify CompilerDecl and CompilerDeclContext initialization

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

Author: Raphael Isemann
Date: 2019-11-28T15:27:54+01:00
New Revision: e0203b25af92a3388580d6ef4eb386058720449e

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

LOG: [lldb][NFC] Simplify CompilerDecl and CompilerDeclContext initialization

Added: 


Modified: 
lldb/include/lldb/Symbol/CompilerDecl.h
lldb/include/lldb/Symbol/CompilerDeclContext.h

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerDecl.h 
b/lldb/include/lldb/Symbol/CompilerDecl.h
index 7e4755a58c59..e4687ffb3853 100644
--- a/lldb/include/lldb/Symbol/CompilerDecl.h
+++ b/lldb/include/lldb/Symbol/CompilerDecl.h
@@ -18,13 +18,11 @@ namespace lldb_private {
 class CompilerDecl {
 public:
   // Constructors and Destructors
-  CompilerDecl() : m_type_system(nullptr), m_opaque_decl(nullptr) {}
+  CompilerDecl() = default;
 
   CompilerDecl(TypeSystem *type_system, void *decl)
   : m_type_system(type_system), m_opaque_decl(decl) {}
 
-  ~CompilerDecl() {}
-
   // Tests
 
   explicit operator bool() const { return IsValid(); }
@@ -73,8 +71,8 @@ class CompilerDecl {
   CompilerType GetFunctionArgumentType(size_t arg_idx) const;
 
 private:
-  TypeSystem *m_type_system;
-  void *m_opaque_decl;
+  TypeSystem *m_type_system = nullptr;
+  void *m_opaque_decl = nullptr;
 };
 
 bool operator==(const CompilerDecl &lhs, const CompilerDecl &rhs);

diff  --git a/lldb/include/lldb/Symbol/CompilerDeclContext.h 
b/lldb/include/lldb/Symbol/CompilerDeclContext.h
index e7958c08d833..c140a3df13d0 100644
--- a/lldb/include/lldb/Symbol/CompilerDeclContext.h
+++ b/lldb/include/lldb/Symbol/CompilerDeclContext.h
@@ -19,13 +19,11 @@ namespace lldb_private {
 class CompilerDeclContext {
 public:
   // Constructors and Destructors
-  CompilerDeclContext() : m_type_system(nullptr), m_opaque_decl_ctx(nullptr) {}
+  CompilerDeclContext() = default;
 
   CompilerDeclContext(TypeSystem *type_system, void *decl_ctx)
   : m_type_system(type_system), m_opaque_decl_ctx(decl_ctx) {}
 
-  ~CompilerDeclContext() {}
-
   // Tests
 
   explicit operator bool() const { return IsValid(); }
@@ -105,8 +103,8 @@ class CompilerDeclContext {
   bool IsStructUnionOrClass() const;
 
 private:
-  TypeSystem *m_type_system;
-  void *m_opaque_decl_ctx;
+  TypeSystem *m_type_system = nullptr;
+  void *m_opaque_decl_ctx = nullptr;
 };
 
 bool operator==(const CompilerDeclContext &lhs, const CompilerDeclContext 
&rhs);



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


[Lldb-commits] [lldb] 3cd8ba0 - [lldb][NFC] Remove unused CompilerDecl::IsClang

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

Author: Raphael Isemann
Date: 2019-11-28T15:11:37+01:00
New Revision: 3cd8ba0e37a035a134dc01ce260040f1d57f4d40

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

LOG: [lldb][NFC] Remove unused CompilerDecl::IsClang

Added: 


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

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerDecl.h 
b/lldb/include/lldb/Symbol/CompilerDecl.h
index 4817ec4b2267..7e4755a58c59 100644
--- a/lldb/include/lldb/Symbol/CompilerDecl.h
+++ b/lldb/include/lldb/Symbol/CompilerDecl.h
@@ -39,8 +39,6 @@ class CompilerDecl {
 return m_type_system != nullptr && m_opaque_decl != nullptr;
   }
 
-  bool IsClang() const;
-
   // Accessors
 
   TypeSystem *GetTypeSystem() const { return m_type_system; }

diff  --git a/lldb/source/Symbol/CompilerDecl.cpp 
b/lldb/source/Symbol/CompilerDecl.cpp
index 3d17d802dd04..017e541bd203 100644
--- a/lldb/source/Symbol/CompilerDecl.cpp
+++ b/lldb/source/Symbol/CompilerDecl.cpp
@@ -13,10 +13,6 @@
 
 using namespace lldb_private;
 
-bool CompilerDecl::IsClang() const {
-  return IsValid() && llvm::isa(m_type_system);
-}
-
 ConstString CompilerDecl::GetName() const {
   return m_type_system->DeclGetName(m_opaque_decl);
 }



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


[Lldb-commits] [PATCH] D70814: [lldb] Simplify and improve FileSpecTest

2019-11-28 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd1a561d44680: [lldb] Simplify and improve FileSpecTest 
(authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70814

Files:
  lldb/unittests/Utility/FileSpecTest.cpp

Index: lldb/unittests/Utility/FileSpecTest.cpp
===
--- lldb/unittests/Utility/FileSpecTest.cpp
+++ lldb/unittests/Utility/FileSpecTest.cpp
@@ -12,6 +12,14 @@
 
 using namespace lldb_private;
 
+static FileSpec PosixSpec(llvm::StringRef path) {
+  return FileSpec(path, FileSpec::Style::posix);
+}
+
+static FileSpec WindowsSpec(llvm::StringRef path) {
+  return FileSpec(path, FileSpec::Style::windows);
+}
+
 TEST(FileSpecTest, FileAndDirectoryComponents) {
   FileSpec fs_posix("/foo/bar", FileSpec::Style::posix);
   EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
@@ -106,8 +114,7 @@
 }
 
 TEST(FileSpecTest, CopyByAppendingPathComponent) {
-  FileSpec fs = FileSpec("/foo", FileSpec::Style::posix)
-.CopyByAppendingPathComponent("bar");
+  FileSpec fs = PosixSpec("/foo").CopyByAppendingPathComponent("bar");
   EXPECT_STREQ("/foo/bar", fs.GetCString());
   EXPECT_STREQ("/foo", fs.GetDirectory().GetCString());
   EXPECT_STREQ("bar", fs.GetFilename().GetCString());
@@ -136,9 +143,7 @@
 }
 
 TEST(FileSpecTest, EqualSeparator) {
-  FileSpec backward("C:\\foo\\bar", FileSpec::Style::windows);
-  FileSpec forward("C:/foo/bar", FileSpec::Style::windows);
-  EXPECT_EQ(forward, backward);
+  EXPECT_EQ(WindowsSpec("C:\\foo\\bar"), WindowsSpec("C:/foo/bar"));
 }
 
 TEST(FileSpecTest, EqualDotsWindows) {
@@ -153,9 +158,8 @@
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::windows);
-FileSpec two(test.second, FileSpec::Style::windows);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(WindowsSpec(test.first), WindowsSpec(test.second));
   }
 }
 
@@ -169,9 +173,8 @@
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::posix);
-FileSpec two(test.second, FileSpec::Style::posix);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(PosixSpec(test.first), PosixSpec(test.second));
   }
 }
 
@@ -183,9 +186,8 @@
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::posix);
-FileSpec two(test.second, FileSpec::Style::posix);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(PosixSpec(test.first), PosixSpec(test.second));
   }
 }
 
@@ -200,7 +202,7 @@
   EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo/bar.txt"));
 }
 
-TEST(FileSpecTest, GetNormalizedPath) {
+TEST(FileSpecTest, GetPath) {
   std::pair posix_tests[] = {
   {"/foo/.././bar", "/bar"},
   {"/foo/./../bar", "/bar"},
@@ -230,8 +232,7 @@
   };
   for (auto test : posix_tests) {
 SCOPED_TRACE(llvm::Twine("test.first = ") + test.first);
-EXPECT_EQ(test.second,
-  FileSpec(test.first, FileSpec::Style::posix).GetPath());
+EXPECT_EQ(test.second, PosixSpec(test.first).GetPath());
   }
 
   std::pair windows_tests[] = {
@@ -262,9 +263,8 @@
   {R"(..\..\foo)", R"(..\..\foo)"},
   };
   for (auto test : windows_tests) {
-EXPECT_EQ(test.second,
-  FileSpec(test.first, FileSpec::Style::windows).GetPath())
-<< "Original path: " << test.first;
+SCOPED_TRACE(llvm::Twine("test.first = ") + test.first);
+EXPECT_EQ(test.second, WindowsSpec(test.first).GetPath());
   }
 }
 
@@ -315,8 +315,8 @@
 "/foo/../.",
   };
   for (const auto &path: not_relative) {
-FileSpec spec(path, FileSpec::Style::posix);
-EXPECT_FALSE(spec.IsRelative());
+SCOPED_TRACE(path);
+EXPECT_FALSE(PosixSpec(path).IsRelative());
   }
   llvm::StringRef is_relative[] = {
 ".",
@@ -333,8 +333,8 @@
 "./foo/bar.c"
   };
   for (const auto &path: is_relative) {
-FileSpec spec(path, FileSpec::Style::posix);
-EXPECT_TRUE(spec.IsRelative());
+SCOPED_TRACE(path);
+EXPECT_TRUE(PosixSpec(path).IsRelative());
   }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70797: [LLDB] Use r11 as frame pointer on Windows on ARM

2019-11-28 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo updated this revision to Diff 231416.
mstorsjo edited the summary of this revision.
mstorsjo added a comment.

Added a testcase using a minidump. I had to add recognition of r11 as a 
potential frame pointer register in thumb mode in the handling of one 
instruction, to make it pick up the exact form my testcase happened to use. 
There's potentially other cases also where the thumb emulation doesn't expect 
r11 to be a frame pointer, but this at least verifies the change to 
GetFramePointerRegisterNumber.


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

https://reviews.llvm.org/D70797

Files:
  lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  lldb/test/Shell/Minidump/Windows/Inputs/arm-fp-unwind.dmp.yaml
  lldb/test/Shell/Minidump/Windows/Inputs/arm-fp-unwind.exe.yaml
  lldb/test/Shell/Minidump/Windows/arm-fp-unwind.test

Index: lldb/test/Shell/Minidump/Windows/arm-fp-unwind.test
===
--- /dev/null
+++ lldb/test/Shell/Minidump/Windows/arm-fp-unwind.test
@@ -0,0 +1,15 @@
+Test that unwind plans use the frame pointer register correctly.
+
+RUN: yaml2obj %S/Inputs/arm-fp-unwind.exe.yaml > %T/arm-fp-unwind.exe
+RUN: yaml2obj %S/Inputs/arm-fp-unwind.dmp.yaml > %T/arm-fp-unwind.dmp
+RUN: %lldb -O "settings set target.exec-search-paths %T" \
+RUN:   -c %T/arm-fp-unwind.dmp -o "image show-unwind -a 0x00c71010" -b \
+RUN:   | FileCheck %s
+
+CHECK: Assembly language inspection UnwindPlan:
+CHECK-NEXT: This UnwindPlan originally sourced from EmulateInstructionARM
+CHECK-NEXT: This UnwindPlan is sourced from the compiler: no.
+CHECK-NEXT: This UnwindPlan is valid at all instruction locations: yes.
+CHECK-NEXT: row[0]:0: CFA=sp +0 =>
+CHECK-NEXT: row[1]:4: CFA=sp +8 => fp=[CFA-8] lr=[CFA-4]
+CHECK-NEXT: row[2]:6: CFA=fp +8 => fp=[CFA-8] lr=[CFA-4]
Index: lldb/test/Shell/Minidump/Windows/Inputs/arm-fp-unwind.exe.yaml
===
--- /dev/null
+++ lldb/test/Shell/Minidump/Windows/Inputs/arm-fp-unwind.exe.yaml
@@ -0,0 +1,92 @@
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4097
+  ImageBase:   4194304
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 0
+Size:0
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_ARMNT
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 38
+SectionData: 2DE90048EB46ADF5007D684600F004F80DF5007DBDE8008800BE01784278415C805C08447047
+symbols:
+  - Name:.text
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:entry
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+StorageClass:IMAGE_SYM_CLASS_EXTERNAL
+  - Name:other
+Value:   24
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+StorageClass:IMAGE_SYM_CLASS_EXTERNAL
+...
Index: lldb/test/Shell/Minidump/Windows/Inputs/arm-fp-unwind.dmp.yaml

[Lldb-commits] [lldb] d1a561d - [lldb] Simplify and improve FileSpecTest

2019-11-28 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2019-11-28T14:31:29+01:00
New Revision: d1a561d446809cc3b5c11c163b9aa5ba4957af68

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

LOG: [lldb] Simplify and improve FileSpecTest

Summary:
A most of these tests create FileSpecs with a hardcoded style. Add
utility functions which create a file spec of a given style to simplify
things.

While in there add SCOPED_TRACE messages to tests which loop over
multiple inputs to ensure it's clear which of the inputs failed.

Reviewers: teemperor

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/unittests/Utility/FileSpecTest.cpp

Removed: 




diff  --git a/lldb/unittests/Utility/FileSpecTest.cpp 
b/lldb/unittests/Utility/FileSpecTest.cpp
index 0f5b1652d298..4f91d11fdf1e 100644
--- a/lldb/unittests/Utility/FileSpecTest.cpp
+++ b/lldb/unittests/Utility/FileSpecTest.cpp
@@ -12,6 +12,14 @@
 
 using namespace lldb_private;
 
+static FileSpec PosixSpec(llvm::StringRef path) {
+  return FileSpec(path, FileSpec::Style::posix);
+}
+
+static FileSpec WindowsSpec(llvm::StringRef path) {
+  return FileSpec(path, FileSpec::Style::windows);
+}
+
 TEST(FileSpecTest, FileAndDirectoryComponents) {
   FileSpec fs_posix("/foo/bar", FileSpec::Style::posix);
   EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
@@ -106,8 +114,7 @@ TEST(FileSpecTest, AppendPathComponent) {
 }
 
 TEST(FileSpecTest, CopyByAppendingPathComponent) {
-  FileSpec fs = FileSpec("/foo", FileSpec::Style::posix)
-.CopyByAppendingPathComponent("bar");
+  FileSpec fs = PosixSpec("/foo").CopyByAppendingPathComponent("bar");
   EXPECT_STREQ("/foo/bar", fs.GetCString());
   EXPECT_STREQ("/foo", fs.GetDirectory().GetCString());
   EXPECT_STREQ("bar", fs.GetFilename().GetCString());
@@ -136,9 +143,7 @@ TEST(FileSpecTest, PrependPathComponent) {
 }
 
 TEST(FileSpecTest, EqualSeparator) {
-  FileSpec backward("C:\\foo\\bar", FileSpec::Style::windows);
-  FileSpec forward("C:/foo/bar", FileSpec::Style::windows);
-  EXPECT_EQ(forward, backward);
+  EXPECT_EQ(WindowsSpec("C:\\foo\\bar"), WindowsSpec("C:/foo/bar"));
 }
 
 TEST(FileSpecTest, EqualDotsWindows) {
@@ -153,9 +158,8 @@ TEST(FileSpecTest, EqualDotsWindows) {
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::windows);
-FileSpec two(test.second, FileSpec::Style::windows);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(WindowsSpec(test.first), WindowsSpec(test.second));
   }
 }
 
@@ -169,9 +173,8 @@ TEST(FileSpecTest, EqualDotsPosix) {
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::posix);
-FileSpec two(test.second, FileSpec::Style::posix);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(PosixSpec(test.first), PosixSpec(test.second));
   }
 }
 
@@ -183,9 +186,8 @@ TEST(FileSpecTest, EqualDotsPosixRoot) {
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::posix);
-FileSpec two(test.second, FileSpec::Style::posix);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(PosixSpec(test.first), PosixSpec(test.second));
   }
 }
 
@@ -200,7 +202,7 @@ TEST(FileSpecTest, GuessPathStyle) {
   EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo/bar.txt"));
 }
 
-TEST(FileSpecTest, GetNormalizedPath) {
+TEST(FileSpecTest, GetPath) {
   std::pair posix_tests[] = {
   {"/foo/.././bar", "/bar"},
   {"/foo/./../bar", "/bar"},
@@ -230,8 +232,7 @@ TEST(FileSpecTest, GetNormalizedPath) {
   };
   for (auto test : posix_tests) {
 SCOPED_TRACE(llvm::Twine("test.first = ") + test.first);
-EXPECT_EQ(test.second,
-  FileSpec(test.first, FileSpec::Style::posix).GetPath());
+EXPECT_EQ(test.second, PosixSpec(test.first).GetPath());
   }
 
   std::pair windows_tests[] = {
@@ -262,9 +263,8 @@ TEST(FileSpecTest, GetNormalizedPath) {
   {R"(..\..\foo)", R"(..\..\foo)"},
   };
   for (auto test : windows_tests) {
-EXPECT_EQ(test.second,
-  FileSpec(test.first, FileSpec::Style::windows).GetPath())
-<< "Original path: " << test.first;
+SCOPED_TRACE(llvm::Twine("test.first = ") + test.first);
+EXPECT_EQ(test.second, WindowsSpec(test.first).GetPath());
   }
 }
 
@@ -315,8 +315,8 @@ TEST(FileSpecTest, IsRelative) {
 "/foo/../.",
   };
   for (const auto &path: not_relative) {
-FileSpec spec(path, FileSpec::Style::posix);
-EXPECT_FALSE(spec.IsRelative());
+SCOPED_TRACE(path);
+EXPECT_FALSE(PosixSpec(path).IsRelative());
   }
   llvm::StringRef is_relative[] = {
 ".",

[Lldb-commits] [lldb] bf716eb - [lldb] Add FileSpec::Equal unit tests

2019-11-28 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2019-11-28T14:31:52+01:00
New Revision: bf716eb807409adf6490cb1cf595fb51efbd3fe6

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

LOG: [lldb] Add FileSpec::Equal unit tests

this is in preparation of a refactor of this method.

Added: 


Modified: 
lldb/unittests/Utility/FileSpecTest.cpp

Removed: 




diff  --git a/lldb/unittests/Utility/FileSpecTest.cpp 
b/lldb/unittests/Utility/FileSpecTest.cpp
index 4f91d11fdf1e..132c7cb94fad 100644
--- a/lldb/unittests/Utility/FileSpecTest.cpp
+++ b/lldb/unittests/Utility/FileSpecTest.cpp
@@ -379,3 +379,23 @@ TEST(FileSpecTest, RemoveLastPathComponent) {
   EXPECT_FALSE(fs_windows.RemoveLastPathComponent());
   EXPECT_STREQ("C:", fs_windows.GetCString());
 }
+
+TEST(FileSpecTest, Equal) {
+  auto Eq = [](const char *a, const char *b, bool full) {
+return FileSpec::Equal(PosixSpec(a), PosixSpec(b), full);
+  };
+  EXPECT_TRUE(Eq("/foo/bar", "/foo/bar", true));
+  EXPECT_TRUE(Eq("/foo/bar", "/foo/bar", false));
+
+  EXPECT_FALSE(Eq("/foo/bar", "/foo/baz", true));
+  EXPECT_FALSE(Eq("/foo/bar", "/foo/baz", false));
+
+  EXPECT_FALSE(Eq("/bar/foo", "/baz/foo", true));
+  EXPECT_FALSE(Eq("/bar/foo", "/baz/foo", false));
+
+  EXPECT_FALSE(Eq("/bar/foo", "foo", true));
+  EXPECT_TRUE(Eq("/bar/foo", "foo", false));
+
+  EXPECT_FALSE(Eq("foo", "/bar/foo", true));
+  EXPECT_TRUE(Eq("foo", "/bar/foo", false));
+}



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


[Lldb-commits] [lldb] 50e2ffa - Revert "[lldb] NFC: refactor CompileUnit::ResolveSymbolContext"

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

Author: Raphael Isemann
Date: 2019-11-28T14:25:46+01:00
New Revision: 50e2ffa18da4247e4d45f421c3271b58b936c869

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

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

This reverts commit 373e2a4f69d623e59329ff801f261d8b299e12d2.

This broke breakpoint setting.

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 b5f37f678900..7efbf792b1a9 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -381,11 +381,14 @@ 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
-  void ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
-bool check_inlines, bool exact,
-lldb::SymbolContextItem resolve_scope,
-SymbolContextList &sc_list);
+  uint32_t 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 2dada9a6118d..8d4930bf6edb 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -914,10 +914,9 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
 const bool exact = false;
 
 SymbolContextList 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();
+const uint32_t num_matches = frame_sc.comp_unit->ResolveSymbolContext(
+step_file_spec, line, check_inlines, exact, eSymbolContextLineEntry,
+sc_list);
 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 4122b5d3b747..4a14260c6c72 100644
--- a/lldb/source/Core/AddressResolverFileLine.cpp
+++ b/lldb/source/Core/AddressResolverFileLine.cpp
@@ -40,13 +40,14 @@ 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));
 
-  cu->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines, false,
-   eSymbolContextEverything, sc_list);
-  uint32_t sc_list_size = sc_list.GetSize();
+  sc_list_size =
+  cu->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines, false,
+   eSymbolContextEverything, sc_list);
   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 62a1d690da42..b37636c3bafc 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;
 }
 
-void CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
-   uint32_t line, bool check_inlines,
-   bool exact,
-   SymbolContextItem resolve_scope,
-   SymbolContextList &sc_list) {
+uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
+   uint32_t line, bool check_inlines,
+   bool exact,
+   SymbolContextItem resolve_scope,
+   SymbolContextList &sc_list) {
   // First find all of the file indexes that match our "file_spec". If
   // "file_spec" has an empty d

[Lldb-commits] [lldb] 42c857a - [lldb][NFC] Remove unused STLUtil include and STLUtil.h header

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

Author: Raphael Isemann
Date: 2019-11-28T14:11:35+01:00
New Revision: 42c857aa4783824183d55e8a6ede488d69349806

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

LOG: [lldb][NFC] Remove unused STLUtil include and STLUtil.h header

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandReturnObject.h

Removed: 
lldb/include/lldb/Core/STLUtils.h



diff  --git a/lldb/include/lldb/Core/STLUtils.h 
b/lldb/include/lldb/Core/STLUtils.h
deleted file mode 100644
index f9500aa5594e..
--- a/lldb/include/lldb/Core/STLUtils.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//===-- STLUtils.h --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef liblldb_STLUtils_h_
-#define liblldb_STLUtils_h_
-
-#include 
-
-#include 
-#include 
-#include 
-
-
-// C string less than compare function object
-struct CStringCompareFunctionObject {
-  bool operator()(const char *s1, const char *s2) const {
-return strcmp(s1, s2) < 0;
-  }
-};
-
-#endif // liblldb_STLUtils_h_

diff  --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h 
b/lldb/include/lldb/Interpreter/CommandReturnObject.h
index 61e57fb798a1..8af76e07e5ae 100644
--- a/lldb/include/lldb/Interpreter/CommandReturnObject.h
+++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h
@@ -9,7 +9,6 @@
 #ifndef liblldb_CommandReturnObject_h_
 #define liblldb_CommandReturnObject_h_
 
-#include "lldb/Core/STLUtils.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/StreamTee.h"



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


[Lldb-commits] [PATCH] D70774: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG373e2a4f69d6: [lldb] NFC: refactor 
CompileUnit::ResolveSymbolContext (authored by kwk).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70774

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

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -244,11 +244,11 @@
   return UINT32_MAX;
 }
 
-uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
-   uint32_t line, bool check_inlines,
-   bool exact,
-   SymbolContextItem resolve_scope,
-   SymbolContextList &sc_list) {
+void CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
+   uint32_t line, bool check_inlines,
+   bool exact,
+   SymbolContextItem resolve_scope,
+   SymbolContextList &sc_list) {
   // First find all of the file indexes that match our "file_spec". If
   // "file_spec" has an empty directory, then only compare the basenames when
   // finding file indexes
@@ -260,7 +260,7 @@
   // If we are not looking for inlined functions and our file spec doesn't
   // match then we are done...
   if (!file_spec_matches_cu_file_spec && !check_inlines)
-return 0;
+return;
 
   uint32_t file_idx =
   GetSupportFiles().FindFileIndex(1, file_spec, true);
@@ -271,84 +271,68 @@
 
   const size_t num_file_indexes = file_indexes.size();
   if (num_file_indexes == 0)
-return 0;
-
-  const uint32_t prev_size = sc_list.GetSize();
+return;
 
   SymbolContext sc(GetModule());
   sc.comp_unit = this;
 
-  if (line != 0) {
-LineTable *line_table = sc.comp_unit->GetLineTable();
-
-if (line_table != nullptr) {
-  uint32_t found_line;
-  uint32_t line_idx;
-
-  if (num_file_indexes == 1) {
-// We only have a single support file that matches, so use the line
-// table function that searches for a line entries that match a single
-// support file index
-LineEntry line_entry;
-line_idx = line_table->FindLineEntryIndexByFileIndex(
-0, file_indexes.front(), line, exact, &line_entry);
-
-// If "exact == true", then "found_line" will be the same as "line". If
-// "exact == false", the "found_line" will be the closest line entry
-// with a line number greater than "line" and we will use this for our
-// subsequent line exact matches below.
-found_line = line_entry.line;
-
-while (line_idx != UINT32_MAX) {
-  // If they only asked for the line entry, then we're done, we can
-  // just copy that over. But if they wanted more than just the line
-  // number, fill it in.
-  if (resolve_scope == eSymbolContextLineEntry) {
-sc.line_entry = line_entry;
-  } else {
-line_entry.range.GetBaseAddress().CalculateSymbolContext(
-&sc, resolve_scope);
-  }
-
-  sc_list.Append(sc);
-  line_idx = line_table->FindLineEntryIndexByFileIndex(
-  line_idx + 1, file_indexes.front(), found_line, true,
-  &line_entry);
-}
-  } else {
-// We found multiple support files that match "file_spec" so use the
-// line table function that searches for a line entries that match a
-// multiple support file indexes.
-LineEntry line_entry;
-line_idx = line_table->FindLineEntryIndexByFileIndex(
-0, file_indexes, line, exact, &line_entry);
-
-// If "exact == true", then "found_line" will be the same as "line". If
-// "exact == false", the "found_line" will be the closest line entry
-// with a line number greater than "line" and we will use this for our
-// subsequent line exact matches below.
-found_line = line_entry.line;
-
-while (line_idx != UINT32_MAX) {
-  if (resolve_scope == eSymbolContextLineEntry) {
-sc.line_entry = line_entry;
-  } else {
-line_entry.range.GetBaseAddress().CalculateSymbolContext(
-&sc, resolve_scope);
-  }
-
-  sc_list.Append(sc);
-  line_idx = line_table->FindLineEntryIndexByFileIndex(
-  line_idx + 1, file_indexes, found_line, true, &line_entry);
-}
-  }
-}
-  } else if (file_spec_matches_cu_file_spec && !check_inlines) {
+  if (line == 0)
+return;
+  
+  if (f

[Lldb-commits] [lldb] a54ef8a - [lldb][NFC] Use llvm::StringRef instead of C-strings as multimap key

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

Author: Raphael Isemann
Date: 2019-11-28T14:05:47+01:00
New Revision: a54ef8af89c78f7296bea6ffabb7728ef563bec1

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

LOG: [lldb][NFC] Use llvm::StringRef instead of C-strings as multimap key

Added: 


Modified: 
lldb/source/Symbol/Symtab.cpp

Removed: 




diff  --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index 9a2b5cddd73b..c7a6bf214526 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -13,7 +13,6 @@
 
 #include "lldb/Core/Module.h"
 #include "lldb/Core/RichManglingContext.h"
-#include "lldb/Core/STLUtils.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
@@ -107,10 +106,8 @@ void Symtab::Dump(Stream *s, Target *target, SortOrder 
sort_order,
   // sorted by name. So we must make the ordered symbol list up ourselves.
   s->PutCString(" (sorted by name):\n");
   DumpSymbolHeader(s);
-  typedef std::multimap
-  CStringToSymbol;
-  CStringToSymbol name_map;
+
+  std::multimap name_map;
   for (const_iterator pos = m_symbols.begin(), end = m_symbols.end();
pos != end; ++pos) {
 const char *name = pos->GetName().AsCString();
@@ -118,12 +115,10 @@ void Symtab::Dump(Stream *s, Target *target, SortOrder 
sort_order,
   name_map.insert(std::make_pair(name, &(*pos)));
   }
 
-  for (CStringToSymbol::const_iterator pos = name_map.begin(),
-   end = name_map.end();
-   pos != end; ++pos) {
+  for (const auto &name_to_symbol : name_map) {
+const Symbol *symbol = name_to_symbol.second;
 s->Indent();
-pos->second->Dump(s, target, pos->second - &m_symbols[0],
-  name_preference);
+symbol->Dump(s, target, symbol - &m_symbols[0], name_preference);
   }
 } break;
 



___
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] [PATCH] D70814: [lldb] Simplify and improve FileSpecTest

2019-11-28 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70814



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


[Lldb-commits] [PATCH] D69371: [ARM64] Cleanup and speedup NativeRegisterContextLinux_arm64

2019-11-28 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid updated this revision to Diff 231408.
omjavaid added a comment.

Sorry for late response on this. I got side tracked into other issues and 
wanted performance testing before writing an update.

I agree with @labath about making caching for limited to reads only and 
register writes are written all the way in latest update.

Also according to performance tests these changes show no significant 
improvement on real hardware but if underlying hardware is a simulator like 
QEMU some improvement does occur. This is the main reason I am keeping these 
changes intact for register reads but have removed for register writes.

I have tested this patch on Ubuntu Bionic running on QEMU and Thunder X1 arm64 
server.

LGTM?


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

https://reviews.llvm.org/D69371

Files:
  lldb/include/lldb/Host/common/NativeRegisterContext.h
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h

Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -40,6 +40,8 @@
 
   Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
 
+  void InvalidateAllRegisters() override;
+
   // Hardware breakpoints/watchpoint management functions
 
   uint32_t NumSupportedHardwareBreakpoints() override;
@@ -77,11 +79,6 @@
   enum DREGType { eDREGTypeWATCH = 0, eDREGTypeBREAK };
 
 protected:
-  Status DoReadRegisterValue(uint32_t offset, const char *reg_name,
- uint32_t size, RegisterValue &value) override;
-
-  Status DoWriteRegisterValue(uint32_t offset, const char *reg_name,
-  const RegisterValue &value) override;
 
   Status ReadGPR() override;
 
@@ -125,8 +122,17 @@
 uint32_t fpcr;
   };
 
-  uint64_t m_gpr_arm64[k_num_gpr_registers_arm64]; // 64-bit general purpose
-   // registers.
+  struct GPR {
+uint64_t x[31];
+uint64_t sp;
+uint64_t pc;
+uint64_t pstate;
+  };
+
+  bool m_gpr_is_valid;
+  bool m_fpu_is_valid;
+
+  GPR m_gpr_arm64; // 64-bit general purpose registers.
   RegInfo m_reg_info;
   FPU m_fpr; // floating-point registers including extended register sets.
 
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -152,6 +152,9 @@
   m_max_hwp_supported = 16;
   m_max_hbp_supported = 16;
   m_refresh_hwdebug_info = true;
+
+  m_gpr_is_valid = false;
+  m_fpu_is_valid = false;
 }
 
 uint32_t NativeRegisterContextLinux_arm64::GetRegisterSetCount() const {
@@ -185,41 +188,36 @@
 
   const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
 
-  if (IsFPR(reg)) {
-error = ReadFPR();
+  if (reg == LLDB_INVALID_REGNUM)
+return Status("no lldb regnum for %s", reg_info && reg_info->name
+   ? reg_info->name
+   : "");
+
+  uint8_t *src;
+  uint32_t offset;
+
+  if (IsGPR(reg)) {
+error = ReadGPR();
 if (error.Fail())
   return error;
-  } else {
-uint32_t full_reg = reg;
-bool is_subreg = reg_info->invalidate_regs &&
- (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM);
 
-if (is_subreg) {
-  // Read the full aligned 64-bit register.
-  full_reg = reg_info->invalidate_regs[0];
-}
+offset = reg_info->byte_offset;
+assert(offset < GetGPRSize());
+src = (uint8_t *)GetGPRBuffer() + offset;
 
-error = ReadRegisterRaw(full_reg, reg_value);
+  } else if (IsFPR(reg)) {
 
-if (error.Success()) {
-  // If our read was not aligned (for ah,bh,ch,dh), shift our returned
-  // value one byte to the right.
-  if (is_subreg && (reg_info->byte_offset & 0x1))
-reg_value.SetUInt64(reg_value.GetAsUInt64() >> 8);
+error = ReadFPR();
+if (error.Fail())
+  return error;
 
-  // If our return byte size was greater than the return value reg size,
-  // then use the type specified by reg_info rather than the uint64_t
-  // default
-  if (reg_value.GetByteSize() > reg_info->byte_size)
-reg_value.SetType(reg_info);
-}
-return error;
-  }
+offset = CalculateFprOffset(reg_info);
+assert(offset < GetFPRSize());
+src = (uint8_t *)GetFPRBuffer() + offset;
+  } else
+return Status("failed - register wasn't recognized to be a GPR or an FPR, "
+  "write strategy unknown");
 
-  // 

[Lldb-commits] [PATCH] D70774: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70774



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


[Lldb-commits] [PATCH] D70814: [lldb] Simplify and improve FileSpecTest

2019-11-28 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added a reviewer: teemperor.
Herald added a project: LLDB.

A most of these tests create FileSpecs with a hardcoded style. Add
utility functions which create a file spec of a given style to simplify
things.

While in there add SCOPED_TRACE messages to tests which loop over
multiple inputs to ensure it's clear which of the inputs failed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70814

Files:
  lldb/unittests/Utility/FileSpecTest.cpp

Index: lldb/unittests/Utility/FileSpecTest.cpp
===
--- lldb/unittests/Utility/FileSpecTest.cpp
+++ lldb/unittests/Utility/FileSpecTest.cpp
@@ -12,6 +12,14 @@
 
 using namespace lldb_private;
 
+static FileSpec PosixSpec(llvm::StringRef path) {
+  return FileSpec(path, FileSpec::Style::posix);
+}
+
+static FileSpec WindowsSpec(llvm::StringRef path) {
+  return FileSpec(path, FileSpec::Style::windows);
+}
+
 TEST(FileSpecTest, FileAndDirectoryComponents) {
   FileSpec fs_posix("/foo/bar", FileSpec::Style::posix);
   EXPECT_STREQ("/foo/bar", fs_posix.GetCString());
@@ -106,8 +114,7 @@
 }
 
 TEST(FileSpecTest, CopyByAppendingPathComponent) {
-  FileSpec fs = FileSpec("/foo", FileSpec::Style::posix)
-.CopyByAppendingPathComponent("bar");
+  FileSpec fs = PosixSpec("/foo").CopyByAppendingPathComponent("bar");
   EXPECT_STREQ("/foo/bar", fs.GetCString());
   EXPECT_STREQ("/foo", fs.GetDirectory().GetCString());
   EXPECT_STREQ("bar", fs.GetFilename().GetCString());
@@ -136,9 +143,7 @@
 }
 
 TEST(FileSpecTest, EqualSeparator) {
-  FileSpec backward("C:\\foo\\bar", FileSpec::Style::windows);
-  FileSpec forward("C:/foo/bar", FileSpec::Style::windows);
-  EXPECT_EQ(forward, backward);
+  EXPECT_EQ(WindowsSpec("C:\\foo\\bar"), WindowsSpec("C:/foo/bar"));
 }
 
 TEST(FileSpecTest, EqualDotsWindows) {
@@ -153,9 +158,8 @@
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::windows);
-FileSpec two(test.second, FileSpec::Style::windows);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(WindowsSpec(test.first), WindowsSpec(test.second));
   }
 }
 
@@ -169,9 +173,8 @@
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::posix);
-FileSpec two(test.second, FileSpec::Style::posix);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(PosixSpec(test.first), PosixSpec(test.second));
   }
 }
 
@@ -183,9 +186,8 @@
   };
 
   for (const auto &test : tests) {
-FileSpec one(test.first, FileSpec::Style::posix);
-FileSpec two(test.second, FileSpec::Style::posix);
-EXPECT_EQ(one, two);
+SCOPED_TRACE(llvm::Twine(test.first) + " <=> " + test.second);
+EXPECT_EQ(PosixSpec(test.first), PosixSpec(test.second));
   }
 }
 
@@ -200,7 +202,7 @@
   EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo/bar.txt"));
 }
 
-TEST(FileSpecTest, GetNormalizedPath) {
+TEST(FileSpecTest, GetPath) {
   std::pair posix_tests[] = {
   {"/foo/.././bar", "/bar"},
   {"/foo/./../bar", "/bar"},
@@ -230,8 +232,7 @@
   };
   for (auto test : posix_tests) {
 SCOPED_TRACE(llvm::Twine("test.first = ") + test.first);
-EXPECT_EQ(test.second,
-  FileSpec(test.first, FileSpec::Style::posix).GetPath());
+EXPECT_EQ(test.second, PosixSpec(test.first).GetPath());
   }
 
   std::pair windows_tests[] = {
@@ -262,9 +263,8 @@
   {R"(..\..\foo)", R"(..\..\foo)"},
   };
   for (auto test : windows_tests) {
-EXPECT_EQ(test.second,
-  FileSpec(test.first, FileSpec::Style::windows).GetPath())
-<< "Original path: " << test.first;
+SCOPED_TRACE(llvm::Twine("test.first = ") + test.first);
+EXPECT_EQ(test.second, WindowsSpec(test.first).GetPath());
   }
 }
 
@@ -315,8 +315,8 @@
 "/foo/../.",
   };
   for (const auto &path: not_relative) {
-FileSpec spec(path, FileSpec::Style::posix);
-EXPECT_FALSE(spec.IsRelative());
+SCOPED_TRACE(path);
+EXPECT_FALSE(PosixSpec(path).IsRelative());
   }
   llvm::StringRef is_relative[] = {
 ".",
@@ -333,8 +333,8 @@
 "./foo/bar.c"
   };
   for (const auto &path: is_relative) {
-FileSpec spec(path, FileSpec::Style::posix);
-EXPECT_TRUE(spec.IsRelative());
+SCOPED_TRACE(path);
+EXPECT_TRUE(PosixSpec(path).IsRelative());
   }
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 2e3c040 - [lldb][NFC] Remove unused CStringToDIEMap typedef

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

Author: Raphael Isemann
Date: 2019-11-28T13:33:19+01:00
New Revision: 2e3c040ee062741472233c1de2dbf135bcee5c7a

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

LOG: [lldb][NFC] Remove unused CStringToDIEMap typedef

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index d1b066ffe80c..056cf33a202f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -16,7 +16,6 @@
 #include "DWARFTypeUnit.h"
 #include "DWARFUnit.h"
 #include "SymbolFileDWARF.h"
-#include "lldb/Core/STLUtils.h"
 #include "lldb/lldb-private.h"
 #include "llvm/Support/Error.h"
 
@@ -24,11 +23,6 @@ namespace lldb_private {
 class DWARFContext;
 }
 
-typedef std::multimap
-CStringToDIEMap;
-typedef CStringToDIEMap::iterator CStringToDIEMapIter;
-typedef CStringToDIEMap::const_iterator CStringToDIEMapConstIter;
-
 class DWARFDebugInfo {
 public:
   typedef dw_offset_t (*Callback)(SymbolFileDWARF *dwarf2Data,



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


[Lldb-commits] [PATCH] D70774: [lldb] NFC: refactor CompileUnit::ResolveSymbolContext

2019-11-28 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk updated this revision to Diff 231406.
kwk added a comment.

- Have ResolveSymbolContext not return anything


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70774

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

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -244,11 +244,11 @@
   return UINT32_MAX;
 }
 
-uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
-   uint32_t line, bool check_inlines,
-   bool exact,
-   SymbolContextItem resolve_scope,
-   SymbolContextList &sc_list) {
+void CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
+   uint32_t line, bool check_inlines,
+   bool exact,
+   SymbolContextItem resolve_scope,
+   SymbolContextList &sc_list) {
   // First find all of the file indexes that match our "file_spec". If
   // "file_spec" has an empty directory, then only compare the basenames when
   // finding file indexes
@@ -260,7 +260,7 @@
   // If we are not looking for inlined functions and our file spec doesn't
   // match then we are done...
   if (!file_spec_matches_cu_file_spec && !check_inlines)
-return 0;
+return;
 
   uint32_t file_idx =
   GetSupportFiles().FindFileIndex(1, file_spec, true);
@@ -271,84 +271,68 @@
 
   const size_t num_file_indexes = file_indexes.size();
   if (num_file_indexes == 0)
-return 0;
-
-  const uint32_t prev_size = sc_list.GetSize();
+return;
 
   SymbolContext sc(GetModule());
   sc.comp_unit = this;
 
-  if (line != 0) {
-LineTable *line_table = sc.comp_unit->GetLineTable();
-
-if (line_table != nullptr) {
-  uint32_t found_line;
-  uint32_t line_idx;
-
-  if (num_file_indexes == 1) {
-// We only have a single support file that matches, so use the line
-// table function that searches for a line entries that match a single
-// support file index
-LineEntry line_entry;
-line_idx = line_table->FindLineEntryIndexByFileIndex(
-0, file_indexes.front(), line, exact, &line_entry);
-
-// If "exact == true", then "found_line" will be the same as "line". If
-// "exact == false", the "found_line" will be the closest line entry
-// with a line number greater than "line" and we will use this for our
-// subsequent line exact matches below.
-found_line = line_entry.line;
-
-while (line_idx != UINT32_MAX) {
-  // If they only asked for the line entry, then we're done, we can
-  // just copy that over. But if they wanted more than just the line
-  // number, fill it in.
-  if (resolve_scope == eSymbolContextLineEntry) {
-sc.line_entry = line_entry;
-  } else {
-line_entry.range.GetBaseAddress().CalculateSymbolContext(
-&sc, resolve_scope);
-  }
-
-  sc_list.Append(sc);
-  line_idx = line_table->FindLineEntryIndexByFileIndex(
-  line_idx + 1, file_indexes.front(), found_line, true,
-  &line_entry);
-}
-  } else {
-// We found multiple support files that match "file_spec" so use the
-// line table function that searches for a line entries that match a
-// multiple support file indexes.
-LineEntry line_entry;
-line_idx = line_table->FindLineEntryIndexByFileIndex(
-0, file_indexes, line, exact, &line_entry);
-
-// If "exact == true", then "found_line" will be the same as "line". If
-// "exact == false", the "found_line" will be the closest line entry
-// with a line number greater than "line" and we will use this for our
-// subsequent line exact matches below.
-found_line = line_entry.line;
-
-while (line_idx != UINT32_MAX) {
-  if (resolve_scope == eSymbolContextLineEntry) {
-sc.line_entry = line_entry;
-  } else {
-line_entry.range.GetBaseAddress().CalculateSymbolContext(
-&sc, resolve_scope);
-  }
-
-  sc_list.Append(sc);
-  line_idx = line_table->FindLineEntryIndexByFileIndex(
-  line_idx + 1, file_indexes, found_line, true, &line_entry);
-}
-  }
-}
-  } else if (file_spec_matches_cu_file_spec && !check_inlines) {
+  if (line == 0)
+return;
+  
+  if (file_spec_matches_cu_file_spec && !check_inlines) {
 // only appen

[Lldb-commits] [lldb] ee79fea - [lldb][NFC] Remove forward declaration of PrivateAutoCompleteMembers

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

Author: Raphael Isemann
Date: 2019-11-28T12:45:48+01:00
New Revision: ee79feaec3ed44b21654936baf44561f5f726dfc

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

LOG: [lldb][NFC] Remove forward declaration of PrivateAutoCompleteMembers

That's declared directly above the actual definition, so it serves no use.

Added: 


Modified: 
lldb/source/Symbol/Variable.cpp

Removed: 




diff  --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index a2eeaa1d2a5b..6e4b87c47700 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -487,13 +487,6 @@ static void PrivateAutoComplete(
 &prefix_path, // Anything that has been resolved already will be in 
here
 const CompilerType &compiler_type, CompletionRequest &request);
 
-static void PrivateAutoCompleteMembers(
-StackFrame *frame, const std::string &partial_member_name,
-llvm::StringRef partial_path,
-const llvm::Twine
-&prefix_path, // Anything that has been resolved already will be in 
here
-const CompilerType &compiler_type, CompletionRequest &request);
-
 static void PrivateAutoCompleteMembers(
 StackFrame *frame, const std::string &partial_member_name,
 llvm::StringRef partial_path,



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


[Lldb-commits] [PATCH] D70796: [LLDB] Always interpret arm instructions as thumb on windows

2019-11-28 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Yeah, that fixes it. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70796



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


[Lldb-commits] [PATCH] D70796: [LLDB] Always interpret arm instructions as thumb on windows

2019-11-28 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

I pushed a commit to add such a REQUIRES line now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70796



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


[Lldb-commits] [lldb] 9d26791 - [lldb][NFC] Make GetAsCXXRecordDecl static

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

Author: Raphael Isemann
Date: 2019-11-28T12:24:41+01:00
New Revision: 9d2679152a4bbe892f72802427657bfdca85a63b

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

LOG: [lldb][NFC] Make GetAsCXXRecordDecl static

All other casting functions there are static, so this should
be too.

Added: 


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

Removed: 




diff  --git a/lldb/include/lldb/Symbol/ClangASTContext.h 
b/lldb/include/lldb/Symbol/ClangASTContext.h
index 20421bca305e..7018f3b71b4f 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -908,7 +908,8 @@ class ClangASTContext : public TypeSystem {
 
   static clang::TypedefNameDecl *GetAsTypedefDecl(const CompilerType &type);
 
-  clang::CXXRecordDecl *GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type);
+  static clang::CXXRecordDecl *
+  GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type);
 
   static clang::ObjCInterfaceDecl *
   GetAsObjCInterfaceDecl(const CompilerType &type);



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


[Lldb-commits] [PATCH] D70796: [LLDB] Always interpret arm instructions as thumb on windows

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

`REQUIRES: arm` ought to do the trick.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70796



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


[Lldb-commits] [PATCH] D70796: [LLDB] Always interpret arm instructions as thumb on windows

2019-11-28 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D70796#1762774 , @teemperor wrote:

> This is failing for me with:
>
>   (lldb) disassemble -b -n entry
>   error: Unable to find Disassembler plug-in for the 'armv7' architecture.
>
>
> I assume that's because I run with `LLVM_TARGETS_TO_BUILD:STRING=X86;AArch64` 
> in my CMake configuration.


Oops, sorry about that.

> Do we have a way to make this test condition on the ARM target being enabled 
> or do we have the ARM target as a hard requirement for the test suit?

The ARM target should definitely not be a hard requirement. Is the test skipped 
for you if you add a `# REQUIRES: arm` line?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70796



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


[Lldb-commits] [PATCH] D70796: [LLDB] Always interpret arm instructions as thumb on windows

2019-11-28 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

This is failing for me with:

  (lldb) disassemble -b -n entry
  error: Unable to find Disassembler plug-in for the 'armv7' architecture.

I assume that's because I run with `LLVM_TARGETS_TO_BUILD:STRING=X86;AArch64` 
in my CMake configuration. Do we have a way to make this test condition on the 
ARM target being enabled or do we have the ARM target as a hard requirement for 
the test suit?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70796



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


[Lldb-commits] [lldb] f7e31e0 - [lldb][NFC] Split up DWARFASTParserClang::CompleteTypeFromDWARF

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

Author: Raphael Isemann
Date: 2019-11-28T10:45:29+01:00
New Revision: f7e31e0cfd3b467a21c2ac9a94f5c828f88a9b72

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

LOG: [lldb][NFC] Split up DWARFASTParserClang::CompleteTypeFromDWARF

Moving the different parts into their own functions without any additional
cleanup/refactoring, so this is NFC.

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 51fa90322cf0..ba17469ea998 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1969,267 +1969,283 @@ bool DWARFASTParserClang::ParseTemplateParameterInfos(
   return template_param_infos.args.size() == template_param_infos.names.size();
 }
 
-bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die,
-lldb_private::Type *type,
-CompilerType &clang_type) {
-  SymbolFileDWARF *dwarf = die.GetDWARF();
-
-  std::lock_guard guard(
-  dwarf->GetObjectFile()->GetModule()->GetMutex());
-
-  // Disable external storage for this type so we don't get anymore
-  // clang::ExternalASTSource queries for this type.
-  m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), false);
-
-  if (!die)
-return false;
-
+bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die,
+ lldb_private::Type *type,
+ CompilerType &clang_type) {
   const dw_tag_t tag = die.Tag();
-
+  SymbolFileDWARF *dwarf = die.GetDWARF();
   Log *log =
   nullptr; // 
(LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
-  if (log)
-dwarf->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
-log, "0x%8.8" PRIx64 ": %s '%s' resolving forward declaration...",
-die.GetID(), die.GetTagAsCString(), type->GetName().AsCString());
-  assert(clang_type);
-  DWARFAttributes attributes;
-  switch (tag) {
-  case DW_TAG_structure_type:
-  case DW_TAG_union_type:
-  case DW_TAG_class_type: {
-ClangASTImporter::LayoutInfo layout_info;
-
-{
-  if (die.HasChildren()) {
-LanguageType class_language = eLanguageTypeUnknown;
-if (ClangASTContext::IsObjCObjectOrInterfaceType(clang_type)) {
-  class_language = eLanguageTypeObjC;
-  // For objective C we don't start the definition when the class is
-  // created.
-  ClangASTContext::StartTagDeclarationDefinition(clang_type);
-}
 
-int tag_decl_kind = -1;
-AccessType default_accessibility = eAccessNone;
-if (tag == DW_TAG_structure_type) {
-  tag_decl_kind = clang::TTK_Struct;
-  default_accessibility = eAccessPublic;
-} else if (tag == DW_TAG_union_type) {
-  tag_decl_kind = clang::TTK_Union;
-  default_accessibility = eAccessPublic;
-} else if (tag == DW_TAG_class_type) {
-  tag_decl_kind = clang::TTK_Class;
-  default_accessibility = eAccessPrivate;
-}
+  ClangASTImporter::LayoutInfo layout_info;
 
-std::vector> bases;
-std::vector member_accessibilities;
-bool is_a_class = false;
-// Parse members and base classes first
-std::vector member_function_dies;
+  {
+if (die.HasChildren()) {
+  LanguageType class_language = eLanguageTypeUnknown;
+  if (ClangASTContext::IsObjCObjectOrInterfaceType(clang_type)) {
+class_language = eLanguageTypeObjC;
+// For objective C we don't start the definition when the class is
+// created.
+ClangASTContext::StartTagDeclarationDefinition(clang_type);
+  }
 
-DelayedPropertyList delayed_properties;
-ParseChildMembers(die, clang_type, class_language, bases,
-  member_accessibilities, member_function_dies,
-  delayed_properties, default_accessibility, 
is_a_class,
-  layout_info);
+  int tag_decl_kind = -1;
+  AccessType default_accessibility = eAccessNone;
+  if (tag == DW_TAG_structure_type) {
+tag_decl_kind = clang::TTK_Struct;
+default_accessibility = eAccessPublic;
+  } else if (tag == DW_TAG_union_type) {
+tag_decl_kind = clang::TTK_Union;
+default_accessibility = eAccessPublic;
+  } else if (tag == DW_TAG_class_type) {
+tag_decl_kind = clang::TTK_Class;
+default_acces

[Lldb-commits] [PATCH] D70778: [LLDB] [PECOFF] Factorize mapping section names to types using StringSwitch. NFCI.

2019-11-28 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2e5bb6d8d944: [LLDB] [PECOFF] Factorize mapping section 
names to types using StringSwitch. (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D70778?vs=231318&id=231368#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70778

Files:
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h

Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -283,6 +283,8 @@
   void DumpDependentModules(lldb_private::Stream *s);
 
   llvm::StringRef GetSectionName(const section_header_t §);
+  static lldb::SectionType GetSectionType(llvm::StringRef sect_name,
+  const section_header_t §);
 
   typedef std::vector SectionHeaderColl;
   typedef SectionHeaderColl::iterator SectionHeaderCollIter;
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -787,6 +787,76 @@
   return false;
 }
 
+SectionType ObjectFilePECOFF::GetSectionType(llvm::StringRef sect_name,
+ const section_header_t §) {
+  ConstString const_sect_name(sect_name);
+  static ConstString g_code_sect_name(".code");
+  static ConstString g_CODE_sect_name("CODE");
+  static ConstString g_data_sect_name(".data");
+  static ConstString g_DATA_sect_name("DATA");
+  static ConstString g_bss_sect_name(".bss");
+  static ConstString g_BSS_sect_name("BSS");
+
+  if (sect.flags & llvm::COFF::IMAGE_SCN_CNT_CODE &&
+  ((const_sect_name == g_code_sect_name) ||
+   (const_sect_name == g_CODE_sect_name))) {
+return eSectionTypeCode;
+  }
+  if (sect.flags & llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
+ ((const_sect_name == g_data_sect_name) ||
+  (const_sect_name == g_DATA_sect_name))) {
+if (sect.size == 0 && sect.offset == 0)
+  return eSectionTypeZeroFill;
+else
+  return eSectionTypeData;
+  }
+  if (sect.flags & llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA &&
+ ((const_sect_name == g_bss_sect_name) ||
+  (const_sect_name == g_BSS_sect_name))) {
+if (sect.size == 0)
+  return eSectionTypeZeroFill;
+else
+  return eSectionTypeData;
+  }
+
+  SectionType section_type =
+  llvm::StringSwitch(sect_name)
+  .Case(".debug", eSectionTypeDebug)
+  .Case(".stabstr", eSectionTypeDataCString)
+  .Case(".reloc", eSectionTypeOther)
+  .Case(".debug_abbrev", eSectionTypeDWARFDebugAbbrev)
+  .Case(".debug_aranges", eSectionTypeDWARFDebugAranges)
+  .Case(".debug_frame", eSectionTypeDWARFDebugFrame)
+  .Case(".debug_info", eSectionTypeDWARFDebugInfo)
+  .Case(".debug_line", eSectionTypeDWARFDebugLine)
+  .Case(".debug_loc", eSectionTypeDWARFDebugLoc)
+  .Case(".debug_loclists", eSectionTypeDWARFDebugLocLists)
+  .Case(".debug_macinfo", eSectionTypeDWARFDebugMacInfo)
+  .Case(".debug_names", eSectionTypeDWARFDebugNames)
+  .Case(".debug_pubnames", eSectionTypeDWARFDebugPubNames)
+  .Case(".debug_pubtypes", eSectionTypeDWARFDebugPubTypes)
+  .Case(".debug_ranges", eSectionTypeDWARFDebugRanges)
+  .Case(".debug_str", eSectionTypeDWARFDebugStr)
+  .Case(".debug_types", eSectionTypeDWARFDebugTypes)
+  .Case(".eh_frame", eSectionTypeEHFrame)
+  .Case(".gosymtab", eSectionTypeGoSymtab)
+  .Default(eSectionTypeInvalid);
+  if (section_type != eSectionTypeInvalid)
+return section_type;
+
+  if (sect.flags & llvm::COFF::IMAGE_SCN_CNT_CODE)
+return eSectionTypeCode;
+  if (sect.flags & llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA)
+return eSectionTypeData;
+  if (sect.flags & llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) {
+if (sect.size == 0)
+  return eSectionTypeZeroFill;
+else
+  return eSectionTypeData;
+  }
+  return eSectionTypeOther;
+}
+
 void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) {
   if (m_sections_up)
 return;
@@ -810,104 +880,9 @@
 const uint32_t nsects = m_sect_headers.size();
 ModuleSP module_sp(GetModule());
 for (uint32_t idx = 0; idx < nsects; ++idx) {
-  ConstString const_sect_name(GetSectionName(m_sect_headers[idx]));
-  static ConstString g_code_sect_name(".code");
-  static ConstString g_CODE_sect_name("CODE");
-  static ConstString g_data_sect_name(".data");
-  static ConstString g_

[Lldb-commits] [PATCH] D70745: [LLDB] [PECOFF] Look for the truncated ".eh_fram" section name

2019-11-28 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG934c025e9bdd: [LLDB] [PECOFF] Look for the truncated 
".eh_fram" section name (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D70745?vs=231212&id=231370#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70745

Files:
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/test/Shell/ObjectFile/PECOFF/section-types.yaml

Index: lldb/test/Shell/ObjectFile/PECOFF/section-types.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/PECOFF/section-types.yaml
@@ -0,0 +1,92 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK-LABEL: Name: .text
+# CHECK-NEXT: Type: code
+
+# CHECK-LABEL: Name: .eh_fram
+# CHECK-NEXT: Type: eh-frame
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4096
+  ImageBase:   4194304
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_NO_SEH, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 12288
+Size:12
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_I386
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 5
+SectionData: 5589E55DC3
+  - Name:.eh_fram
+Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  8192
+VirtualSize: 52
+SectionData: 1400017A5200017C0801000C0404880118001C1045410E088502420D0500
+  - Name:.reloc
+Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  12288
+VirtualSize: 12
+SectionData: 00200C002030
+symbols:
+...
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -838,7 +838,8 @@
   .Case(".debug_ranges", eSectionTypeDWARFDebugRanges)
   .Case(".debug_str", eSectionTypeDWARFDebugStr)
   .Case(".debug_types", eSectionTypeDWARFDebugTypes)
-  .Case(".eh_frame", eSectionTypeEHFrame)
+  // .eh_frame can be truncated to 8 chars.
+  .Cases(".eh_frame", ".eh_fram", eSectionTypeEHFrame)
   .Case(".gosymtab", eSectionTypeGoSymtab)
   .Default(eSectionTypeInvalid);
   if (section_type != eSectionTypeInvalid)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70802: [lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES

2019-11-28 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb44e91a47252: [lldb] Remove debugging code used for 
LLDB_DWARF_DONT_COMPLETE_TYPENAMES (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70802

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1984,39 +1984,6 @@
   if (!die)
 return false;
 
-#if defined LLDB_CONFIGURATION_DEBUG
-  // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES environment
-  // variable can be set with one or more typenames separated by ';'
-  // characters. This will cause this function to not complete any types whose
-  // names match.
-  //
-  // Examples of setting this environment variable:
-  //
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo;Bar;Baz
-  const char *dont_complete_typenames_cstr =
-  getenv("LLDB_DWARF_DONT_COMPLETE_TYPENAMES");
-  if (dont_complete_typenames_cstr && dont_complete_typenames_cstr[0]) {
-const char *die_name = die.GetName();
-if (die_name && die_name[0]) {
-  const char *match = strstr(dont_complete_typenames_cstr, die_name);
-  if (match) {
-size_t die_name_length = strlen(die_name);
-while (match) {
-  const char separator_char = ';';
-  const char next_char = match[die_name_length];
-  if (next_char == '\0' || next_char == separator_char) {
-if (match == dont_complete_typenames_cstr ||
-match[-1] == separator_char)
-  return false;
-  }
-  match = strstr(match + 1, die_name);
-}
-  }
-}
-  }
-#endif
-
   const dw_tag_t tag = die.Tag();
 
   Log *log =


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1984,39 +1984,6 @@
   if (!die)
 return false;
 
-#if defined LLDB_CONFIGURATION_DEBUG
-  // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES environment
-  // variable can be set with one or more typenames separated by ';'
-  // characters. This will cause this function to not complete any types whose
-  // names match.
-  //
-  // Examples of setting this environment variable:
-  //
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo;Bar;Baz
-  const char *dont_complete_typenames_cstr =
-  getenv("LLDB_DWARF_DONT_COMPLETE_TYPENAMES");
-  if (dont_complete_typenames_cstr && dont_complete_typenames_cstr[0]) {
-const char *die_name = die.GetName();
-if (die_name && die_name[0]) {
-  const char *match = strstr(dont_complete_typenames_cstr, die_name);
-  if (match) {
-size_t die_name_length = strlen(die_name);
-while (match) {
-  const char separator_char = ';';
-  const char next_char = match[die_name_length];
-  if (next_char == '\0' || next_char == separator_char) {
-if (match == dont_complete_typenames_cstr ||
-match[-1] == separator_char)
-  return false;
-  }
-  match = strstr(match + 1, die_name);
-}
-  }
-}
-  }
-#endif
-
   const dw_tag_t tag = die.Tag();
 
   Log *log =
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70796: [LLDB] Always interpret arm instructions as thumb on windows

2019-11-28 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf5c54f40327b: [LLDB] Always interpret arm instructions as 
thumb on windows (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70796

Files:
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/Shell/ObjectFile/PECOFF/disassemble-thumb.yaml

Index: lldb/test/Shell/ObjectFile/PECOFF/disassemble-thumb.yaml
===
--- /dev/null
+++ lldb/test/Shell/ObjectFile/PECOFF/disassemble-thumb.yaml
@@ -0,0 +1,92 @@
+# RUN: yaml2obj %s > %t.exe
+# RUN: %lldb %t.exe -o "disassemble -b -n entry" -b | FileCheck %s
+
+# CHECK: {{.*}}.exe[0x401000] <+0>: 0x0040 lsls   r0, r0, #0x1
+# CHECK: {{.*}}.exe[0x401002] <+2>: 0x4770 bx lr
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4097
+  ImageBase:   4194304
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable:
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable:
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable:
+RelativeVirtualAddress: 0
+Size:0
+  Debug:
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable:
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport:
+RelativeVirtualAddress: 0
+Size:0
+  IAT:
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor:
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader:
+RelativeVirtualAddress: 0
+Size:0
+header:
+  Machine: IMAGE_FILE_MACHINE_ARMNT
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 4
+SectionData: '40007047'
+symbols:
+  - Name:.text
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+  - Name:entry
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+StorageClass:IMAGE_SYM_CLASS_EXTERNAL
+...
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -1443,6 +1443,9 @@
 GetCore() == ArchSpec::Core::eCore_thumbv6m) {
   return true;
 }
+// Windows on ARM is always thumb.
+if (GetTriple().isOSWindows())
+  return true;
   }
   return false;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70802: [lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES

2019-11-28 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

(I landed this straight away as I'm refactoring the surrounding code right now)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70802



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


[Lldb-commits] [lldb] b44e91a - [lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES

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

Author: Raphael Isemann
Date: 2019-11-28T10:21:58+01:00
New Revision: b44e91a472526f01d67ee9ce5de2561216782330

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

LOG: [lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES

Reviewers: labath, clayborg, shafik

Reviewed By: labath

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index df5c81f2e830..51fa90322cf0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1984,39 +1984,6 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const 
DWARFDIE &die,
   if (!die)
 return false;
 
-#if defined LLDB_CONFIGURATION_DEBUG
-  // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES environment
-  // variable can be set with one or more typenames separated by ';'
-  // characters. This will cause this function to not complete any types whose
-  // names match.
-  //
-  // Examples of setting this environment variable:
-  //
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo;Bar;Baz
-  const char *dont_complete_typenames_cstr =
-  getenv("LLDB_DWARF_DONT_COMPLETE_TYPENAMES");
-  if (dont_complete_typenames_cstr && dont_complete_typenames_cstr[0]) {
-const char *die_name = die.GetName();
-if (die_name && die_name[0]) {
-  const char *match = strstr(dont_complete_typenames_cstr, die_name);
-  if (match) {
-size_t die_name_length = strlen(die_name);
-while (match) {
-  const char separator_char = ';';
-  const char next_char = match[die_name_length];
-  if (next_char == '\0' || next_char == separator_char) {
-if (match == dont_complete_typenames_cstr ||
-match[-1] == separator_char)
-  return false;
-  }
-  match = strstr(match + 1, die_name);
-}
-  }
-}
-  }
-#endif
-
   const dw_tag_t tag = die.Tag();
 
   Log *log =



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


[Lldb-commits] [PATCH] D70802: [lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES

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

I have never used this.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70802



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


[Lldb-commits] [PATCH] D70802: [lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES

2019-11-28 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: labath, clayborg.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a reviewer: shafik.
Herald added a project: LLDB.
teemperor added a comment.

I'm fine with keeping this if this feature is actively used by multiple people, 
otherwise this should probably be downstream. If it is actively used I will 
refactor this code instead.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D70802

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1984,39 +1984,6 @@
   if (!die)
 return false;
 
-#if defined LLDB_CONFIGURATION_DEBUG
-  // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES environment
-  // variable can be set with one or more typenames separated by ';'
-  // characters. This will cause this function to not complete any types whose
-  // names match.
-  //
-  // Examples of setting this environment variable:
-  //
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo;Bar;Baz
-  const char *dont_complete_typenames_cstr =
-  getenv("LLDB_DWARF_DONT_COMPLETE_TYPENAMES");
-  if (dont_complete_typenames_cstr && dont_complete_typenames_cstr[0]) {
-const char *die_name = die.GetName();
-if (die_name && die_name[0]) {
-  const char *match = strstr(dont_complete_typenames_cstr, die_name);
-  if (match) {
-size_t die_name_length = strlen(die_name);
-while (match) {
-  const char separator_char = ';';
-  const char next_char = match[die_name_length];
-  if (next_char == '\0' || next_char == separator_char) {
-if (match == dont_complete_typenames_cstr ||
-match[-1] == separator_char)
-  return false;
-  }
-  match = strstr(match + 1, die_name);
-}
-  }
-}
-  }
-#endif
-
   const dw_tag_t tag = die.Tag();
 
   Log *log =


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1984,39 +1984,6 @@
   if (!die)
 return false;
 
-#if defined LLDB_CONFIGURATION_DEBUG
-  // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES environment
-  // variable can be set with one or more typenames separated by ';'
-  // characters. This will cause this function to not complete any types whose
-  // names match.
-  //
-  // Examples of setting this environment variable:
-  //
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo
-  // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo;Bar;Baz
-  const char *dont_complete_typenames_cstr =
-  getenv("LLDB_DWARF_DONT_COMPLETE_TYPENAMES");
-  if (dont_complete_typenames_cstr && dont_complete_typenames_cstr[0]) {
-const char *die_name = die.GetName();
-if (die_name && die_name[0]) {
-  const char *match = strstr(dont_complete_typenames_cstr, die_name);
-  if (match) {
-size_t die_name_length = strlen(die_name);
-while (match) {
-  const char separator_char = ';';
-  const char next_char = match[die_name_length];
-  if (next_char == '\0' || next_char == separator_char) {
-if (match == dont_complete_typenames_cstr ||
-match[-1] == separator_char)
-  return false;
-  }
-  match = strstr(match + 1, die_name);
-}
-  }
-}
-  }
-#endif
-
   const dw_tag_t tag = die.Tag();
 
   Log *log =
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70802: [lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES

2019-11-28 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

I'm fine with keeping this if this feature is actively used by multiple people, 
otherwise this should probably be downstream. If it is actively used I will 
refactor this code instead.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70802



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


[Lldb-commits] [PATCH] D70778: [LLDB] [PECOFF] Factorize mapping section names to types using StringSwitch. NFCI.

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



Comment at: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:803-804
+   (const_sect_name == g_CODE_sect_name))) {
+return eSectionTypeCode;
+  } else if (sect.flags & llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
+ ((const_sect_name == g_data_sect_name) ||

mstorsjo wrote:
> labath wrote:
> > Now that this is a `return`, you don't need the `else` as per 
> > .
> Ok. What about the individual if/return/else/return within the if statements? 
> Is it preferred to keep them as is here, e.g.
> 
> ```
> if (condition) {
>   if (othercondition)
> return eSectionTypeZeroFill;
>   else
> return eSectionTypeData;
> }
> ```
> 
> Or to skip the inner else in the same way?
> ```
> if (condition) {
>   if (othercondition)
> return eSectionTypeZeroFill;
>   return eSectionTypeData;
> }
> ```
> 
> (Ternary operators for keeping just a single return here would be bad for 
> readability IMO, as some conditions aren't entirely trivial.)
Strictly speaking, those should not use `else` either, but I don't think that's 
super important here, so you can leave it as they are now if you want. I'd be 
fine with a ternary operator too, as those conditions are not _that_ 
complicated...


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

https://reviews.llvm.org/D70778



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


[Lldb-commits] [PATCH] D70778: [LLDB] [PECOFF] Factorize mapping section names to types using StringSwitch. NFCI.

2019-11-28 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo marked an inline comment as done.
mstorsjo added inline comments.



Comment at: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:803-804
+   (const_sect_name == g_CODE_sect_name))) {
+return eSectionTypeCode;
+  } else if (sect.flags & llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
+ ((const_sect_name == g_data_sect_name) ||

labath wrote:
> Now that this is a `return`, you don't need the `else` as per 
> .
Ok. What about the individual if/return/else/return within the if statements? 
Is it preferred to keep them as is here, e.g.

```
if (condition) {
  if (othercondition)
return eSectionTypeZeroFill;
  else
return eSectionTypeData;
}
```

Or to skip the inner else in the same way?
```
if (condition) {
  if (othercondition)
return eSectionTypeZeroFill;
  return eSectionTypeData;
}
```

(Ternary operators for keeping just a single return here would be bad for 
readability IMO, as some conditions aren't entirely trivial.)


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

https://reviews.llvm.org/D70778



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


[Lldb-commits] [PATCH] D70796: [LLDB] Always interpret arm instructions as thumb on windows

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

In D70796#1762526 , @mstorsjo wrote:

> And allegedly, in earlier versions, the kernel didn't switch modes correctly 
> when entering the kernel, so entering the kernel from arm code, would try to 
> execute the kernel's code in arm mode, effectively crashing the system


LOL :D


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70796



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