- Archer update to the snapshot: f6273d446ff87e50976600ba3f71b88d61043e20
- Archer backport: f6273d446ff87e50976600ba3f71b88d61043e20 - Use pretty-printers to print base classes inside a derived class.
This commit is contained in:
parent
4fe9415174
commit
b5f2aa80ed
121
gdb-archer.patch
121
gdb-archer.patch
@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
|
||||
http://sourceware.org/gdb/wiki/ArcherBranchManagement
|
||||
|
||||
GIT snapshot:
|
||||
commit d144a3633454046aaeae3e2c369c271834431d36
|
||||
commit f6273d446ff87e50976600ba3f71b88d61043e20
|
||||
|
||||
branch `archer' - the merge of branches:
|
||||
archer-jankratochvil-merge-expr
|
||||
@ -12318,10 +12318,52 @@ index 837ca6c..23f8d5b 100644
|
||||
const char *name,
|
||||
const char *linkage_name,
|
||||
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
|
||||
index 8b7d868..dcd32cb 100644
|
||||
index 8b7d868..4e33fa0 100644
|
||||
--- a/gdb/cp-valprint.c
|
||||
+++ b/gdb/cp-valprint.c
|
||||
@@ -461,6 +461,7 @@ cp_print_static_field (struct type *type,
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "valprint.h"
|
||||
#include "cp-support.h"
|
||||
#include "language.h"
|
||||
+#include "python/python.h"
|
||||
|
||||
/* Controls printing of vtbl's */
|
||||
static void
|
||||
@@ -418,12 +419,27 @@ cp_print_value (struct type *type, struct type *real_type,
|
||||
if (skip >= 1)
|
||||
fprintf_filtered (stream, "<invalid address>");
|
||||
else
|
||||
- cp_print_value_fields (baseclass, thistype, base_valaddr,
|
||||
- thisoffset + boffset, address + boffset,
|
||||
- stream, recurse, options,
|
||||
- ((struct type **)
|
||||
- obstack_base (&dont_print_vb_obstack)),
|
||||
- 0);
|
||||
+ {
|
||||
+ int result = 0;
|
||||
+
|
||||
+ /* Attempt to run the Python pretty-printers on the
|
||||
+ baseclass if possible. */
|
||||
+ if (!options->raw)
|
||||
+ result = apply_val_pretty_printer (baseclass, base_valaddr,
|
||||
+ thisoffset + boffset,
|
||||
+ address + boffset,
|
||||
+ stream, recurse,
|
||||
+ options,
|
||||
+ current_language);
|
||||
+
|
||||
+ if (!result)
|
||||
+ cp_print_value_fields (baseclass, thistype, base_valaddr,
|
||||
+ thisoffset + boffset, address + boffset,
|
||||
+ stream, recurse, options,
|
||||
+ ((struct type **)
|
||||
+ obstack_base (&dont_print_vb_obstack)),
|
||||
+ 0);
|
||||
+ }
|
||||
fputs_filtered (", ", stream);
|
||||
|
||||
flush_it:
|
||||
@@ -461,6 +477,7 @@ cp_print_static_field (struct type *type,
|
||||
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|
||||
{
|
||||
CORE_ADDR *first_dont_print;
|
||||
@ -12329,7 +12371,7 @@ index 8b7d868..dcd32cb 100644
|
||||
int i;
|
||||
|
||||
first_dont_print
|
||||
@@ -470,7 +471,7 @@ cp_print_static_field (struct type *type,
|
||||
@@ -470,7 +487,7 @@ cp_print_static_field (struct type *type,
|
||||
|
||||
while (--i >= 0)
|
||||
{
|
||||
@ -12338,7 +12380,7 @@ index 8b7d868..dcd32cb 100644
|
||||
{
|
||||
fputs_filtered ("<same as static member of an already"
|
||||
" seen type>",
|
||||
@@ -479,12 +480,13 @@ cp_print_static_field (struct type *type,
|
||||
@@ -479,12 +496,13 @@ cp_print_static_field (struct type *type,
|
||||
}
|
||||
}
|
||||
|
||||
@ -12354,7 +12396,7 @@ index 8b7d868..dcd32cb 100644
|
||||
stream, recurse, options, NULL, 1);
|
||||
return;
|
||||
}
|
||||
@@ -492,7 +494,7 @@ cp_print_static_field (struct type *type,
|
||||
@@ -492,7 +510,7 @@ cp_print_static_field (struct type *type,
|
||||
opts = *options;
|
||||
opts.deref_ref = 0;
|
||||
val_print (type, value_contents_all (val),
|
||||
@ -40681,13 +40723,13 @@ index 0000000..5c9f3c7
|
||||
+mi_varobj_update_with_type_change container int 0 "update after type change"
|
||||
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.c b/gdb/testsuite/gdb.python/python-prettyprint.c
|
||||
new file mode 100644
|
||||
index 0000000..f8c2435
|
||||
index 0000000..399be23
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/python-prettyprint.c
|
||||
@@ -0,0 +1,159 @@
|
||||
@@ -0,0 +1,191 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+ Copyright 2008, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
@ -40731,6 +40773,35 @@ index 0000000..f8c2435
|
||||
+ const S &b;
|
||||
+};
|
||||
+SSS::SSS (int x, const S& r) : a(x), b(r) { }
|
||||
+
|
||||
+class VirtualTest
|
||||
+{
|
||||
+ private:
|
||||
+ int value;
|
||||
+
|
||||
+ public:
|
||||
+ VirtualTest ()
|
||||
+ {
|
||||
+ value = 1;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+class Vbase1 : public virtual VirtualTest { };
|
||||
+class Vbase2 : public virtual VirtualTest { };
|
||||
+class Vbase3 : public virtual VirtualTest { };
|
||||
+
|
||||
+class Derived : public Vbase1, public Vbase2, public Vbase3
|
||||
+{
|
||||
+ private:
|
||||
+ int value;
|
||||
+
|
||||
+ public:
|
||||
+ Derived ()
|
||||
+ {
|
||||
+ value = 2;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+typedef struct string_repr
|
||||
@ -40833,6 +40904,9 @@ index 0000000..f8c2435
|
||||
+ SSS sss(15, cps);
|
||||
+
|
||||
+ SSS& ref (sss);
|
||||
+
|
||||
+ Derived derived;
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+ add_item (&c, 23); /* MI breakpoint here */
|
||||
@ -40846,11 +40920,11 @@ index 0000000..f8c2435
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.exp b/gdb/testsuite/gdb.python/python-prettyprint.exp
|
||||
new file mode 100644
|
||||
index 0000000..b2ccb2b
|
||||
index 0000000..f83b1cd
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/python-prettyprint.exp
|
||||
@@ -0,0 +1,90 @@
|
||||
+# Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
@@ -0,0 +1,92 @@
|
||||
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
@ -40928,6 +41002,8 @@ index 0000000..b2ccb2b
|
||||
+ gdb_test "print cpssa" " = {{$nl *zss = 11, *$nl *s = a=<12> b=<$hex>$nl *}, {$nl *zss = 13, *$nl *s = a=<14> b=<$hex>$nl *}}"
|
||||
+ gdb_test "print sss" "= a=<15> b=< a=<8> b=<$hex>>"
|
||||
+ gdb_test "print ref" "= a=<15> b=< a=<8> b=<$hex>>"
|
||||
+ gdb_test "print derived" \
|
||||
+ " = \{.*<Vbase1> = pp class name: Vbase1.*<Vbase2> = \{.*<VirtualTest> = pp value variable is: 1,.*members of Vbase2:.*_vptr.Vbase2 = $hex.*<Vbase3> = \{.*members of Vbase3.*members of Derived:.*value = 2.*"
|
||||
+ }
|
||||
+
|
||||
+ gdb_test "print x" " = $hex \"this is x\""
|
||||
@ -40942,10 +41018,10 @@ index 0000000..b2ccb2b
|
||||
+run_lang_tests "c++"
|
||||
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.py b/gdb/testsuite/gdb.python/python-prettyprint.py
|
||||
new file mode 100644
|
||||
index 0000000..0d9cb87
|
||||
index 0000000..8379ecf
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/python-prettyprint.py
|
||||
@@ -0,0 +1,134 @@
|
||||
@@ -0,0 +1,151 @@
|
||||
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
@ -41026,6 +41102,20 @@ index 0000000..0d9cb87
|
||||
+ def to_string(self):
|
||||
+ return "a=<" + str(self.val['a']) + "> b=<" + str(self.val["b"]) + ">"
|
||||
+
|
||||
+class pp_multiple_virtual:
|
||||
+ def __init__ (self, val):
|
||||
+ self.val = val
|
||||
+
|
||||
+ def to_string (self):
|
||||
+ return "pp value variable is: " + str (self.val['value'])
|
||||
+
|
||||
+class pp_vbase1:
|
||||
+ def __init__ (self, val):
|
||||
+ self.val = val
|
||||
+
|
||||
+ def to_string (self):
|
||||
+ return "pp class name: " + self.val.type ().tag ()
|
||||
+
|
||||
+def lookup_function (val):
|
||||
+ "Look-up and return a pretty-printer that can print val."
|
||||
+
|
||||
@ -41067,6 +41157,9 @@ index 0000000..0d9cb87
|
||||
+ pretty_printers_dict[re.compile ('^const S &$')] = pp_s
|
||||
+ pretty_printers_dict[re.compile ('^SSS$')] = pp_sss
|
||||
+
|
||||
+ pretty_printers_dict[re.compile ('^VirtualTest$')] = pp_multiple_virtual
|
||||
+ pretty_printers_dict[re.compile ('^Vbase1$')] = pp_vbase1
|
||||
+
|
||||
+ # Note that we purposely omit the typedef names here.
|
||||
+ # Printer lookup is based on canonical name.
|
||||
+ # However, we do need both tagged and untagged variants, to handle
|
||||
|
7
gdb.spec
7
gdb.spec
@ -13,7 +13,7 @@ Version: 6.8.50.20090302
|
||||
|
||||
# The release always contains a leading reserved number, start it at 1.
|
||||
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
||||
Release: 13%{?_with_upstream:.upstream}%{?dist}
|
||||
Release: 14%{?_with_upstream:.upstream}%{?dist}
|
||||
|
||||
License: GPLv3+
|
||||
Group: Development/Debuggers
|
||||
@ -851,6 +851,11 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sun Apr 5 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8.50.20090302-14
|
||||
- Archer update to the snapshot: f6273d446ff87e50976600ba3f71b88d61043e20
|
||||
- Archer backport: f6273d446ff87e50976600ba3f71b88d61043e20
|
||||
- Use pretty-printers to print base classes inside a derived class.
|
||||
|
||||
* Mon Mar 30 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8.50.20090302-13
|
||||
- Archer update to the snapshot: d144a3633454046aaeae3e2c369c271834431d36
|
||||
- Archer backport: a2c49b7640ebe7ce1376902d48d5bbbee600996b
|
||||
|
Loading…
Reference in New Issue
Block a user