jingham created this revision.
jingham added a reviewer: JDevlieghere.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Thread until was assuming that if you have debug information, you will have a 
function.  Apparently some hand-crafted cross-library stubs can have debug 
information but no functions, and that was causing lldb to crash.  This patch 
just adds a check for the function as well, and we error out if we don't have a 
function.  The patch is sufficiently obvious I don't think it warrants the 
effort to make one of these odd constructs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119297

Files:
  lldb/source/Commands/CommandObjectThread.cpp


Index: lldb/source/Commands/CommandObjectThread.cpp
===================================================================
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -960,7 +960,14 @@
         uint32_t index_ptr = 0, end_ptr;
         std::vector<addr_t> address_list;
 
-        // Find the beginning & end index of the
+        // Find the beginning & end index of the function, but first make
+        // sure it is valid:
+        if (!sc.function) {
+          result.AppendErrorWithFormat("Have debug information but no "
+                                       "function info - can't get until 
range.");
+          return false;
+        }
+
         AddressRange fun_addr_range = sc.function->GetAddressRange();
         Address fun_start_addr = fun_addr_range.GetBaseAddress();
         line_table->FindLineEntryByAddress(fun_start_addr, function_start,


Index: lldb/source/Commands/CommandObjectThread.cpp
===================================================================
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -960,7 +960,14 @@
         uint32_t index_ptr = 0, end_ptr;
         std::vector<addr_t> address_list;
 
-        // Find the beginning & end index of the
+        // Find the beginning & end index of the function, but first make
+        // sure it is valid:
+        if (!sc.function) {
+          result.AppendErrorWithFormat("Have debug information but no "
+                                       "function info - can't get until range.");
+          return false;
+        }
+
         AddressRange fun_addr_range = sc.function->GetAddressRange();
         Address fun_start_addr = fun_addr_range.GetBaseAddress();
         line_table->FindLineEntryByAddress(fun_start_addr, function_start,
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] ... Jim Ingham via Phabricator via lldb-commits

Reply via email to