summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-07-16 19:15:39 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-07-16 19:15:39 +0000
commit8f04399994587ef7931511d18d72526de3f6f2b3 (patch)
tree919facc060422aa198d79463c40c02b44f04fdbe /gdb/testsuite
parentae5e0686eef580b284df2f764cf29b38ee41b675 (diff)
downloadbinutils-gdb-8f04399994587ef7931511d18d72526de3f6f2b3.tar.gz
gdb/
PR 11914 * f-valprint.c (info_common_command): New variable frame_id. Reinitialize FI form FRAME_ID after each print_variable_and_value. * printcmd.c (print_variable_and_value): Extend function comment. Add comment for invalidated FRAME. * stack.c (backtrace_command_1): New variable frame_id. Reinitialize FI form FRAME_ID after each print_frame_local_vars. (struct print_variable_and_value_data): Change frame to frame_id. (do_print_variable_and_value): New variable frame, initialize it from p->frame_id. Add comment for invalidated FRAME. (print_frame_local_vars, print_frame_arg_vars): New function comment. Update CB_DATA.FRAME to CB_DATA.FRAME_ID initialization. Add comment for invalidated FRAME. gdb/testsuite/ PR 11914 * gdb.python/py-prettyprint.c (eval_func, eval_sub): New. (main): Call eval_sub. * gdb.python/py-prettyprint.exp: (python execfile ('py-prettyprint.py')): Move it earlier. New breakpoint for eval-break. (continue to breakpoint: eval-break, info locals): New test. (python execfile ('py-prettyprint.py')): Move it from here. * gdb.python/py-prettyprint.py (class pp_eval_type): New. (register_pretty_printers): Register pp_eval_type.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog13
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.c18
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp13
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.py10
4 files changed, 50 insertions, 4 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 48287b13972..c6f5f6c019b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2012-07-16 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ PR 11914
+ * gdb.python/py-prettyprint.c (eval_func, eval_sub): New.
+ (main): Call eval_sub.
+ * gdb.python/py-prettyprint.exp:
+ (python execfile ('py-prettyprint.py')): Move it earlier.
+ New breakpoint for eval-break.
+ (continue to breakpoint: eval-break, info locals): New test.
+ (python execfile ('py-prettyprint.py')): Move it from here.
+ * gdb.python/py-prettyprint.py (class pp_eval_type): New.
+ (register_pretty_printers): Register pp_eval_type.
+
2012-07-15 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix a testcase regression by me.
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.c b/gdb/testsuite/gdb.python/py-prettyprint.c
index 0ff7b331dae..1ff9e0511f0 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.c
+++ b/gdb/testsuite/gdb.python/py-prettyprint.c
@@ -219,6 +219,22 @@ struct nullstr
struct string_repr string_1 = { { "one" } };
struct string_repr string_2 = { { "two" } };
+static int
+eval_func (int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8)
+{
+ return p1;
+}
+
+static void
+eval_sub (void)
+{
+ struct eval_type_s { int x; } eval1 = { 1 }, eval2 = { 2 }, eval3 = { 3 },
+ eval4 = { 4 }, eval5 = { 5 }, eval6 = { 6 },
+ eval7 = { 7 }, eval8 = { 8 }, eval9 = { 9 };
+
+ eval1.x++; /* eval-break */
+}
+
int
main ()
{
@@ -309,5 +325,7 @@ main ()
nstype2 = nstype;
+ eval_sub ();
+
return 0; /* break to inspect struct and union */
}
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index a6c241a1411..22af83c5905 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -123,14 +123,19 @@ if ![runto_main ] then {
return
}
-gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \
- ".*Breakpoint.*"
-gdb_test "continue" ".*Breakpoint.*"
-
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python execfile ('${remote_python_file}')"
+gdb_breakpoint [gdb_get_line_number "eval-break"]
+gdb_continue_to_breakpoint "eval-break" ".* eval-break .*"
+
+gdb_test "info locals" "eval9 = eval=<123456789>"
+
+gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \
+ ".*Breakpoint.*"
+gdb_test "continue" ".*Breakpoint.*"
+
gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>" \
"print ss enabled #1"
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.py b/gdb/testsuite/gdb.python/py-prettyprint.py
index 52ffd1a1008..b02b90fe112 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.py
+++ b/gdb/testsuite/gdb.python/py-prettyprint.py
@@ -199,6 +199,14 @@ class MemoryErrorString:
def display_hint (self):
return 'string'
+class pp_eval_type:
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ gdb.execute("bt", to_string=True)
+ return "eval=<" + str(gdb.parse_and_eval("eval_func (123456789, 2, 3, 4, 5, 6, 7, 8)")) + ">"
+
def lookup_function (val):
"Look-up and return a pretty-printer that can print val."
@@ -276,6 +284,8 @@ def register_pretty_printers ():
pretty_printers_dict[re.compile ('^memory_error$')] = MemoryErrorString
+ pretty_printers_dict[re.compile ('^eval_type_s$')] = pp_eval_type
+
pretty_printers_dict = {}
register_pretty_printers ()