From: Yao Qi <qiyaoltc@gmail.com>
To: Bernhard Heckel <bernhard.heckel@intel.com>
Cc: qiyaoltc@gmail.com, brobecker@adacore.com, gdb-patches@sourceware.org
Subject: Re: [PATCH V4 5/6] Resolve dynamic target types of pointers.
Date: Thu, 13 Oct 2016 14:07:00 -0000 [thread overview]
Message-ID: <86k2dc8hri.fsf@gmail.com> (raw)
In-Reply-To: <1473230295-809-6-git-send-email-bernhard.heckel@intel.com> (Bernhard Heckel's message of "Wed, 7 Sep 2016 08:38:14 +0200")
Bernhard Heckel <bernhard.heckel@intel.com> writes:
> diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
> index 2cb418d..120163f 100644
> --- a/gdb/c-valprint.c
> +++ b/gdb/c-valprint.c
> @@ -645,6 +645,28 @@ c_value_print (struct value *val, struct ui_file *stream,
> else
> {
> /* normal case */
> + if (TYPE_CODE (type) == TYPE_CODE_PTR
> + && 1 == is_dynamic_type (type))
Use is_dynamic_type return value as bool.
> + {
> + CORE_ADDR addr;
> + if (NULL != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (type)))
> + addr = value_address (val);
> + else
> + addr = value_as_address (val);
> +
> + /* We resolve the target-type only when the
> + pointer is associated. */
> + if ((addr != 0)
> + && (0 == type_not_associated (type)))
!type_not_associated (type)
> +
> +
> +gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
> +gdb_continue_to_breakpoint "Before pointer assignment"
> +gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) 0x0" "print logp, not associated"
> +gdb_test "print *logp" "Cannot access memory at address 0x0" "print *logp, not associated"
> +gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) 0x0" "print comp, not associated"
> +gdb_test "print *comp" "Cannot access memory at address 0x0" "print *comp, not associated"
> +gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) 0x0" "print charp, not associated"
> +gdb_test "print *charp" "Cannot access memory at address 0x0" "print *charp, not associated"
> +gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) 0x0" "print charap, not associated"
> +gdb_test "print *charap" "Cannot access memory at address 0x0" "print *charap, not associated"
> +gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" "print intp, not associated"
> +gdb_test "print *intp" "Cannot access memory at address 0x0" "print
> *intp, not associated"
These lines are too long.
> +set test "print intap, not associated"
> +gdb_test_multiple "print intap" $test {
> + -re " = \\(PTR TO -> \\( $int \\(:,:\\)\\)\\) <not associated>\r\n$gdb_prompt $" {
> + pass $test
> + }
> + -re " = <not associated>\r\n$gdb_prompt $" {
> + pass $test
> + }
> +}
Why do we need to different regex here? Need to handle the differences
of different compilers? IMO, the former looks reasonable to me.
> +gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) 0x0" "print realp, not associated"
> +gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated"
They are too long.
> +gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0"
> +
> +
> +gdb_breakpoint [gdb_get_line_number "Before value assignment"]
> +gdb_continue_to_breakpoint "Before value assignment"
> +gdb_test "print *(twop)%ivla2" "= <not allocated>"
> +
> +
> +gdb_breakpoint [gdb_get_line_number "After value assignment"]
> +gdb_continue_to_breakpoint "After value assignment"
> +gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) $hex\( <.*>\)?"
> +gdb_test "print *logp" "= \\.TRUE\\."
> +gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) $hex\( <.*>\)?"
> +gdb_test "print *comp" "= \\(1,2\\)"
> +gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) $hex\( <.*>\)?"
> +gdb_test "print *charp" "= 'a'"
> +gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\( <.*>\)?"
> +gdb_test "print *charap" "= 'abc'"
> +gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) $hex\( <.*>\)?"
> +gdb_test "print *intp" "= 10"
> +set test_name "print intap, associated"
> +gdb_test_multiple "print intap" $test_name {
> + -re "= \\(\\( 1, 1, 3(, 1){7}\\) \\( 1(, 1){9}\\) \\)\r\n$gdb_prompt $" {
> + pass $test_name
> + }
> + -re "= \\(PTR TO -> \\( $int \\(10,2\\)\\)\\) $hex\( <.*>\)?\r\n$gdb_prompt $" {
> + gdb_test "print *intap" "= \\(\\( 1, 1, 3(, 1){7}\\) \\( 1(, 1){9}\\) \\)"
> + pass $test_name
> + }
> +}
Again, different outputs due to different compilers? The latter looks
reasonable to me.
> +set test_name "print intvlap, associated"
> +gdb_test_multiple "print intvlap" $test_name {
> + -re "= \\(2, 2, 2, 4(, 2){6}\\)\r\n$gdb_prompt $" {
> + pass $test_name
> + }
> + -re "= \\(PTR TO -> \\( $int \\(10\\)\\)\\) $hex\( <.*>\)?\r\n$gdb_prompt $" {
> + gdb_test "print *intvlap" "= \\(2, 2, 2, 4(, 2){6}\\)"
> + pass $test_name
> + }
> +}
Likewise.
> diff --git a/gdb/valprint.c b/gdb/valprint.c
> index 6896da2..f592278 100644
> --- a/gdb/valprint.c
> +++ b/gdb/valprint.c
> @@ -1141,12 +1141,6 @@ value_check_printable (struct value *val, struct ui_file *stream,
> return 0;
> }
>
> - if (type_not_associated (value_type (val)))
> - {
> - val_print_not_associated (stream);
> - return 0;
> - }
> -
Could you explain why do you remove this?
> if (type_not_allocated (value_type (val)))
> {
> val_print_not_allocated (stream);
--
Yao (齐尧)
next prev parent reply other threads:[~2016-10-13 14:07 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 6:38 [PATCH V4 0/6] Fortran: Resolve " Bernhard Heckel
2016-09-07 6:38 ` [PATCH V4 3/6] Typeprint: Resolve any dynamic target type of a pointer Bernhard Heckel
2016-10-05 10:10 ` Yao Qi
2016-10-05 11:03 ` Bernhard Heckel
2016-10-13 13:41 ` Yao Qi
2016-09-07 6:38 ` [PATCH V4 4/6] Fortran: Typeprint, fix dangling types Bernhard Heckel
2016-10-13 13:53 ` Yao Qi
2016-09-07 6:38 ` [PATCH V4 5/6] Resolve dynamic target types of pointers Bernhard Heckel
2016-09-07 14:24 ` Eli Zaretskii
2016-10-13 14:07 ` Yao Qi [this message]
2016-10-13 14:57 ` Bernhard Heckel
2016-10-17 10:32 ` Yao Qi
2016-10-17 11:25 ` Bernhard Heckel
2016-10-17 12:18 ` Bernhard Heckel
2016-10-20 11:52 ` Bernhard Heckel
2016-10-20 15:33 ` Yao Qi
2016-11-08 7:07 ` Bernhard Heckel
2016-11-08 11:26 ` Yao Qi
2016-11-08 12:27 ` Bernhard Heckel
2016-11-16 12:16 ` Bernhard Heckel
2016-11-21 15:03 ` Bernhard Heckel
2016-09-07 6:38 ` [PATCH V4 2/6] Fortran: Resolve dynamic properties of pointer types Bernhard Heckel
2016-10-05 8:44 ` Yao Qi
2016-10-05 9:36 ` Yao Qi
2016-10-05 10:07 ` Bernhard Heckel
2016-09-07 6:38 ` [PATCH V4 6/6] Fortran: Testsuite, add cyclic pointers Bernhard Heckel
2016-10-13 14:08 ` Yao Qi
2016-09-07 6:38 ` [PATCH V4 1/6] Fortran: Testsuite, fix differences in type naming Bernhard Heckel
2016-09-21 15:57 ` Yao Qi
2016-09-14 12:55 ` [PING][PATCH V4 0/6] Fortran: Resolve target types of pointers Bernhard Heckel
2016-09-28 12:45 ` Bernhard Heckel
2016-10-05 6:03 ` [ping 2][PATCH " Bernhard Heckel
2016-09-21 9:49 ` [ping 2] [PATCH " Bernhard Heckel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86k2dc8hri.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=bernhard.heckel@intel.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).