* [PATCH] Only print entry values for arguments.
@ 2013-08-05 0:45 Yao Qi
2013-08-05 2:10 ` Yao Qi
2013-08-05 14:12 ` Pedro Alves
0 siblings, 2 replies; 8+ messages in thread
From: Yao Qi @ 2013-08-05 0:45 UTC (permalink / raw)
To: gdb-patches
Hi,
When I think about how to handle entry values in my "skip unavailable"
patch, I played with "set print entry-values" to different values, and
use MI commands '-stack-list-{locals,arguments,variables}' to see the
changes on output. However, I find that "print entry-values" affects
the output of "-stack-list-locals", which is not expected.
-gdb-set print entry-values only
^done
-stack-list-locals --simple-values
^done,locals=[{name="array",type="unsigned char [2]"},{name="i@entry",type="int",value="<optimized out>"}]
-gdb-set print entry-values both
^done
-stack-list-locals --simple-values
^done,locals=[{name="array",type="unsigned char [2]"},{name="i",type="int",value="<unavailable>"},{name="i@entry",type="int",value="<optimized out>"}]
"print entry-values" is the option about printing frame arguments,
which has nothing to do with locals. This patch is to check whether it
is an argument to decide to call read_frame_arg or read_frame_local.
read_frame_local is a new function which is to print local without
considering much on "print entry-values". I have to say that it is
odd to pass "struct frame_arg *" to function read_frame_local, but it
is required by caller and the following calls. Functions
list_args_or_locals and list_arg_or_local process both arguments and
locals by means of "struct frame_arg *", so I have to use "struct
frame_arg *" for function read_frame_local too. Note that "print
entry-values" is for arguments only, but is checked in both
list_args_or_locals and list_arg_or_local. We need some changes here
to apply value of "print entry-values" to arguments only, but it is
not the goal of this patch.
The test case mi-trace-unavailable.exp is updated too, to test the
output of '-stack-list-locals'.
This patch also fixes an internal error I found,
../../../git/gdb/stack.c:223: internal-error: print_frame_arg: Assertion `!arg->val || !arg->error' failed.
A problem internal to GDB has been detected, further debugging may prove unreliable.
Quit this debugging session? "
Patch is tested on x86_64-linux with board file unix.exp and
native-gdbserver.exp.
gdb:
2013-08-05 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.
gdb/testsuite:
2013-08-05 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 the output of
'-stack-list-locals' is not affected.
---
gdb/frame.h | 2 +
gdb/mi/mi-cmd-stack.c | 5 +++-
gdb/stack.c | 27 ++++++++++++++++++++++
gdb/testsuite/gdb.trace/mi-trace-unavailable.exp | 18 ++++++++++++--
4 files changed, 48 insertions(+), 4 deletions(-)
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 416f0f4..fea7f6f 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 510f20d..9e9ebc1 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -301,6 +301,33 @@ print_frame_arg (const struct frame_arg *arg)
annotate_arg_end ();
}
+/* Read in inferior function local SYM at FRAM 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;
+ char *val_error = NULL;
+
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ val = read_var_value (sym, frame);
+ }
+ if (val == NULL)
+ {
+ val_error = alloca (strlen (except.message) + 1);
+ strcpy (val_error, except.message);
+ }
+
+ argp->sym = sym;
+ argp->val = val;
+ argp->error = val_error ? xstrdup (val_error) : NULL;
+}
+
/* 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/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
index 42f6e32..8926a7e 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,21 @@ proc test_trace_unavailable { data_source } {
".*\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
"-trace-find frame-number 0"
+ # Option of print entry-values 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} ""
+
# 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>\"\}\\\]" \
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Only print entry values for arguments.
2013-08-05 0:45 [PATCH] Only print entry values for arguments Yao Qi
@ 2013-08-05 2:10 ` Yao Qi
2013-08-05 14:12 ` Pedro Alves
1 sibling, 0 replies; 8+ messages in thread
From: Yao Qi @ 2013-08-05 2:10 UTC (permalink / raw)
To: gdb-patches
On 08/05/2013 08:44 AM, Yao Qi wrote:
> This patch also fixes an internal error I found,
>
> ../../../git/gdb/stack.c:223: internal-error: print_frame_arg: Assertion `!arg->val || !arg->error' failed.
> A problem internal to GDB has been detected, further debugging may prove unreliable.
> Quit this debugging session? "
This patch doesn't fix this internal error. I'll post a patch to
reproduce this internal error and fix it. Sorry for the confusion.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Only print entry values for arguments.
2013-08-05 0:45 [PATCH] Only print entry values for arguments Yao Qi
2013-08-05 2:10 ` Yao Qi
@ 2013-08-05 14:12 ` Pedro Alves
2013-08-08 6:38 ` Yao Qi
1 sibling, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2013-08-05 14:12 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 08/05/2013 01:44 AM, Yao Qi wrote:
> Hi,
> When I think about how to handle entry values in my "skip unavailable"
> patch, I played with "set print entry-values" to different values, and
> use MI commands '-stack-list-{locals,arguments,variables}' to see the
> changes on output. However, I find that "print entry-values" affects
> the output of "-stack-list-locals", which is not expected.
>
> -gdb-set print entry-values only
> ^done
> -stack-list-locals --simple-values
> ^done,locals=[{name="array",type="unsigned char [2]"},{name="i@entry",type="int",value="<optimized out>"}]
>
> -gdb-set print entry-values both
> ^done
> -stack-list-locals --simple-values
> ^done,locals=[{name="array",type="unsigned char [2]"},{name="i",type="int",value="<unavailable>"},{name="i@entry",type="int",value="<optimized out>"}]
>
> "print entry-values" is the option about printing frame arguments,
> which has nothing to do with locals. This patch is to check whether it
> is an argument to decide to call read_frame_arg or read_frame_local.
> read_frame_local is a new function which is to print local without
> considering much on "print entry-values". I have to say that it is
> odd to pass "struct frame_arg *" to function read_frame_local, but it
> is required by caller and the following calls. Functions
> list_args_or_locals and list_arg_or_local process both arguments and
> locals by means of "struct frame_arg *", so I have to use "struct
> frame_arg *" for function read_frame_local too. Note that "print
> entry-values" is for arguments only, but is checked in both
> list_args_or_locals and list_arg_or_local.
> We need some changes here
> to apply value of "print entry-values" to arguments only, but it is
> not the goal of this patch.
Yeah, or we could rename "struct frame_arg" to "struct frame_value"
or some such, and update it's comments to better reflect reality.
> 2013-08-05 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.
>
> gdb/testsuite:
>
> 2013-08-05 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 the output of
> '-stack-list-locals' is not affected.
> diff --git a/gdb/stack.c b/gdb/stack.c
> index 510f20d..9e9ebc1 100644
> --- a/gdb/stack.c
> +++ b/gdb/stack.c
> @@ -301,6 +301,33 @@ print_frame_arg (const struct frame_arg *arg)
> annotate_arg_end ();
> }
>
> +/* Read in inferior function local SYM at FRAM into ARGP. Caller is
typo: FRAME.
> + 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;
> + char *val_error = NULL;
> +
> + TRY_CATCH (except, RETURN_MASK_ERROR)
> + {
> + val = read_var_value (sym, frame);
> + }
> + if (val == NULL)
> + {
> + val_error = alloca (strlen (except.message) + 1);
> + strcpy (val_error, except.message);
> + }
> +
> + argp->sym = sym;
> + argp->val = val;
> + argp->error = val_error ? xstrdup (val_error) : NULL;
> +}
> +
I can see where this came from, but isn't all this the same as:
argp->error = (val == NULL) ? xstrdup (except.message) : NULL;
argp->val = val;
argp->sym = sym;
?
> @@ -89,6 +86,21 @@ proc test_trace_unavailable { data_source } {
> ".*\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
> "-trace-find frame-number 0"
>
> + # Option of print entry-values shouldn't affect the output of
> + # '-stack-list-locals'.
# The "print entry-values" option shouldn't affect the
# output of '-stack-list-locals'.
would read better a little less odd to me.
> -mi_gdb_test "-gdb-set print entry-values no" {\^done} \
> - "-gdb-set print entry-values no"
...
> + mi_gdb_test "-gdb-set print entry-values no" {\^done} ""
Was there a reason to make the message argument the empty string?
I'd rather that bit was mentioned in the ChangeLog too:
> 2013-08-05 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 the output of
> '-stack-list-locals' is not affected.
(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".
Otherwise it looks good to me. I wonder whether we should put
this in 7.6.1 ?
--
Pedro Alves
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Only print entry values for arguments.
2013-08-05 14:12 ` Pedro Alves
@ 2013-08-08 6:38 ` Yao Qi
2013-08-08 14:24 ` Pedro Alves
0 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2013-08-08 6:38 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On 08/05/2013 10:11 PM, Pedro Alves wrote:
>> >+ mi_gdb_test "-gdb-set print entry-values no" {\^done} ""
> Was there a reason to make the message argument the empty string?
>
No. I thought "set print entry-values no" is not important to show up
in the test summary gdb.sum, so I use empty string here. Fix it like
this,
mi_gdb_test "-gdb-set print entry-values no" {\^done} \
"-gdb-set print entry-values no"
> I'd rather that bit was mentioned in the ChangeLog too:
>
>> >2013-08-05 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 the output of
>> > '-stack-list-locals' is not affected.
> (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".
>
Fixed as you suggested. Patch is committed to trunk as below.
> Otherwise it looks good to me. I wonder whether we should put
> this in 7.6.1 ?
This problem exists on 7.6 branch too,
(gdb) interpreter-exec mi "-stack-list-locals 2"
^done,locals=[{name="b",type="int",value="2"}]
(gdb) set print entry-values only
(gdb) interpreter-exec mi "-stack-list-locals 2"
^done,locals=[{name="b@entry",type="int",value="<optimized out>"}]
We can apply this patch to 7.6 branch except the test case part,
because gdb.trace/mi-trace-unavailable.exp doesn't exist on 7.6
branch. I plan to
1) cvs -d :ext:qiyao@sourceware.org:/cvs/src co -r gdb_7_6-branch gdb
2) apply this patch without changes to gdb.trace/mi-trace-unavailable.exp
Since it is not a bug fix, don't have to mention it in
http://sourceware.org/gdb/wiki/GDB_7.6_Release . If my understanding
is right, I'll commit the patch to 7.6 branch.
--
Yao (é½å°§)
gdb:
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.
gdb/testsuite:
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 the output of
'-stack-list-locals' is not affected, , and then set
"print entry-values" to "no".
---
gdb/frame.h | 2 ++
gdb/mi/mi-cmd-stack.c | 5 ++++-
gdb/stack.c | 21 +++++++++++++++++++++
gdb/testsuite/gdb.trace/mi-trace-unavailable.exp | 19 ++++++++++++++++---
4 files changed, 43 insertions(+), 4 deletions(-)
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/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>\"\}\\\]" \
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Only print entry values for arguments.
2013-08-08 6:38 ` Yao Qi
@ 2013-08-08 14:24 ` Pedro Alves
2013-08-14 9:46 ` Yao Qi
0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2013-08-08 14:24 UTC (permalink / raw)
To: Yao Qi; +Cc: Pedro Alves, gdb-patches
>> Otherwise it looks good to me. I wonder whether we should put
>> this in 7.6.1 ?
>
> This problem exists on 7.6 branch too,
>
> (gdb) interpreter-exec mi "-stack-list-locals 2"
> ^done,locals=[{name="b",type="int",value="2"}]
> (gdb) set print entry-values only
> (gdb) interpreter-exec mi "-stack-list-locals 2"
> ^done,locals=[{name="b@entry",type="int",value="<optimized out>"}]
>
> We can apply this patch to 7.6 branch except the test case part,
> because gdb.trace/mi-trace-unavailable.exp doesn't exist on 7.6
> branch.
If we run 7.6 against that test pristine would it pass cleanly?
> I plan to
> 1) cvs -d :ext:qiyao@sourceware.org:/cvs/src co -r gdb_7_6-branch gdb
> 2) apply this patch without changes to gdb.trace/mi-trace-unavailable.exp
>
> Since it is not a bug fix, don't have to mention it in
> http://sourceware.org/gdb/wiki/GDB_7.6_Release .
Hmm. If this is issue is present in the 7.6 branch, how is it
not a bug fix? Instead, what we should do if the bug wasn't
reported in bugzilla, is file one, so we can reference it from
the wiki.
> If my understanding
> is right, I'll commit the patch to 7.6 branch.
--
Pedro Alves
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Only print entry values for arguments.
2013-08-08 14:24 ` Pedro Alves
@ 2013-08-14 9:46 ` Yao Qi
2013-08-14 11:17 ` Pedro Alves
0 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2013-08-14 9:46 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On 08/08/2013 10:23 PM, Pedro Alves wrote:
> If we run 7.6 against that test pristine would it pass cleanly?
>
No. In gdb.trace/mi-trace-unavailable.exp, we'll save trace data to
ctf and test "--skip-unavailable" for MI command
"-data-list-register-values". These two are not supported in 7.6 tree,
so we'll get three fails:
FAIL: gdb.trace/mi-trace-unavailable.exp: save ctf trace file
FAIL: gdb.trace/mi-trace-unavailable.exp: live: -data-list-register-values --skip-unavailable x
FAIL: gdb.trace/mi-trace-unavailable.exp: tfile: -data-list-register-values --skip-unavailable x
>> >I plan to
>> > 1) cvs -d :ext:qiyao@sourceware.org:/cvs/src co -r gdb_7_6-branch gdb
>> > 2) apply this patch without changes to gdb.trace/mi-trace-unavailable.exp
>> >
>> >Since it is not a bug fix, don't have to mention it in
>> >http://sourceware.org/gdb/wiki/GDB_7.6_Release .
> Hmm. If this is issue is present in the 7.6 branch, how is it
> not a bug fix? Instead, what we should do if the bug wasn't
> reported in bugzilla, is file one, so we can reference it from
> the wiki.
>
I filed PR gdb/15837 (http://sourceware.org/bugzilla/show_bug.cgi?id=15837)
and record it in wiki like this:
PR gdb/15837 (GDB prints entry values for local variables)
Here is the patch to 7.6 branch.
--
Yao (é½å°§)
gdb:
2013-08-14 Yao Qi <yao@codesourcery.com>
PR gdb/15837:
* 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/frame.h | 2 ++
gdb/mi/mi-cmd-stack.c | 5 ++++-
gdb/stack.c | 21 +++++++++++++++++++++
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. */
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-08-14 11:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-05 0:45 [PATCH] Only print entry values for arguments Yao Qi
2013-08-05 2:10 ` Yao Qi
2013-08-05 14:12 ` Pedro Alves
2013-08-08 6:38 ` Yao Qi
2013-08-08 14:24 ` Pedro Alves
2013-08-14 9:46 ` Yao Qi
2013-08-14 11:17 ` Pedro Alves
2013-08-14 11:54 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).