Commit 17a8e3c4 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

Bug 1253436 - Add __repr__ to BaseLibrary and BaseProgram; r=glandium

Now when we print instances in a debugger, we'll see something like:

<StaticLibrary: other-licenses/snappy/libother-licenses_snappy.a>
<StaticLibrary: toolkit/library/StaticXULComponentsEnd/libStaticXULComponentsEnd.a>
<SharedLibrary: toolkit/library/XUL>
<StaticLibrary: toolkit/library/libxul_s.a>
<HostProgram: config/nsinstall_real>
<Program: memory/replace/logalloc/replay/logalloc-replay>
<SimpleProgram: mfbt/tests/TestArrayUtils>

... instead of the the class name and memory address.

MozReview-Commit-ID: 8zdrM6KfP8U

--HG--
extra : source : 84849ad026c9ba1bbf71c93172b0a03440e51bec
parent 6bc67323
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -366,6 +366,9 @@ class BaseProgram(Linkable):
        self.program = program
        self.is_unit_test = is_unit_test

    def __repr__(self):
        return '<%s: %s/%s>' % (type(self).__name__, self.relobjdir, self.program)


class Program(BaseProgram):
    """Context derived container object for PROGRAM"""
@@ -415,6 +418,9 @@ class BaseLibrary(Linkable):

        self.refs = []

    def __repr__(self):
        return '<%s: %s/%s>' % (type(self).__name__, self.relobjdir, self.lib_name)


class Library(BaseLibrary):
    """Context derived container object for a library"""