This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Match the selftest output when captured_main is inlined


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3cfe46b618f140ce93de3cdbe9693b51eea4acf3

commit 3cfe46b618f140ce93de3cdbe9693b51eea4acf3
Author: Yao Qi <yao.qi@linaro.org>
Date:   Tue Jul 12 15:39:34 2016 +0100

    Match the selftest output when captured_main is inlined
    
    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-12  Yao Qi  <yao.qi@linaro.org>
    
    	* lib/selftest-support.exp (selftest_setup): Match the output
    	when captured_main is inlined.

Diff:
---
 gdb/testsuite/ChangeLog                | 5 +++++
 gdb/testsuite/lib/selftest-support.exp | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b6f21d7..a83c9f8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-12  Yao Qi  <yao.qi@linaro.org>
+
+	* lib/selftest-support.exp (selftest_setup): Match the output
+	when captured_main is inlined.
+
 2016-07-07  Walfred Tedeschi  <walfred.tedeschi@intel.com>
 
 	* gdb.fortran/derived-types.exp (result_line, result_line_2):
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]