Bug 65574 - Addition to Tools/gdb/webkit.py to view graph of loader-related objects
Summary: Addition to Tools/gdb/webkit.py to view graph of loader-related objects
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Scott Graham
Depends on:
Reported: 2011-08-02 14:24 PDT by Scott Graham
Modified: 2012-04-19 15:30 PDT (History)
5 users (show)

See Also:

Patch (6.18 KB, patch)
2011-08-02 14:33 PDT, Scott Graham
ojan: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Graham 2011-08-02 14:24:32 PDT
GDB Python script that outputs a diagram of a subset of fields for each object, and the graph of connected objects.

Generic code, can be used for other subsystems, along with one concrete gdb command "viewloadergraph" which works on xxxLoader and related.
Comment 1 Scott Graham 2011-08-02 14:33:38 PDT
Created attachment 102701 [details]
Comment 2 WebKit Review Bot 2011-08-02 14:36:27 PDT
Attachment 102701 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/gdb/webkit.py']" exit_code: 1

Tools/gdb/webkit.py:424:  missing whitespace around operator  [pep8/E225] [5]
Tools/gdb/webkit.py:431:  missing whitespace around operator  [pep8/E225] [5]
Tools/gdb/webkit.py:432:  missing whitespace around operator  [pep8/E225] [5]
Tools/gdb/webkit.py:438:  whitespace before '}'  [pep8/E202] [5]
Tools/gdb/webkit.py:452:  whitespace before ']'  [pep8/E202] [5]
Total errors found: 5 in 2 files

If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Hajime Morrita 2011-08-18 22:26:35 PDT
CC-ed one who knows it well.
Comment 4 Hayato Ito 2011-08-18 23:38:23 PDT
Comment on attachment 102701 [details]

Looks very useful command. Could you upload a sample png or a dot file? I'd like to see it.

Some minor comments follows.

View in context: https://bugs.webkit.org/attachment.cgi?id=102701&action=review

> Tools/gdb/webkit.py:41
> +import os

Please sort this lexicologically.

> Tools/gdb/webkit.py:354
> +        self.ptr_type = gdb.lookup_type('void').pointer()

Is this member variable used?

> Tools/gdb/webkit.py:357
> +        return label.replace('\\', '\\\\').replace('"', '\\"')

Can you use a raw string here? (r'\', r'\\' instead of '\\', '\\\\').

> Tools/gdb/webkit.py:366
> +        conns = []

Could you avoid abbreviations?
I think we don't have a clear style guide for gdb's Python script. But it should be better to avoid abbreviations, following other Python scripts used in WebKit.

> Tools/gdb/webkit.py:369
> +        if target_type in self.typemap:

Could you early exit here to reduce the indent level?

> Tools/gdb/webkit.py:376
> +                fieldsidx = 0

Could you use fields_idx instead of fields_idx?

> Tools/gdb/webkit.py:377
> +                prefixchar = '.'

Could you use prefix_char?

>> Tools/gdb/webkit.py:424
>> +        print >>f, """digraph g {
> missing whitespace around operator  [pep8/E225] [5]

Could you use f.write(...) instead of print statement?
Comment 5 Ojan Vafai 2012-04-19 15:30:45 PDT
Comment on attachment 102701 [details]

r- per unaddressed comments in comment 4.