diff options
author | Yao Qi <yao@codesourcery.com> | 2013-08-08 05:10:10 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2013-08-08 05:10:10 +0000 |
commit | 82a0a75ff005db5ff174768120dddb13a6392c5c (patch) | |
tree | 0abc1f3c7c5b7b1e221d4ba1a545749153f79fa2 | |
parent | 5c4aa40b937c4cb7eeafdc88b7f11e16b3caf503 (diff) | |
download | fsf-binutils-gdb-82a0a75ff005db5ff174768120dddb13a6392c5c.zip fsf-binutils-gdb-82a0a75ff005db5ff174768120dddb13a6392c5c.tar.gz fsf-binutils-gdb-82a0a75ff005db5ff174768120dddb13a6392c5c.tar.bz2 |
gdb/
* frame.h (read_frame_local): Declare.
* mi/mi-cmd-stack.c (list_args_or_locals): Call
read_frame_local.
* stack.c (read_frame_local): New.
gdb/testsuite/
* gdb.trace/mi-trace-unavailable.exp: Don't set
"print entry-values" to "no".
(test_trace_unavailable): Set various values to
"print entry-values" to test that the output of
'-stack-list-locals' is not affected, and then set
set "print entry-values" to "no".
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/frame.h | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 5 | ||||
-rw-r--r-- | gdb/stack.c | 21 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/mi-trace-unavailable.exp | 19 |
6 files changed, 59 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2bc0dc9..3de17da 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2013-08-08 Yao Qi <yao@codesourcery.com> + * frame.h (read_frame_local): Declare. + * mi/mi-cmd-stack.c (list_args_or_locals): Call + read_frame_local. + * stack.c (read_frame_local): New. + +2013-08-08 Yao Qi <yao@codesourcery.com> + * mi/mi-cmd-stack.c: Update comments to function list_args_or_locals. diff --git a/gdb/frame.h b/gdb/frame.h index 31b9cb7..f02addf 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -714,6 +714,8 @@ struct frame_arg extern void read_frame_arg (struct symbol *sym, struct frame_info *frame, struct frame_arg *argp, struct frame_arg *entryargp); +extern void read_frame_local (struct symbol *sym, struct frame_info *frame, + struct frame_arg *argp); extern void args_info (char *, int); diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 9294e46..e542fc1 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -602,7 +602,10 @@ list_args_or_locals (enum what_to_list what, enum print_values values, && TYPE_CODE (type) != TYPE_CODE_UNION) { case PRINT_ALL_VALUES: - read_frame_arg (sym2, fi, &arg, &entryarg); + if (SYMBOL_IS_ARGUMENT (sym)) + read_frame_arg (sym2, fi, &arg, &entryarg); + else + read_frame_local (sym2, fi, &arg); } break; } diff --git a/gdb/stack.c b/gdb/stack.c index d89ff89..7d97dc8 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -301,6 +301,27 @@ print_frame_arg (const struct frame_arg *arg) annotate_arg_end (); } +/* Read in inferior function local SYM at FRAME into ARGP. Caller is + responsible for xfree of ARGP->ERROR. This function never throws an + exception. */ + +void +read_frame_local (struct symbol *sym, struct frame_info *frame, + struct frame_arg *argp) +{ + volatile struct gdb_exception except; + struct value *val = NULL; + + TRY_CATCH (except, RETURN_MASK_ERROR) + { + val = read_var_value (sym, frame); + } + + argp->error = (val == NULL) ? xstrdup (except.message) : NULL; + argp->sym = sym; + argp->val = val; +} + /* Read in inferior function parameter SYM at FRAME into ARGP. Caller is responsible for xfree of ARGP->ERROR. This function never throws an exception. */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 5f38aa0..5fb44e7 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2013-08-08 Yao Qi <yao@codesourcery.com> + + * gdb.trace/mi-trace-unavailable.exp: Don't set + "print entry-values" to "no". + (test_trace_unavailable): Set various values to + "print entry-values" to test that the output of + '-stack-list-locals' is not affected, and then set + set "print entry-values" to "no". + 2013-08-07 Doug Evans <dje@google.com> * gdb.python/py-value-cc.cc: Renamed from py-value.cc. diff --git a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp index 42f6e32..d96ec8b 100644 --- a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp +++ b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp @@ -75,9 +75,6 @@ mi_gdb_test "-trace-save ${tracefile}.tf" ".*\\^done" \ mi_gdb_test "-trace-save -ctf ${tracefile}.ctf" ".*\\^done" \ "save ctf trace file" -mi_gdb_test "-gdb-set print entry-values no" {\^done} \ - "-gdb-set print entry-values no" - proc test_trace_unavailable { data_source } { global decimal @@ -89,6 +86,22 @@ proc test_trace_unavailable { data_source } { ".*\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \ "-trace-find frame-number 0" + # The "print entry-values" option shouldn't affect the output of + # '-stack-list-locals'. + foreach entry_values { no only preferred if-needed both compact default } { + mi_gdb_test "-gdb-set print entry-values $entry_values" {\^done} "" + + with_test_prefix "$entry_values" { + # Test MI command '-stack-list-locals'. + mi_gdb_test "-stack-list-locals --simple-values" \ + ".*\\^done,locals=\\\[\{name=\"array\",type=\"unsigned char \\\[2\\\]\"\},\{name=\"i\",type=\"int\",value=\"<unavailable>\"\}\\\]" \ + "-stack-list-locals --simple-values" + } + } + + mi_gdb_test "-gdb-set print entry-values no" {\^done} \ + "-gdb-set print entry-values no" + # Test MI command '-stack-list-locals'. mi_gdb_test "-stack-list-locals --simple-values" \ ".*\\^done,locals=\\\[\{name=\"array\",type=\"unsigned char \\\[2\\\]\"\},\{name=\"i\",type=\"int\",value=\"<unavailable>\"\}\\\]" \ |