2011-01-04 05:39:35 +00:00
|
|
|
http://sourceware.org/ml/gdb-patches/2011-01/msg00016.html
|
|
|
|
Subject: [patch] New testcase: py-prettyprint.exp: print hint_error
|
|
|
|
|
|
|
|
Hi,
|
|
|
|
|
|
|
|
PASS: gdb.python/py-prettyprint.exp: print hint_error
|
|
|
|
for
|
|
|
|
FYI: fix buglet in gdbpy_get_display_hint
|
|
|
|
http://sourceware.org/ml/gdb-patches/2010-07/msg00190.html
|
|
|
|
http://sourceware.org/ml/gdb-cvs/2010-07/msg00061.html
|
|
|
|
|
|
|
|
I would check it in as obvious but the 2011 ChangeLog move process has to be
|
|
|
|
done first. So to be checked in later.
|
|
|
|
|
|
|
|
|
|
|
|
Thanks,
|
|
|
|
Jan
|
|
|
|
|
|
|
|
|
|
|
|
gdb/testsuite/
|
|
|
|
2011-01-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
* gdb.python/py-prettyprint.c (struct hint_error): New.
|
|
|
|
(main): New variable hint_error.
|
|
|
|
* gdb.python/py-prettyprint.exp (run_lang_tests): New testcase
|
|
|
|
"print hint_error".
|
|
|
|
* gdb.python/py-prettyprint.py (class pp_hint_error): New.
|
|
|
|
(register_pretty_printers): Register it.
|
|
|
|
|
2011-04-11 20:48:13 +00:00
|
|
|
Index: gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.c
|
2011-01-07 08:47:27 +00:00
|
|
|
===================================================================
|
2011-04-11 20:48:13 +00:00
|
|
|
--- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.c 2011-03-31 21:59:26.000000000 +0200
|
|
|
|
+++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.c 2011-04-11 19:42:10.000000000 +0200
|
2011-01-04 05:39:35 +00:00
|
|
|
@@ -44,6 +44,10 @@ struct lazystring {
|
|
|
|
const char *lazy_str;
|
|
|
|
};
|
|
|
|
|
|
|
|
+struct hint_error {
|
|
|
|
+ int x;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
#ifdef __cplusplus
|
|
|
|
struct S : public s {
|
|
|
|
int zs;
|
|
|
|
@@ -215,6 +219,7 @@ main ()
|
2011-04-11 20:48:13 +00:00
|
|
|
nostring_type nstype, nstype2;
|
2011-01-04 05:39:35 +00:00
|
|
|
struct ns ns, ns2;
|
|
|
|
struct lazystring estring, estring2;
|
|
|
|
+ struct hint_error hint_error;
|
|
|
|
|
|
|
|
nstype.elements = narray;
|
|
|
|
nstype.len = 0;
|
2011-04-11 20:48:13 +00:00
|
|
|
Index: gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.exp
|
2011-01-07 08:47:27 +00:00
|
|
|
===================================================================
|
2011-04-11 20:48:13 +00:00
|
|
|
--- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.exp 2011-03-07 17:03:03.000000000 +0100
|
|
|
|
+++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.exp 2011-04-11 19:41:56.000000000 +0200
|
2011-01-04 05:39:35 +00:00
|
|
|
@@ -97,6 +97,8 @@ proc run_lang_tests {lang} {
|
|
|
|
gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
|
|
|
|
gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>"
|
|
|
|
|
|
|
|
+ gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val"
|
|
|
|
+
|
|
|
|
gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
|
|
|
|
|
2011-01-17 15:31:43 +00:00
|
|
|
gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
|
2011-04-11 20:48:13 +00:00
|
|
|
Index: gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.py
|
2011-01-07 08:47:27 +00:00
|
|
|
===================================================================
|
2011-04-11 20:48:13 +00:00
|
|
|
--- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.py 2011-03-31 21:59:26.000000000 +0200
|
|
|
|
+++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.py 2011-04-11 19:41:56.000000000 +0200
|
|
|
|
@@ -161,6 +161,18 @@ class pp_ls:
|
2011-01-04 05:39:35 +00:00
|
|
|
def display_hint (self):
|
|
|
|
return 'string'
|
|
|
|
|
|
|
|
+class pp_hint_error:
|
|
|
|
+ "Throw error from display_hint"
|
|
|
|
+
|
|
|
|
+ def __init__(self, val):
|
|
|
|
+ self.val = val
|
|
|
|
+
|
|
|
|
+ def to_string(self):
|
|
|
|
+ return 'hint_error_val'
|
|
|
|
+
|
|
|
|
+ def display_hint (self):
|
|
|
|
+ raise Exception("hint failed")
|
|
|
|
+
|
|
|
|
class pp_outer:
|
|
|
|
"Print struct outer"
|
|
|
|
|
2011-04-11 20:48:13 +00:00
|
|
|
@@ -246,6 +258,9 @@ def register_pretty_printers ():
|
2011-01-04 05:39:35 +00:00
|
|
|
pretty_printers_dict[re.compile ('^struct outerstruct$')] = pp_outer
|
|
|
|
pretty_printers_dict[re.compile ('^outerstruct$')] = pp_outer
|
|
|
|
|
|
|
|
+ pretty_printers_dict[re.compile ('^struct hint_error$')] = pp_hint_error
|
|
|
|
+ pretty_printers_dict[re.compile ('^hint_error$')] = pp_hint_error
|
|
|
|
+
|
|
|
|
pretty_printers_dict = {}
|
|
|
|
|
|
|
|
register_pretty_printers ()
|