Changes
authorJorge Gorbe <j.gorbe@stcsl.es>
Thu, 8 Nov 2012 17:50:15 +0000 (18:50 +0100)
committerJorge Gorbe <j.gorbe@stcsl.es>
Thu, 8 Nov 2012 17:50:15 +0000 (18:50 +0100)
samples/view.py
slides/index.html
slides/its-free.jpg [new file with mode: 0644]

index 70f9a636d6cbdca3b0c2bb7f9962406d201fb45c..49cfffb205c99b8fc4711129e947a2409db63d9d 100644 (file)
@@ -19,15 +19,19 @@ def type_has_fields(t):
 
 def type_is_pointer(t):
     basic_type = gdb.types.get_basic_type(t)
-    return basic_type.code == gdb.TYPE_CODE_PTR
+    return basic_type.code == gdb.TYPE_CODE_PTR or basic_type.code == gdb.TYPE_CODE_REF
 
 def find_outgoing_pointers(value):
     """Finds all outgoing pointers from a value, traversing each non-pointer member of a composite type
     (e.g. struct members inside structs) and also each member in every base class, recursively.
     Returns a dict of {field_name:address} where field_name is a string, and address is a gdb.Value."""
-    if type_is_pointer(value.dynamic_type):
+    try:
+        valuetype = value.dynamic_type
+    except gdb.error:
+        valuetype = value.type
+    if type_is_pointer(valuetype):
         return {"*": value}
-    elif type_has_fields(value.dynamic_type):
+    elif type_has_fields(valuetype):
         result = {}
         for f in value.type.fields():
             if f.is_base_class:
@@ -388,7 +392,7 @@ def visit_values(node_dict, value, x, y, recursion_level):
     for (child_name, child_value) in children.iteritems():
         # compute child "tree" dimensions (layout is always tree-like even if there are edges that make this a generic graph)
         if child_value != 0:
-            child_width, child_height = visit_values(node_dict, child_value.dereference(), children_x, children_y, recursion_level - 1)
+            child_width, child_height = visit_values(node_dict, child_value.referenced_value(), children_x, children_y, recursion_level - 1)
             children_y += child_height
             children_height += child_height
             width = max(width, NODE_SPACING + child_width)
index 510d5ce0ab1aa24cf17865e1469a5e27f5c5e130..968388b639a9dbb3d7b856bc3d851d756538ef1c 100644 (file)
@@ -126,8 +126,7 @@ End with a line saying just "end".
                 <h2> Custom commands (2/3) </h2>
                 <p>A more complex example, from PpluX's <a href="http://code.google.com/p/slb/source/browse/extra/lua_utils.gdb?name=default">SLB repo</a></p>
 
-<pre>
-define luastack
+<pre><code>define luastack
     set $top = lua_gettop($arg0)
     set $i = 1
     while $i <= $top
@@ -146,7 +145,7 @@ define luastack
         end
         set $i = $i + 1
     end
-</pre>
+</code></pre>
 
                 </section>
 
@@ -174,11 +173,28 @@ define luastack
 (gdb) python print "Hello, World!"
 Hello, World!
 </pre>
+                    <p class="fragment">Ok, now what?</p>
+                </section>
+
+                <section>
+                    <h2>Pretty printing</h2>
+                    <ul>
+                        <li>
+                        Friendly representation of your data structures
+                        </li>
+                        <li>
+                        Up-to-date libc versions have pretty printers for STL containers. You don't need to do
+                        anything to benefit from this RIGHT NOW. <br>
+                        <img class="fragment" src="its-free.jpg">
+
+                        </li>
+                    </ul>
+
                 </section>
 
                 <section>
                     <h2>Custom commands (python version)</h2>
-<pre><code contenteditable>
+<pre><code>
 class DoNothingCommand(gdb.Command):
     """This command does nothing."""  # docstring
     def __init__(self):
diff --git a/slides/its-free.jpg b/slides/its-free.jpg
new file mode 100644 (file)
index 0000000..c6289ec
Binary files /dev/null and b/slides/its-free.jpg differ