From patchwork Tue Jul 5 15:42:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 13662 Received: (qmail 67234 invoked by alias); 5 Jul 2016 15:43:16 -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 67043 invoked by uid 89); 5 Jul 2016 15:43:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Gm-Message-State:ALyK8tL, stops, H*MI:yao X-HELO: mail-pf0-f196.google.com Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 05 Jul 2016 15:43:03 +0000 Received: by mail-pf0-f196.google.com with SMTP id i123so19337051pfg.3 for ; Tue, 05 Jul 2016 08:43:03 -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; bh=gU+OGmnlSzfGZs+YC+AGzfv4KY5fX+lYNk8I6J88RP8=; b=BC5iF3UA2XW/zlrErgOBqIXxdrZ2TTGeHgh9AWtQHWS3zqUiODQg2yZFR3B1wNXs54 tuDL8+TsQPF6qD+WcjX46zws6h6a8p6SzNnPb+wQoMfuC5jqBrakPy2Db4s0/RLjxhir +u0jiRKIS3PEt1JnJdHRblqgh1UJ5sxQN2drKrfJHuWkRQ/b1DWdu2Kg82bACCUelfZt fSaZqxLqlsK/TVnLxdZhl8lHQeRIxh11G0FJkARhvaLd5gdO/sXpe8M5onkPhc0MYiUI M93AqsmzvUAt6++js4y4bmgy/r6wq4oQbvS1XgvWG0y19bHuLvkoiBiRHURIys+XK2Nc vDOg== X-Gm-Message-State: ALyK8tL/Pz2hgp0Mz7cAJtxJOsutxDWk1LIkmhjspCyNgJSyQpluujRxxeCa9QGhDT+oXA== X-Received: by 10.98.152.210 with SMTP id d79mr33043913pfk.2.1467733381269; Tue, 05 Jul 2016 08:43:01 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id o68sm6135028pfb.18.2016.07.05.08.43.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Jul 2016 08:43:00 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Match the selftest output when captured_main is inlined Date: Tue, 5 Jul 2016 16:42:52 +0100 Message-Id: <1467733372-28632-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes In gdb.gdb/observer.exp, I see the following fail, (gdb) break captured_main^M Breakpoint 1 at 0x57e409: file ../../binutils-gdb/gdb/main.c, line 492.^M (gdb) PASS: gdb.gdb/observer.exp: breakpoint in captured_main run -nw -nx -data-directory /home/yao.qi/SourceCode/gnu/build/gdb/testsuite/../data-directory^M Starting program: /home/yao.qi/SourceCode/gnu/build/gdb/testsuite/outputs/gdb.gdb/observer/xgdb -nw -nx -data-directory /home/yao.qi/SourceCode/gnu/build/gdb/testsuite/../data-directory^M [Thread debugging using libthread_db enabled]^M Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".^M ^M Breakpoint 1, gdb_main (args=args@entry=0x7fffffffdca0) at ../../binutils-gdb/gdb/main.c:1157^M 1157 captured_main (args);^M (gdb) FAIL: gdb.gdb/observer.exp: run until breakpoint at captured_main looks the test sets breakpoint on captured_main, and expects program stops at captured_main. However, program stops at the place where captured_main is called, because captured_main is inlined, <1><8519e3>: Abbrev Number: 58 (DW_TAG_subprogram) <8519e4> DW_AT_name : (indirect string, offset: 0x880d3): captured_main <8519e8> DW_AT_decl_file : 1 <8519e9> DW_AT_decl_line : 444 <8519eb> DW_AT_type : <0x846e48> <8519ef> DW_AT_inline : 1 (inlined) <8519f0> DW_AT_sibling : <0x851c01> The test passes if I build GDB with '-O0 -g3', because captured_main isn't inlined. This patch is to match the output when captured_main is inlined. gdb/testsuite: 2016-07-05 Yao Qi * lib/selftest-support.exp (selftest_setup): Match the output when captured_main is inlined. --- gdb/testsuite/lib/selftest-support.exp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp index df99f58..f171cc8 100644 --- a/gdb/testsuite/lib/selftest-support.exp +++ b/gdb/testsuite/lib/selftest-support.exp @@ -94,6 +94,11 @@ proc selftest_setup { executable function } { -re "Starting program.*Breakpoint \[0-9\]+,.*$function .data.*$gdb_prompt $" { xfail "$description (line numbers scrambled?)" } + -re "Starting program.*Breakpoint \[0-9\]+,.* at .*main.c:.*$function.*$gdb_prompt $" { + # $function may be inlined, so the program stops at the line + # calling $function. + pass "$description" + } -re "vfork: No more processes.*$gdb_prompt $" { fail "$description (out of virtual memory)" set timeout $oldtimeout