Skip to content

[lldb] Remove (unused) SymbolContext::Dump #123211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2025
Merged

[lldb] Remove (unused) SymbolContext::Dump #123211

merged 1 commit into from
Jan 17, 2025

Conversation

labath
Copy link
Collaborator

@labath labath commented Jan 16, 2025

We still have GetDescription and DumpStopContext which serve a similar purpose.

(The main reason this is bothering me is because I'm working through the uses of (deprecated) Function::GetAddressRange.)

We still have GetDescription and DumpStopContext which serve a similar
purpose.

(The main reason this is bothering me is because I'm working through the
uses of (deprecated) Function::GetAddressRange.)
@labath labath requested a review from jimingham January 16, 2025 14:44
@labath labath requested a review from JDevlieghere as a code owner January 16, 2025 14:44
@llvmbot llvmbot added the lldb label Jan 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 16, 2025

@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)

Changes

We still have GetDescription and DumpStopContext which serve a similar purpose.

(The main reason this is bothering me is because I'm working through the uses of (deprecated) Function::GetAddressRange.)


Full diff: https://github.com/llvm/llvm-project/pull/123211.diff

2 Files Affected:

  • (modified) lldb/include/lldb/Symbol/SymbolContext.h (-9)
  • (modified) lldb/source/Symbol/SymbolContext.cpp (-59)
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h
index f65f57b0d11034..07769cd8dffae7 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -91,15 +91,6 @@ class SymbolContext {
   /// their default state.
   void Clear(bool clear_target);
 
-  /// Dump a description of this object to a Stream.
-  ///
-  /// Dump a description of the contents of this object to the supplied stream
-  /// \a s.
-  ///
-  /// \param[in] s
-  ///     The stream to which to dump the object description.
-  void Dump(Stream *s, Target *target) const;
-
   /// Dump the stop context in this object to a Stream.
   ///
   /// Dump the best description of this object to the stream. The information
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 19b6ff6a5302b7..f4270ee8396760 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -317,65 +317,6 @@ uint32_t SymbolContext::GetResolvedMask() const {
   return resolved_mask;
 }
 
-void SymbolContext::Dump(Stream *s, Target *target) const {
-  *s << this << ": ";
-  s->Indent();
-  s->PutCString("SymbolContext");
-  s->IndentMore();
-  s->EOL();
-  s->IndentMore();
-  s->Indent();
-  *s << "Module       = " << module_sp.get() << ' ';
-  if (module_sp)
-    module_sp->GetFileSpec().Dump(s->AsRawOstream());
-  s->EOL();
-  s->Indent();
-  *s << "CompileUnit  = " << comp_unit;
-  if (comp_unit != nullptr)
-    s->Format(" {{{0:x-16}} {1}", comp_unit->GetID(),
-              comp_unit->GetPrimaryFile());
-  s->EOL();
-  s->Indent();
-  *s << "Function     = " << function;
-  if (function != nullptr) {
-    s->Format(" {{{0:x-16}} {1}, address-range = ", function->GetID(),
-              function->GetType()->GetName());
-    function->GetAddressRange().Dump(s, target, Address::DumpStyleLoadAddress,
-                                     Address::DumpStyleModuleWithFileAddress);
-    s->EOL();
-    s->Indent();
-    Type *func_type = function->GetType();
-    if (func_type) {
-      *s << "        Type = ";
-      func_type->Dump(s, false);
-    }
-  }
-  s->EOL();
-  s->Indent();
-  *s << "Block        = " << block;
-  if (block != nullptr)
-    s->Format(" {{{0:x-16}}", block->GetID());
-  s->EOL();
-  s->Indent();
-  *s << "LineEntry    = ";
-  line_entry.Dump(s, target, true, Address::DumpStyleLoadAddress,
-                  Address::DumpStyleModuleWithFileAddress, true);
-  s->EOL();
-  s->Indent();
-  *s << "Symbol       = " << symbol;
-  if (symbol != nullptr && symbol->GetMangled())
-    *s << ' ' << symbol->GetName().AsCString();
-  s->EOL();
-  *s << "Variable     = " << variable;
-  if (variable != nullptr) {
-    s->Format(" {{{0:x-16}} {1}", variable->GetID(),
-              variable->GetType()->GetName());
-    s->EOL();
-  }
-  s->IndentLess();
-  s->IndentLess();
-}
-
 bool lldb_private::operator==(const SymbolContext &lhs,
                               const SymbolContext &rhs) {
   return lhs.function == rhs.function && lhs.symbol == rhs.symbol &&

@jimingham
Copy link
Collaborator

Originally the idea was that GetDescription was for showing to users and Dump was like the llvm dump, it was meant to show all the gory details and you weren't supposed to call it in code so much as by hand when debugging. So that it is unused doesn't really mean it isn't unused in practice. OTOH the fact that this dump really does pretty much exactly what GetDescription does is a good argument it isn't needed - there aren't, after all, much in the way of gory details in a SymbolContext...

Copy link
Collaborator

@jimingham jimingham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@labath labath merged commit 1181921 into llvm:main Jan 17, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants