[Lldb-commits] [lldb] c6ce324 - [lldb] Eliminate more Targer* in favor of Target& in CommandObjects (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 2 09:53:40 PDT 2024


Author: Jonas Devlieghere
Date: 2024-08-02T09:53:34-07:00
New Revision: c6ce324fa7fb2438b945fa1205b2a23138327e83

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

LOG: [lldb] Eliminate more Targer* in favor of Target& in CommandObjects (NFC)

The majority of the replaced Target pointers were already used
unconditionally and the few that were shouldn't even be NULL.

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectBreakpoint.cpp
    lldb/source/Commands/CommandObjectBreakpoint.h
    lldb/source/Commands/CommandObjectBreakpointCommand.cpp
    lldb/source/Commands/CommandObjectProcess.cpp
    lldb/source/Commands/CommandObjectSource.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index aad03af11331c..abde27b2b53ad 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -848,7 +848,7 @@ class CommandObjectBreakpointModify : public CommandObjectParsed {
     BreakpointIDList valid_bp_ids;
 
     CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-        command, &target, result, &valid_bp_ids,
+        command, target, result, &valid_bp_ids,
         BreakpointName::Permissions::PermissionKinds::disablePerm);
 
     if (result.Succeeded()) {
@@ -929,7 +929,7 @@ class CommandObjectBreakpointEnable : public CommandObjectParsed {
       // Particular breakpoint selected; enable that breakpoint.
       BreakpointIDList valid_bp_ids;
       CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-          command, &target, result, &valid_bp_ids,
+          command, target, result, &valid_bp_ids,
           BreakpointName::Permissions::PermissionKinds::disablePerm);
 
       if (result.Succeeded()) {
@@ -1035,7 +1035,7 @@ the second re-enables the first location.");
       BreakpointIDList valid_bp_ids;
 
       CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-          command, &target, result, &valid_bp_ids,
+          command, target, result, &valid_bp_ids,
           BreakpointName::Permissions::PermissionKinds::disablePerm);
 
       if (result.Succeeded()) {
@@ -1180,7 +1180,7 @@ class CommandObjectBreakpointList : public CommandObjectParsed {
       // Particular breakpoints selected; show info about that breakpoint.
       BreakpointIDList valid_bp_ids;
       CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-          command, &target, result, &valid_bp_ids,
+          command, target, result, &valid_bp_ids,
           BreakpointName::Permissions::PermissionKinds::listPerm);
 
       if (result.Succeeded()) {
@@ -1459,7 +1459,7 @@ class CommandObjectBreakpointDelete : public CommandObjectParsed {
 
       if (!command.empty()) {
         CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-            command, &target, result, &excluded_bp_ids,
+            command, target, result, &excluded_bp_ids,
             BreakpointName::Permissions::PermissionKinds::deletePerm);
         if (!result.Succeeded())
           return;
@@ -1478,7 +1478,7 @@ class CommandObjectBreakpointDelete : public CommandObjectParsed {
       }
     } else {
       CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-          command, &target, result, &valid_bp_ids,
+          command, target, result, &valid_bp_ids,
           BreakpointName::Permissions::PermissionKinds::deletePerm);
       if (!result.Succeeded())
         return;
@@ -1781,7 +1781,7 @@ class CommandObjectBreakpointNameAdd : public CommandObjectParsed {
     // Particular breakpoint selected; disable that breakpoint.
     BreakpointIDList valid_bp_ids;
     CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs(
-        command, &target, result, &valid_bp_ids,
+        command, target, result, &valid_bp_ids,
         BreakpointName::Permissions::PermissionKinds::listPerm);
 
     if (result.Succeeded()) {
@@ -1855,7 +1855,7 @@ class CommandObjectBreakpointNameDelete : public CommandObjectParsed {
     // Particular breakpoint selected; disable that breakpoint.
     BreakpointIDList valid_bp_ids;
     CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs(
-        command, &target, result, &valid_bp_ids,
+        command, target, result, &valid_bp_ids,
         BreakpointName::Permissions::PermissionKinds::deletePerm);
 
     if (result.Succeeded()) {
@@ -2328,7 +2328,7 @@ class CommandObjectBreakpointWrite : public CommandObjectParsed {
     BreakpointIDList valid_bp_ids;
     if (!command.empty()) {
       CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs(
-          command, &target, result, &valid_bp_ids,
+          command, target, result, &valid_bp_ids,
           BreakpointName::Permissions::PermissionKinds::listPerm);
 
       if (!result.Succeeded()) {
@@ -2410,7 +2410,7 @@ CommandObjectMultiwordBreakpoint::CommandObjectMultiwordBreakpoint(
 CommandObjectMultiwordBreakpoint::~CommandObjectMultiwordBreakpoint() = default;
 
 void CommandObjectMultiwordBreakpoint::VerifyIDs(
-    Args &args, Target *target, bool allow_locations,
+    Args &args, Target &target, bool allow_locations,
     CommandReturnObject &result, BreakpointIDList *valid_ids,
     BreakpointName::Permissions ::PermissionKinds purpose) {
   // args can be strings representing 1). integers (for breakpoint ids)
@@ -2427,9 +2427,9 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(
   Args temp_args;
 
   if (args.empty()) {
-    if (target->GetLastCreatedBreakpoint()) {
+    if (target.GetLastCreatedBreakpoint()) {
       valid_ids->AddBreakpointID(BreakpointID(
-          target->GetLastCreatedBreakpoint()->GetID(), LLDB_INVALID_BREAK_ID));
+          target.GetLastCreatedBreakpoint()->GetID(), LLDB_INVALID_BREAK_ID));
       result.SetStatus(eReturnStatusSuccessFinishNoResult);
     } else {
       result.AppendError(
@@ -2445,7 +2445,7 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(
   // into TEMP_ARGS.
 
   if (llvm::Error err = BreakpointIDList::FindAndReplaceIDRanges(
-          args, target, allow_locations, purpose, temp_args)) {
+          args, &target, allow_locations, purpose, temp_args)) {
     result.SetError(std::move(err));
     return;
   }
@@ -2469,7 +2469,7 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(
   for (size_t i = 0; i < count; ++i) {
     BreakpointID cur_bp_id = valid_ids->GetBreakpointIDAtIndex(i);
     Breakpoint *breakpoint =
-        target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+        target.GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
     if (breakpoint != nullptr) {
       const size_t num_locations = breakpoint->GetNumLocations();
       if (static_cast<size_t>(cur_bp_id.GetLocationID()) > num_locations) {

diff  --git a/lldb/source/Commands/CommandObjectBreakpoint.h b/lldb/source/Commands/CommandObjectBreakpoint.h
index 6625652b260b2..40c67157e07c4 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.h
+++ b/lldb/source/Commands/CommandObjectBreakpoint.h
@@ -23,21 +23,21 @@ class CommandObjectMultiwordBreakpoint : public CommandObjectMultiword {
   ~CommandObjectMultiwordBreakpoint() override;
 
   static void VerifyBreakpointOrLocationIDs(
-      Args &args, Target *target, CommandReturnObject &result,
+      Args &args, Target &target, CommandReturnObject &result,
       BreakpointIDList *valid_ids,
       BreakpointName::Permissions ::PermissionKinds purpose) {
     VerifyIDs(args, target, true, result, valid_ids, purpose);
   }
 
   static void
-  VerifyBreakpointIDs(Args &args, Target *target, CommandReturnObject &result,
+  VerifyBreakpointIDs(Args &args, Target &target, CommandReturnObject &result,
                       BreakpointIDList *valid_ids,
                       BreakpointName::Permissions::PermissionKinds purpose) {
     VerifyIDs(args, target, false, result, valid_ids, purpose);
   }
 
 private:
-  static void VerifyIDs(Args &args, Target *target, bool allow_locations,
+  static void VerifyIDs(Args &args, Target &target, bool allow_locations,
                         CommandReturnObject &result,
                         BreakpointIDList *valid_ids,
                         BreakpointName::Permissions::PermissionKinds purpose);

diff  --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 8c1fb513e016e..23ea4224a789a 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -343,7 +343,7 @@ are no syntax errors may indicate that a function was declared but never called.
 
     BreakpointIDList valid_bp_ids;
     CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-        command, &target, result, &valid_bp_ids,
+        command, target, result, &valid_bp_ids,
         BreakpointName::Permissions::PermissionKinds::listPerm);
 
     m_bp_options_vec.clear();
@@ -499,7 +499,7 @@ class CommandObjectBreakpointCommandDelete : public CommandObjectParsed {
 
     BreakpointIDList valid_bp_ids;
     CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-        command, &target, result, &valid_bp_ids,
+        command, target, result, &valid_bp_ids,
         BreakpointName::Permissions::PermissionKinds::listPerm);
 
     if (result.Succeeded()) {
@@ -566,7 +566,7 @@ class CommandObjectBreakpointCommandList : public CommandObjectParsed {
 
     BreakpointIDList valid_bp_ids;
     CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
-        command, &target, result, &valid_bp_ids,
+        command, target, result, &valid_bp_ids,
         BreakpointName::Permissions::PermissionKinds::listPerm);
 
     if (result.Succeeded()) {

diff  --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index e8174ca6ddace..28413b7a8591f 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -510,7 +510,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed {
         }
       }
 
-      Target *target = m_exe_ctx.GetTargetPtr();
+      Target &target = GetTarget();
       BreakpointIDList run_to_bkpt_ids;
       // Don't pass an empty run_to_breakpoint list, as Verify will look for the
       // default breakpoint.
@@ -538,7 +538,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed {
         // the breakpoint.location specifications since the latter require
         // special handling.  We also figure out whether there's at least one
         // specifier in the set that is enabled.
-        BreakpointList &bkpt_list = target->GetBreakpointList();
+        BreakpointList &bkpt_list = target.GetBreakpointList();
         std::unordered_set<break_id_t> bkpts_seen;
         std::unordered_set<break_id_t> bkpts_with_locs_seen;
         BreakpointIDList with_locs;
@@ -666,7 +666,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed {
       }
 
       // Now re-enable the breakpoints we disabled:
-      BreakpointList &bkpt_list = target->GetBreakpointList();
+      BreakpointList &bkpt_list = target.GetBreakpointList();
       for (break_id_t bp_id : bkpts_disabled) {
         BreakpointSP bp_sp = bkpt_list.FindBreakpointByID(bp_id);
         if (bp_sp)

diff  --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index f54b712adfc46..98907c459366f 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -142,7 +142,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
     uint32_t start_line = m_options.start_line;
     uint32_t end_line = m_options.end_line;
     uint32_t num_lines = m_options.num_lines;
-    Target *target = m_exe_ctx.GetTargetPtr();
+    Target &target = GetTarget();
 
     uint32_t num_matches = 0;
     // Dump all the line entries for the file in the list.
@@ -177,7 +177,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
         }
         // Dump the line entry.
         line_entry.GetDescription(&strm, lldb::eDescriptionLevelBrief, cu,
-                                  target, /*show_address_only=*/false);
+                                  &target, /*show_address_only=*/false);
         strm << "\n";
         last_module_file_name = module_file_name;
         num_matches++;
@@ -197,7 +197,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
     uint32_t start_line = m_options.start_line;
     uint32_t end_line = m_options.end_line;
     uint32_t num_lines = m_options.num_lines;
-    Target *target = m_exe_ctx.GetTargetPtr();
+    Target &target = GetTarget();
 
     uint32_t num_matches = 0;
     assert(module);
@@ -250,7 +250,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
               cu_header_printed = true;
             }
             line_entry.GetDescription(&strm, lldb::eDescriptionLevelBrief, cu,
-                                      target, /*show_address_only=*/false);
+                                      &target, /*show_address_only=*/false);
             strm << "\n";
 
             // Anymore after this one?
@@ -301,8 +301,8 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
     Address so_addr;
     size_t num_matches = 0;
     assert(module_list.GetSize() > 0);
-    Target *target = m_exe_ctx.GetTargetPtr();
-    if (target->GetSectionLoadList().IsEmpty()) {
+    Target &target = GetTarget();
+    if (target.GetSectionLoadList().IsEmpty()) {
       // The target isn't loaded yet, we need to lookup the file address in all
       // modules.  Note: the module list option does not apply to addresses.
       const size_t num_modules = module_list.GetSize();
@@ -328,7 +328,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
     } else {
       // The target has some things loaded, resolve this address to a compile
       // unit + file + line and display
-      if (target->GetSectionLoadList().ResolveLoadAddress(addr, so_addr)) {
+      if (target.GetSectionLoadList().ResolveLoadAddress(addr, so_addr)) {
         ModuleSP module_sp(so_addr.GetModule());
         // Check to make sure this module is in our list.
         if (module_sp && module_list.GetIndexForModule(module_sp.get()) !=
@@ -370,8 +370,8 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
     SymbolContextList sc_list_funcs;
     ConstString name(m_options.symbol_name.c_str());
     SymbolContextList sc_list_lines;
-    Target *target = m_exe_ctx.GetTargetPtr();
-    uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+    Target &target = GetTarget();
+    uint32_t addr_byte_size = target.GetArchitecture().GetAddressByteSize();
 
     ModuleFunctionSearchOptions function_options;
     function_options.include_symbols = false;
@@ -380,7 +380,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
     // Note: module_list can't be const& because FindFunctionSymbols isn't
     // const.
     ModuleList module_list =
-        (m_module_list.GetSize() > 0) ? m_module_list : target->GetImages();
+        (m_module_list.GetSize() > 0) ? m_module_list : target.GetImages();
     module_list.FindFunctions(name, eFunctionNameTypeAuto, function_options,
                               sc_list_funcs);
     size_t num_matches = sc_list_funcs.GetSize();
@@ -419,7 +419,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
         // sc_list_lines.
         const Address &base_address = range.GetBaseAddress();
         const addr_t size = range.GetByteSize();
-        lldb::addr_t start_addr = base_address.GetLoadAddress(target);
+        lldb::addr_t start_addr = base_address.GetLoadAddress(&target);
         if (start_addr == LLDB_INVALID_ADDRESS)
           start_addr = base_address.GetFileAddress();
         lldb::addr_t end_addr = start_addr + size;
@@ -459,11 +459,11 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
 
   // Dump the line entries found for the address specified in the option.
   bool DumpLinesForAddress(CommandReturnObject &result) {
-    Target *target = m_exe_ctx.GetTargetPtr();
+    Target &target = GetTarget();
     SymbolContextList sc_list;
 
     StreamString error_strm;
-    if (!GetSymbolContextsForAddress(target->GetImages(), m_options.address,
+    if (!GetSymbolContextsForAddress(target.GetImages(), m_options.address,
                                      sc_list, error_strm)) {
       result.AppendErrorWithFormat("%s.\n", error_strm.GetData());
       return false;
@@ -484,9 +484,9 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
   bool DumpLinesForFile(CommandReturnObject &result) {
     FileSpec file_spec(m_options.file_name);
     const char *filename = m_options.file_name.c_str();
-    Target *target = m_exe_ctx.GetTargetPtr();
+    Target &target = GetTarget();
     const ModuleList &module_list =
-        (m_module_list.GetSize() > 0) ? m_module_list : target->GetImages();
+        (m_module_list.GetSize() > 0) ? m_module_list : target.GetImages();
 
     bool displayed_something = false;
     const size_t num_modules = module_list.GetSize();
@@ -533,17 +533,9 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
   }
 
   void DoExecute(Args &command, CommandReturnObject &result) override {
-    Target *target = m_exe_ctx.GetTargetPtr();
-    if (target == nullptr) {
-      target = GetDebugger().GetSelectedTarget().get();
-      if (target == nullptr) {
-        result.AppendError("invalid target, create a debug target using the "
-                           "'target create' command.");
-        return;
-      }
-    }
+    Target &target = GetTarget();
 
-    uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+    uint32_t addr_byte_size = target.GetArchitecture().GetAddressByteSize();
     result.GetOutputStream().SetAddressByteSize(addr_byte_size);
     result.GetErrorStream().SetAddressByteSize(addr_byte_size);
 
@@ -554,7 +546,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
         FileSpec module_file_spec(m_options.modules[i]);
         if (module_file_spec) {
           ModuleSpec module_spec(module_file_spec);
-          target->GetImages().FindModules(module_spec, m_module_list);
+          target.GetImages().FindModules(module_spec, m_module_list);
           if (m_module_list.IsEmpty())
             result.AppendWarningWithFormat("No module found for '%s'.\n",
                                            m_options.modules[i].c_str());
@@ -564,7 +556,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed {
         result.AppendError("No modules match the input.");
         return;
       }
-    } else if (target->GetImages().GetSize() == 0) {
+    } else if (target.GetImages().GetSize() == 0) {
       result.AppendError("The target has no associated executable images.");
       return;
     }
@@ -784,7 +776,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
     }
 
     if (sc.function) {
-      Target *target = m_exe_ctx.GetTargetPtr();
+      Target &target = GetTarget();
 
       FileSpec start_file;
       uint32_t start_line;
@@ -844,7 +836,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
                                      start_file.GetPath().c_str());
       // We don't care about the column here.
       const uint32_t column = 0;
-      return target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
+      return target.GetSourceManager().DisplaySourceLinesWithLineNumbers(
           start_file, line_no, column, 0, m_options.num_lines, "",
           &result.GetOutputStream(), GetBreakpointLocations());
     } else {
@@ -862,7 +854,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
   // these somewhere, there should probably be a module-filter-list that can be
   // passed to the various ModuleList::Find* calls, which would either be a
   // vector of string names or a ModuleSpecList.
-  void FindMatchingFunctions(Target *target, ConstString name,
+  void FindMatchingFunctions(Target &target, ConstString name,
                              SymbolContextList &sc_list) {
     // Displaying the source for a symbol:
     if (m_options.num_lines == 0)
@@ -880,19 +872,19 @@ class CommandObjectSourceList : public CommandObjectParsed {
         if (module_file_spec) {
           ModuleSpec module_spec(module_file_spec);
           matching_modules.Clear();
-          target->GetImages().FindModules(module_spec, matching_modules);
+          target.GetImages().FindModules(module_spec, matching_modules);
 
           matching_modules.FindFunctions(name, eFunctionNameTypeAuto,
                                          function_options, sc_list);
         }
       }
     } else {
-      target->GetImages().FindFunctions(name, eFunctionNameTypeAuto,
-                                        function_options, sc_list);
+      target.GetImages().FindFunctions(name, eFunctionNameTypeAuto,
+                                       function_options, sc_list);
     }
   }
 
-  void FindMatchingFunctionSymbols(Target *target, ConstString name,
+  void FindMatchingFunctionSymbols(Target &target, ConstString name,
                                    SymbolContextList &sc_list) {
     const size_t num_modules = m_options.modules.size();
     if (num_modules > 0) {
@@ -902,19 +894,19 @@ class CommandObjectSourceList : public CommandObjectParsed {
         if (module_file_spec) {
           ModuleSpec module_spec(module_file_spec);
           matching_modules.Clear();
-          target->GetImages().FindModules(module_spec, matching_modules);
+          target.GetImages().FindModules(module_spec, matching_modules);
           matching_modules.FindFunctionSymbols(name, eFunctionNameTypeAuto,
                                                sc_list);
         }
       }
     } else {
-      target->GetImages().FindFunctionSymbols(name, eFunctionNameTypeAuto,
-                                              sc_list);
+      target.GetImages().FindFunctionSymbols(name, eFunctionNameTypeAuto,
+                                             sc_list);
     }
   }
 
   void DoExecute(Args &command, CommandReturnObject &result) override {
-    Target *target = m_exe_ctx.GetTargetPtr();
+    Target &target = GetTarget();
 
     if (!m_options.symbol_name.empty()) {
       SymbolContextList sc_list;
@@ -967,10 +959,10 @@ class CommandObjectSourceList : public CommandObjectParsed {
       StreamString error_strm;
       SymbolContextList sc_list;
 
-      if (target->GetSectionLoadList().IsEmpty()) {
+      if (target.GetSectionLoadList().IsEmpty()) {
         // The target isn't loaded yet, we need to lookup the file address in
         // all modules
-        const ModuleList &module_list = target->GetImages();
+        const ModuleList &module_list = target.GetImages();
         const size_t num_modules = module_list.GetSize();
         for (size_t i = 0; i < num_modules; ++i) {
           ModuleSP module_sp(module_list.GetModuleAtIndex(i));
@@ -995,8 +987,8 @@ class CommandObjectSourceList : public CommandObjectParsed {
       } else {
         // The target has some things loaded, resolve this address to a compile
         // unit + file + line and display
-        if (target->GetSectionLoadList().ResolveLoadAddress(m_options.address,
-                                                            so_addr)) {
+        if (target.GetSectionLoadList().ResolveLoadAddress(m_options.address,
+                                                           so_addr)) {
           ModuleSP module_sp(so_addr.GetModule());
           if (module_sp) {
             SymbolContext sc;
@@ -1032,7 +1024,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
             m_breakpoint_locations.Reset(sc.comp_unit->GetPrimaryFile(), 0,
                                          show_inlines);
             SearchFilterForUnconstrainedSearches target_search_filter(
-                target->shared_from_this());
+                target.shared_from_this());
             target_search_filter.Search(m_breakpoint_locations);
           }
 
@@ -1058,7 +1050,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
               (GetDebugger().GetStopShowColumn() != eStopShowColumnNone)
                   ? sc.line_entry.column
                   : 0;
-          target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
+          target.GetSourceManager().DisplaySourceLinesWithLineNumbers(
               sc.comp_unit->GetPrimaryFile(), sc.line_entry.line, column,
               lines_to_back_up, m_options.num_lines - lines_to_back_up, "->",
               &result.GetOutputStream(), GetBreakpointLocations());
@@ -1071,7 +1063,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
       // exact same list command twice in a row, it is more likely because you
       // typed it once, then typed it again
       if (m_options.start_line == 0) {
-        if (target->GetSourceManager().DisplayMoreWithLineNumbers(
+        if (target.GetSourceManager().DisplayMoreWithLineNumbers(
                 &result.GetOutputStream(), m_options.num_lines,
                 m_options.reverse, GetBreakpointLocations())) {
           result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -1082,20 +1074,20 @@ class CommandObjectSourceList : public CommandObjectParsed {
 
         if (m_options.show_bp_locs) {
           SourceManager::FileSP last_file_sp(
-              target->GetSourceManager().GetLastFile());
+              target.GetSourceManager().GetLastFile());
           if (last_file_sp) {
             const bool show_inlines = true;
             m_breakpoint_locations.Reset(last_file_sp->GetFileSpec(), 0,
                                          show_inlines);
             SearchFilterForUnconstrainedSearches target_search_filter(
-                target->shared_from_this());
+                target.shared_from_this());
             target_search_filter.Search(m_breakpoint_locations);
           }
         } else
           m_breakpoint_locations.Clear();
 
         const uint32_t column = 0;
-        if (target->GetSourceManager()
+        if (target.GetSourceManager()
                 .DisplaySourceLinesWithLineNumbersUsingLastFile(
                     m_options.start_line, // Line to display
                     m_options.num_lines,  // Lines after line to
@@ -1120,7 +1112,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
           if (module_file_spec) {
             ModuleSpec module_spec(module_file_spec);
             matching_modules.Clear();
-            target->GetImages().FindModules(module_spec, matching_modules);
+            target.GetImages().FindModules(module_spec, matching_modules);
             num_matches += matching_modules.ResolveSymbolContextForFilePath(
                 filename, 0, check_inlines,
                 SymbolContextItem(eSymbolContextModule |
@@ -1129,7 +1121,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
           }
         }
       } else {
-        num_matches = target->GetImages().ResolveSymbolContextForFilePath(
+        num_matches = target.GetImages().ResolveSymbolContextForFilePath(
             filename, 0, check_inlines,
             eSymbolContextModule | eSymbolContextCompUnit, sc_list);
       }
@@ -1170,7 +1162,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
             m_breakpoint_locations.Reset(sc.comp_unit->GetPrimaryFile(), 0,
                                          show_inlines);
             SearchFilterForUnconstrainedSearches target_search_filter(
-                target->shared_from_this());
+                target.shared_from_this());
             target_search_filter.Search(m_breakpoint_locations);
           } else
             m_breakpoint_locations.Clear();
@@ -1178,7 +1170,7 @@ class CommandObjectSourceList : public CommandObjectParsed {
           if (m_options.num_lines == 0)
             m_options.num_lines = 10;
           const uint32_t column = 0;
-          target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
+          target.GetSourceManager().DisplaySourceLinesWithLineNumbers(
               sc.comp_unit->GetPrimaryFile(), m_options.start_line, column, 0,
               m_options.num_lines, "", &result.GetOutputStream(),
               GetBreakpointLocations());


        


More information about the lldb-commits mailing list