From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44425 invoked by alias); 13 Apr 2017 08:36:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 44398 invoked by uid 89); 13 Apr 2017 08:36:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_1,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f54.google.com Received: from mail-wm0-f54.google.com (HELO mail-wm0-f54.google.com) (74.125.82.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Apr 2017 08:36:35 +0000 Received: by mail-wm0-f54.google.com with SMTP id o81so105568154wmb.1 for ; Thu, 13 Apr 2017 01:36:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=69nPtbx+Js697KPLYPWDAbaCMEashcRPVqJSrkVbCQA=; b=AdpvP2M7PXRIGDlsgktitaZmsvOgI7Qr6PK2uedNKXuR23ta84Tlhi47y9Af5Z0WKt XTWT1/mTNseeueWl2PZ8lTN5TL2CKG5tYW0p5+zcJ2IQnlPONyA0Kl+M9GJkxZ7J5pMY DyqzBPZmedFBlWCMOdJBp/UafPDSXJOxj7cLTWmVDIl8nxOmJMPn/d1JQXDFz8014J1u JKhcsxjBS2OVSbEin/94TB/kZPGhvxKel24roZGyC/NyCnAqdhQ5IFeoix9U6q38Io8P 8XnF5ZlJVsvxe9WjaBeXqg9nUTn5iI9x4uU7b4YZ3dlOVMIDtO4hWzRNQ9E0T4W+vrx0 +fuw== X-Gm-Message-State: AN3rC/6VqyW6NK5ECbW7f0ObheOf2ysjkTsbl4tHDAhWCGykcnX1rKn0 L668zjYvUdPNzaBZ X-Received: by 10.28.15.14 with SMTP id 14mr2214643wmp.106.1492072594920; Thu, 13 Apr 2017 01:36:34 -0700 (PDT) Received: from E107787-LIN ([194.214.185.158]) by smtp.gmail.com with ESMTPSA id 94sm28696752wrp.34.2017.04.13.01.36.33 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 13 Apr 2017 01:36:34 -0700 (PDT) From: Yao Qi To: Andreas Arnez Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/9] Add test for modifiable DWARF locations References: <1491586736-21296-1-git-send-email-arnez@linux.vnet.ibm.com> <1491586736-21296-2-git-send-email-arnez@linux.vnet.ibm.com> Date: Thu, 13 Apr 2017 08:36:00 -0000 In-Reply-To: <1491586736-21296-2-git-send-email-arnez@linux.vnet.ibm.com> (Andreas Arnez's message of "Fri, 7 Apr 2017 19:38:08 +0200") Message-ID: <86mvbkaelr.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00405.txt.bz2 Andreas Arnez 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. > + > +# Choose suitable integer registers for the test. > + > +set dwarf_regnum {0 1} > + > +if { [istarget "aarch64*-*-*"] } { if { [is_aarch64_target] } > + set regname {x0 x1} > +} elseif { [istarget "arm*-*-*"] else if { [is_aarch32_target] > + || [istarget "s390*-*-*" ] > + || [istarget "powerpc*-*-*"] > + || [istarget "rs6000*-*-aix*"] } { > + set regname {r0 r1} > +} elseif { [istarget "i?86-*-*"] } { > + set regname {eax edx} > +} elseif { [istarget "x86_64-*-*"] } { > + set regname {rax rdx} > +} else { > + verbose "Skipping tests for accessing DWARF-described variables." > + return > +} > + > +standard_testfile .c ${gdb_test_file_name}-dw.S > + > +# 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. > + } { > + # 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]. > + 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. --=20 Yao (=E9=BD=90=E5=B0=A7)