Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/9] Add test for modifiable DWARF locations
Date: Thu, 13 Apr 2017 11:46:00 -0000	[thread overview]
Message-ID: <m3zifk8r8d.fsf@oc1027705133.ibm.com> (raw)
In-Reply-To: <86mvbkaelr.fsf@gmail.com> (Yao Qi's message of "Thu, 13 Apr 2017	09:36:32 +0100")

On Thu, Apr 13 2017, Yao Qi wrote:

> Andreas Arnez <arnez@linux.vnet.ibm.com> writes:
>
>> This adds a test for read/write access to variables with various types of
>> DWARF locations.  It uses register- and memory locations and composite
>> locations with register- and memory pieces.
>
> The last line should be put into the introduction comment of
> gdb.dwarf2/var-access.exp.

OK.

[...]

>> +# Make some DWARF for the test.
>> +
>> +set asm_file [standard_output_file $srcfile2]
>> +Dwarf::assemble $asm_file {
>> +    global srcdir subdir srcfile
>> +    global dwarf_regnum regname
>> +
>> +    set main_func \
>> +	[function_range main [list ${srcdir}/${subdir}/$srcfile]]
>
>> +
>> +	    DW_TAG_subprogram {
>> +		{name "main"}
>> +		{DW_AT_external 1 flag}
>> +		{low_pc [lindex $main_func 0] DW_FORM_addr}
>> +		{high_pc [lindex $main_func 1] DW_FORM_udata}
>
> You can use MACRO_AT_func, it can replace name, low_pc and high_pc.
> Also, you don't need to call function_range above.

Right, I missed that, thanks.

>
>> +	    } {
>> +		# Simple memory location.
>> +		DW_TAG_variable {
>> +		    {name "a"}
>> +		    {type :$array_a8_label}
>> +		    {location {
>> +			addr $buf_var
>> +		    } SPECIAL_expr}
>> +		}
>> +		# Memory pieces.
>
> Nit: we can also describe where are these pieces in comments, like
>
>                 # Memory pieces, two bytes from &buf[0], and two
>                 # bytes from &buf[2].

The other way around ;-)

>
>> +		DW_TAG_variable {
>> +		    {name "s1"}
>> +		    {type :$struct_s_label}
>> +		    {location {
>> +			addr $buf_var
>> +			plus_uconst 2
>> +			piece 2
>> +			addr $buf_var
>> +			piece 2
>> +		    } SPECIAL_expr}
>> +		}
>> +		# Register- and memory pieces.
>
> Likewise.
>
> OK with the changes.

Thanks, updated the patch with the delta patch below.  Also updated the
follow-on patches with similar comments for the composite locations in
var-access.exp.

--
Andreas


diff --git a/gdb/testsuite/gdb.dwarf2/var-access.exp b/gdb/testsuite/gdb.dwarf2/var-access.exp
index ee93b93..4d6c9ca 100644
--- a/gdb/testsuite/gdb.dwarf2/var-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -13,7 +13,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test reading/writing variables with non-trivial DWARF locations.
+# Test reading/writing variables with non-trivial DWARF locations.  In
+# particular the test uses register- and memory locations as well as
+# composite locations with register- and memory pieces.
 
 load_lib dwarf.exp
 
@@ -51,8 +53,6 @@ Dwarf::assemble $asm_file {
     global srcdir subdir srcfile
     global dwarf_regnum regname
 
-    set main_func \
-	[function_range main [list ${srcdir}/${subdir}/$srcfile]]
     set buf_var [gdb_target_symbol buf]
 
     cu {} {
@@ -112,10 +112,8 @@ Dwarf::assemble $asm_file {
 	    }
 
 	    DW_TAG_subprogram {
-		{name "main"}
+		{MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
 		{DW_AT_external 1 flag}
-		{low_pc [lindex $main_func 0] DW_FORM_addr}
-		{high_pc [lindex $main_func 1] DW_FORM_udata}
 	    } {
 		# Simple memory location.
 		DW_TAG_variable {
@@ -125,7 +123,8 @@ Dwarf::assemble $asm_file {
 			addr $buf_var
 		    } SPECIAL_expr}
 		}
-		# Memory pieces.
+		# Memory pieces: two bytes from &buf[2], and two bytes
+		# from &buf[0].
 		DW_TAG_variable {
 		    {name "s1"}
 		    {type :$struct_s_label}
@@ -137,7 +136,8 @@ Dwarf::assemble $asm_file {
 			piece 2
 		    } SPECIAL_expr}
 		}
-		# Register- and memory pieces.
+		# Register- and memory pieces: one byte each from r0,
+		# &buf[4], r1, and &buf[5].
 		DW_TAG_variable {
 		    {name "s2"}
 		    {type :$struct_s_label}


  reply	other threads:[~2017-04-13 11:46 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 17:39 [PATCH 0/9] Various DWARF piece fixes Andreas Arnez
2017-04-07 17:39 ` [PATCH 1/9] Add test for modifiable DWARF locations Andreas Arnez
2017-04-13  4:00   ` Simon Marchi
2017-04-13 10:52     ` Andreas Arnez
2017-04-13  8:36   ` Yao Qi
2017-04-13 11:46     ` Andreas Arnez [this message]
2017-04-07 17:40 ` [PATCH 2/9] Fix size capping in write_pieced_value Andreas Arnez
2017-04-13  8:18   ` Yao Qi
2017-04-13 16:35     ` Andreas Arnez
2017-04-19  9:15       ` Yao Qi
2017-04-19 14:36         ` Andreas Arnez
2017-04-19 15:00           ` Yao Qi
2017-04-07 17:41 ` [PATCH 3/9] PR gdb/21226: Take DWARF stack value pieces from LSB end Andreas Arnez
2017-04-14  3:36   ` Simon Marchi
2017-04-18 16:32     ` Andreas Arnez
2017-04-18 16:43       ` Simon Marchi
2017-04-07 17:41 ` [PATCH 4/9] Remove addr_size field from struct piece_closure Andreas Arnez
2017-04-13  9:10   ` Yao Qi
2017-04-14  3:39     ` Simon Marchi
2017-04-18 17:25       ` Andreas Arnez
2017-04-18 18:49         ` Simon Marchi
2017-04-07 17:42 ` [PATCH 5/9] Fix issues in write_pieced_value when targeting bit-fields Andreas Arnez
2017-04-14  5:18   ` Simon Marchi
2017-04-27 17:54     ` Andreas Arnez
2017-05-03 13:59       ` Simon Marchi
2017-04-07 17:43 ` [PATCH 6/9] Fix handling of DWARF register pieces on big-endian targets Andreas Arnez
2017-04-14 14:11   ` Simon Marchi
2017-04-19 18:03     ` Andreas Arnez
2017-04-07 17:43 ` [PATCH 7/9] Improve logic for buffer allocation in read/write_pieced_value Andreas Arnez
2017-04-14 14:51   ` Simon Marchi
2017-04-07 17:44 ` [PATCH 8/9] Respect piece offset for DW_OP_bit_piece Andreas Arnez
2017-04-14 15:07   ` Simon Marchi
2017-04-07 17:45 ` [PATCH 9/9] Remove unnecessary copies of variables in read/write_pieced_value Andreas Arnez
2017-04-14 15:21   ` Simon Marchi

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=m3zifk8r8d.fsf@oc1027705133.ibm.com \
    --to=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /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