[padb] r462 committed - Update the gdb/mi parsing code....

padb at googlecode.com padb at googlecode.com
Wed Jan 8 22:47:06 GMT 2014


Revision: 462
Author:   apittman at gmail.com
Date:     Wed Jan  8 22:46:42 2014 UTC
Log:      Update the gdb/mi parsing code.

Re-instate gdb_strip_value() to a older version to avoid problems elsewhere
in the code but rather modify the value of "value" in the gdb_var_addr()
function as this is where the output of gdb has changed.

Handle a value of "<optimized out>" for a pointer and do not attempt parse
it as a real pointer.

http://code.google.com/p/padb/source/detail?r=462

Modified:
  /trunk/src/padb

=======================================
--- /trunk/src/padb	Sat Jan  4 20:53:45 2014 UTC
+++ /trunk/src/padb	Wed Jan  8 22:46:42 2014 UTC
@@ -6885,14 +6885,7 @@
  sub gdb_strip_value {
      my ($str) = @_;
      if ( $str =~ m{\Avalue="([^"]+)"\z}x ) {
-
-        # Somewhere between gdb 7.2.x and 7.5.x, gdb started printing
-        # additional information at the end of the value= line that
-        # needs to be stripped off.  This secondary regex will strip
-        # off this extra gorp if it's there.
-        my $tmp = $1;
-        $tmp =~ s/(.+?)\s<\S+>$/$1/;
-        return $tmp;
+        return $1;
      }
      return;
  }
@@ -6925,11 +6918,16 @@
      return $hex;
  }

+# Somewhere between gdb 7.2.x and 7.5.x, gdb started printing additional
+# information at the end of the value= line that needs to be stripped off.
+# Strip this off by splitting on spaces and returning the first value.
  sub gdb_var_addr {
      my ( $gdb, $var ) = @_;
      my %p = gdb_send_addr( $gdb, "-data-evaluate-expression \"&($var)\"" );
      return unless ( $p{status} eq 'done' );
-    return gdb_strip_value( $p{reason} );
+    my $value = gdb_strip_value( $p{reason} );
+    my @a = split $SPACE, $value;
+    return $a[0];
  }

  sub gdb_read_raw {
@@ -7967,6 +7965,10 @@
          if ( $pointer eq '0x0' ) {
              return pretify_variable('null pointer');
          }
+
+        if ( $pointer eq '<optimized out>' ) {
+            return pretify_variable('<optimized out>');
+        }

          # Try and print the contents of the pointer, this works fine
          # for types like 'double *' but produces lots of data for more




More information about the padb-devel mailing list