From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6844 invoked by alias); 24 Nov 2013 10:07:56 -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 6832 invoked by uid 89); 24 Nov 2013 10:07:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 24 Nov 2013 10:07:54 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VkWbK-0003vv-La from Hui_Zhu@mentor.com for gdb-patches@sourceware.org; Sun, 24 Nov 2013 02:07:38 -0800 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 24 Nov 2013 02:07:38 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Sun, 24 Nov 2013 02:07:37 -0800 Message-ID: <5291CFE8.4040603@mentor.com> Date: Sun, 24 Nov 2013 12:14:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: gdb-patches ml Subject: Fwd: Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin References: <52316D0C.9000707@mentor.com> In-Reply-To: <52316D0C.9000707@mentor.com> X-Forwarded-Message-Id: <52316D0C.9000707@mentor.com> Content-Type: multipart/mixed; boundary="------------070005040008060708000904" X-IsSubscribed: yes X-SW-Source: 2013-11/txt/msg00744.txt.bz2 --------------070005040008060708000904 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1747 Ping. Thanks, Hui -------- Original Message -------- Subject: Re: [PATCH] Fix gdb.base/shreloc.exp: (msymbol) relocated functions have different addresses fail in cygwin Date: Thu, 12 Sep 2013 15:28:12 +0800 From: Hui Zhu To: Yao Qi CC: Hui Zhu , gdb-patches ml Hi Yao, Thanks for your review. On 09/12/13 14:49, Yao Qi wrote: > On 09/12/2013 02:31 PM, Hui Zhu wrote: >> -proc get_msym_addrs { var msymfile } { >> +proc get_msym_addrs { var msymfile { plus_var "" } } { > > 'plus_var' is not good candidate for parameter name. I'd call it 'mst' > or 'msym_type'. Fixed. > >> # Extract the list of values for symbols matching var in the >> # minimal symbol output file >> >> global gdb_prompt hex >> set result "" >> >> - send_gdb "shell grep -E \" ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n" >> + if { "${plus_var}" == "" } { >> + send_gdb "shell grep -E \" ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n" >> + } else { >> + send_gdb "shell grep -E \" ${plus_var} .* ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n" >> + } > > This condition checking is not necessary, we can do > > send_gdb "shell grep -E \"${plus_var} ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n" Because for the output format is: [ 7] T 0x2aaaaacd058a fn_1 section .text shreloc1.c It need a ".*" after "T". So I change "T" to "T.*" to handle it. Post a new version according to your comments. Best, Hui 2013-09-12 Hui Zhu * gdb.base/shreloc.exp (get_msym_addrs): Add argument "msym_type". (check_different): Ditto. ((msymbol) relocated functions have different addresses): Add argument 'T.*' when call check_different. --------------070005040008060708000904 Content-Type: text/plain; charset="us-ascii"; name="fix-cygwin-shreloc.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-cygwin-shreloc.txt" Content-length: 1519 --- a/gdb/testsuite/gdb.base/shreloc.exp +++ b/gdb/testsuite/gdb.base/shreloc.exp @@ -157,14 +157,14 @@ proc send_gdb_discard { command } { } } -proc get_msym_addrs { var msymfile } { +proc get_msym_addrs { var msymfile { msym_type "" } } { # Extract the list of values for symbols matching var in the # minimal symbol output file global gdb_prompt hex set result "" - send_gdb "shell grep -E \" ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n" + send_gdb "shell grep -E \"${msym_type} ${var}(\[ \t\]+.*)?\$\" ${msymfile}\n" while 1 { gdb_expect { @@ -201,10 +201,10 @@ proc check_same {var msymfile} { } } -proc check_different {var msymfile} { +proc check_different {var msymfile { msym_type "" } } { # Check that the minimal symbol values matching var are different - set addr_list [lsort [get_msym_addrs "${var}" "${msymfile}"]] + set addr_list [lsort [get_msym_addrs "${var}" "${msymfile}" "${msym_type}"]] set prev "" if { [llength ${addr_list}] < 2 } { @@ -236,7 +236,9 @@ if [send_gdb_discard "maint print msymbo fail "(msymbol) relocated extern vars have different addresses" } - if {[check_different "fn_\[12\]" "${msymfile}"]} { + # Msymbol type of "relocated function" should be 'T', so we just + # check 'T' type. + if {[check_different "fn_\[12\]" "${msymfile}" "T.*"]} { pass "(msymbol) relocated functions have different addresses" } else { fail "(msymbol) relocated functions have different addresses" --------------070005040008060708000904--