This revision was automatically updated to reflect the committed changes.
Closed by commit rG99ea2c461d14: [lldb] Refactor the Symbolicator initializer
(authored by JDevlieghere).
Herald added a project: LLDB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92601/new/
https://reviews.llvm.org/D92601
Files:
lldb/examples/python/symbolication.py
Index: lldb/examples/python/symbolication.py
===================================================================
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -437,18 +437,22 @@
class Symbolicator:
- def __init__(self, debugger):
- """A class the represents the information needed to symbolicate
addresses in a program"""
+ def __init__(self, debugger=None, target=None, images=list()):
+ """A class the represents the information needed to symbolicate
+ addresses in a program.
+
+ Do not call this initializer directly, but rather use the factory
+ methods.
+ """
self.debugger = debugger
- self.target = None
- self.images = list() # a list of images to be used when symbolicating
+ self.target = target
+ self.images = images # a list of images to be used when symbolicating
self.addr_mask = 0xffffffffffffffff
@classmethod
def InitWithSBTarget(cls, target):
- obj = cls()
- obj.target = target
- obj.images = list()
+ """Initialize a new Symbolicator with an existing SBTarget."""
+ obj = cls(target=target)
triple = target.triple
if triple:
arch = triple.split('-')[0]
@@ -460,6 +464,13 @@
obj.images.append(image)
return obj
+ @classmethod
+ def InitWithSBDebugger(cls, debugger, images):
+ """Initialize a new Symbolicator with an existing debugger and list of
+ images. The Symbolicator will create the target."""
+ obj = cls(debugger=debugger, images=images)
+ return obj
+
def __str__(self):
s = "Symbolicator:\n"
if self.target:
Index: lldb/examples/python/symbolication.py
===================================================================
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -437,18 +437,22 @@
class Symbolicator:
- def __init__(self, debugger):
- """A class the represents the information needed to symbolicate addresses in a program"""
+ def __init__(self, debugger=None, target=None, images=list()):
+ """A class the represents the information needed to symbolicate
+ addresses in a program.
+
+ Do not call this initializer directly, but rather use the factory
+ methods.
+ """
self.debugger = debugger
- self.target = None
- self.images = list() # a list of images to be used when symbolicating
+ self.target = target
+ self.images = images # a list of images to be used when symbolicating
self.addr_mask = 0xffffffffffffffff
@classmethod
def InitWithSBTarget(cls, target):
- obj = cls()
- obj.target = target
- obj.images = list()
+ """Initialize a new Symbolicator with an existing SBTarget."""
+ obj = cls(target=target)
triple = target.triple
if triple:
arch = triple.split('-')[0]
@@ -460,6 +464,13 @@
obj.images.append(image)
return obj
+ @classmethod
+ def InitWithSBDebugger(cls, debugger, images):
+ """Initialize a new Symbolicator with an existing debugger and list of
+ images. The Symbolicator will create the target."""
+ obj = cls(debugger=debugger, images=images)
+ return obj
+
def __str__(self):
s = "Symbolicator:\n"
if self.target:
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits