From patchwork Fri Oct 14 10:53:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 16501 Received: (qmail 59561 invoked by alias); 14 Oct 2016 10:53:29 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 59367 invoked by uid 89); 14 Oct 2016 10:53:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=3017, 1278, 3018, 127, 8 X-HELO: mail-pf0-f172.google.com Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Oct 2016 10:53:20 +0000 Received: by mail-pf0-f172.google.com with SMTP id e6so48388049pfk.3 for ; Fri, 14 Oct 2016 03:53:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=NL7pS5hAbnOiEuUVEwHP3BjsWWZGrOtOmCBwqA+2R+A=; b=l3vtMd5Yx5brfKNj/5Qv2s6K6mi+IeH1YvkOj1M9SUpzmjlsGxtaRQNPz++lKJO3+/ Cv57RkLrMRkD1AxdvpQVVlM4855ophhRvViAj88KXaEeHhnBfYkKUQh8FoLFl7fEdQHI pfF7rzhzFG/OFTyJCVR5MM/53a3qpZKR7Jt9UY/JMrPBh40RP0Gpjposwd0g8UGbaCvo 321xeqHlFATuAiNmNvQscusx9uMRMJQMX2XaY2M1EPpbtBT/3SvSHyeqIOV0pqojBQf1 qmn921hiwB8bY9wk3pXS/BTjS2NGzifRAQXcdKc0beUPaZOd/xfDUD5A7+W3axDaej4O yLIw== X-Gm-Message-State: AA6/9RmN7aQXu5nxPepzx1yxuj74XLTHAEtq+jkd5gM695acexScnOVAd1v/bGXQyJy8Rw== X-Received: by 10.98.135.131 with SMTP id i125mr17117013pfe.139.1476442399133; Fri, 14 Oct 2016 03:53:19 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id b4sm26598432paw.10.2016.10.14.03.53.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Oct 2016 03:53:18 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [RFC 3/3] Update test cases Date: Fri, 14 Oct 2016 11:53:07 +0100 Message-Id: <1476442387-17291-4-git-send-email-yao.qi@linaro.org> In-Reply-To: <1476442387-17291-1-git-send-email-yao.qi@linaro.org> References: <1476442387-17291-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes If "func" means the function descriptor, - the compare like "$pc == func" makes no sense, - "x/2i func+10" shows the instructions on func function descriptor address + 10, there shouldn't be any instructions, - "p func_label - func" no longer shows the offset from function func to label func_label. gdb/testsuite: 2016-10-14 Yao Qi * gdb.base/break-fun-addr.exp: Test whether $pc is in the start of function main. * gdb.base/breakpoint-in-ro-region.exp (get_function_bounds): Use function start address rather than function name. * gdb.base/examine-backward.exp: Stop using "x/i main". * gdb.mi/mi-var-cmd.exp: Match possible function descriptor address in the output. * lib/dwarf.exp (function_range): Use function address instead of function name. * lib/gdb.exp (get_var_address): Match possible function descriptor address in the output. --- gdb/testsuite/gdb.base/break-fun-addr.exp | 4 ++-- gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp | 2 +- gdb/testsuite/gdb.base/examine-backward.exp | 3 ++- gdb/testsuite/gdb.mi/mi-var-cmd.exp | 4 ++-- gdb/testsuite/lib/dwarf.exp | 5 +++-- gdb/testsuite/lib/gdb.exp | 3 ++- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/gdb.base/break-fun-addr.exp b/gdb/testsuite/gdb.base/break-fun-addr.exp index e8bed3f..ec4aeb5 100644 --- a/gdb/testsuite/gdb.base/break-fun-addr.exp +++ b/gdb/testsuite/gdb.base/break-fun-addr.exp @@ -57,7 +57,7 @@ with_test_prefix "${binfile1}" { "run to breakpoint at *main" # Verify also that we stopped at the start of the function... - gdb_test "p \$pc == main" " = 1" + gdb_test "x/i \$pc" "
:.*" } set testfile2 "break-fun-addr2" @@ -80,5 +80,5 @@ with_test_prefix "${binfile2}" { "Breakpoint.* main \\(\\) at .*$srcfile2:.*" \ "run to breakpoint at *main" - gdb_test "p \$pc == main" " = 1" + gdb_test "x/i \$pc" "
:.*" } diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp index 0c954c8..d4b2529 100644 --- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp +++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp @@ -76,7 +76,7 @@ proc get_function_bounds {function func_lo func_hi} { # Account for the size of the last instruction. set test "get hi address of $function" - gdb_test_multiple "x/2i $function+$size" $test { + gdb_test_multiple "x/2i $lo+$size" $test { -re ".*$hex <$function\\+$size>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" { set hi $expect_out(1,string) pass $test diff --git a/gdb/testsuite/gdb.base/examine-backward.exp b/gdb/testsuite/gdb.base/examine-backward.exp index e03cbfd..16a74c7 100644 --- a/gdb/testsuite/gdb.base/examine-backward.exp +++ b/gdb/testsuite/gdb.base/examine-backward.exp @@ -301,7 +301,8 @@ with_test_prefix "backward disassemble general" { set length_to_examine {1 2 3 4 10} set disassmbly {} - gdb_test "x/i main" "0x\[0-9a-fA-F\]+
:\t.*" \ + set main_addr [get_var_address "main"] + gdb_test "x/i $main_addr" "0x\[0-9a-fA-F\]+
:\t.*" \ "move the current position to main (x/i)" gdb_test "x/-i" "0x\[0-9a-fA-F\]+
:\t.*" \ "move the current position to main (x/-i)" diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp index 558cd6c..af7307d 100644 --- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp +++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp @@ -349,7 +349,7 @@ mi_gdb_test "-var-assign ldouble 5.333318284590435" \ "assign to ldouble" mi_gdb_test "-var-assign func do_block_tests" \ - "\\^done,value=\"$hex \"" \ + "\\^done,value=\"(@$hex: )?$hex \"" \ "assign to func" mi_gdb_test "-var-assign lsimple.character 'd'" \ @@ -373,7 +373,7 @@ mi_gdb_test "-var-update *" \ # pointer before comparing with the existing value, # and does not incorrectly make the value as changed. mi_gdb_test "-var-assign func do_block_tests" \ - "\\^done,value=\"$hex \"" \ + "\\^done,value=\"(@$hex: )?$hex \"" \ "assign same value to func" mi_gdb_test "-var-update *" \ diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 717cbb0..c328c9f 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -127,8 +127,9 @@ proc function_range { func src } { # Compute the label offset, and we can get the function start address # by "${func}_label - $func_label_offset". + set func_addr [get_var_address ${func}] set func_label_offset "" - set test "p ${func}_label - ${func}" + set test "p/d ${func}_label - ${func_addr}" gdb_test_multiple $test $test { -re ".* = ($decimal)\r\n$gdb_prompt $" { set func_label_offset $expect_out(1,string) @@ -151,7 +152,7 @@ proc function_range { func src } { } else { set func_pattern "$func\\+$func_length" } - set test "x/2i $func+$func_length" + set test "x/2i $func_addr+$func_length" gdb_test_multiple $test $test { -re ".*($hex) <$func_pattern>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" { set start $expect_out(1,string) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 378eea0..364ee46 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5595,9 +5595,10 @@ proc get_var_address { var } { # $1 = (int *) 0x0 # $5 = (int (*)()) 0 # $6 = (int (*)()) 0x24 + # $7 = (int (*)()) @x12: 0x24 gdb_test_multiple "print &${var}" "get address of ${var}" { - -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" + -re "\\\$\[0-9\]+ = \\(.*\\)(?: @$hex:)? (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" { pass "get address of ${var}" if { $expect_out(1,string) == "0" } {