Re: [PATCH] [SH] Prologue skipping if there is none

Kevin Buettner
2012-02-17T01:26:28Z

Hi Thomas,

On Thu, 16 Feb 2012 17:32:18 +0100
Thomas Schwinge <thomas@codesourcery.com> wrote:

> I now have (on a SH7785-based board). My patch fixes a few more failures
> than yours. ;-P

This will require more study and discussion then. I tested against
the simulator using the default multilib. I compared results using
each of our patches to an unpatched sh-tdep.c.

Here are the FAILs that my patch fixed. There are 246 of them.

FAIL: gdb.arch/gdb1291.exp: set breakpoint
FAIL: gdb.arch/gdb1291.exp: get to sub1 (the program exited)
FAIL: gdb.arch/gdb1291.exp: backtrace with local variable less than or equal to 256 bytes
FAIL: gdb.arch/gdb1291.exp: set breakpoint
FAIL: gdb.arch/gdb1291.exp: get to sub2 (the program is no longer running)
FAIL: gdb.arch/gdb1291.exp: backtrace with local variable larger than 256 bytes
FAIL: gdb.arch/gdb1431.exp: get to sub1
FAIL: gdb.arch/gdb1431.exp: advance returns from sub1 frame
FAIL: gdb.arch/gdb1431.exp: get to sub2
FAIL: gdb.base/arrayidx.exp: Print array with array-indexes off
FAIL: gdb.base/arrayidx.exp: Print array with array-indexes on
FAIL: gdb.base/break-always.exp: continue to breakpoint: bar
FAIL: gdb.base/break-inline.exp: start
FAIL: gdb.base/break.exp: next over recursive call
FAIL: gdb.base/break.exp: backtrace from factorial(5.1)
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tc
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tc
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-ts
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-ts
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-ti
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-ti
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tl
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tl
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tll
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tll
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tf
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tf
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-td
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-td
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tld
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tld
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-te
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-te
FAIL: gdb.base/chng-syms.exp: running to stop_here first time
FAIL: gdb.base/chng-syms.exp: continue until exit at breakpoint first time through (the program is no longer running)
FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
FAIL: gdb.base/longjmp.exp: next over setjmp (1)
FAIL: gdb.base/longjmp.exp: next to longjmp (1)
FAIL: gdb.base/longjmp.exp: next over setjmp (2)
FAIL: gdb.base/nodebug.exp: backtrace from inner in nodebug.exp
FAIL: gdb.base/nodebug.exp: backtrace from middle in nodebug.exp
FAIL: gdb.base/pc-fp.exp: get hexadecimal valueof "$fp" (timeout)
FAIL: gdb.base/pc-fp.exp: display/i $pc
FAIL: gdb.base/reread.exp: breakpoint foo in first file
FAIL: gdb.base/reread.exp: run to foo()
FAIL: gdb.base/return-nodebug.exp: signed-char: return from function with no debug info with a cast
FAIL: gdb.base/return-nodebug.exp: signed-char: full width of the returned result
FAIL: gdb.base/return-nodebug.exp: short: return from function with no debug info with a cast
FAIL: gdb.base/return-nodebug.exp: short: full width of the returned result
FAIL: gdb.base/return-nodebug.exp: int: return from function with no debug info with a cast
FAIL: gdb.base/return-nodebug.exp: int: full width of the returned result
FAIL: gdb.base/return-nodebug.exp: long: return from function with no debug info with a cast
FAIL: gdb.base/return-nodebug.exp: long: full width of the returned result
FAIL: gdb.base/return-nodebug.exp: long-long: return from function with no debug info with a cast
FAIL: gdb.base/return-nodebug.exp: long-long: full width of the returned result
FAIL: gdb.base/return.exp: continue to return of -5
FAIL: gdb.base/return.exp: continue to return of -5.0
FAIL: gdb.base/return2.exp: void function returned successfully
FAIL: gdb.base/scope.exp: print funclocal at bar
FAIL: gdb.base/scope.exp: print funclocal_bss at bar
FAIL: gdb.base/sepdebug.exp: next over recursive call
FAIL: gdb.base/sepdebug.exp: backtrace from factorial(5.1)
FAIL: gdb.base/skip.exp: step after deleting 1 (3)
FAIL: gdb.base/skip.exp: step after disabling 3 (5)
FAIL: gdb.base/skip.exp: step after enable 3 (3)
FAIL: gdb.base/step-resume-infcall.exp: step
FAIL: gdb.base/step-test.exp: step into
FAIL: gdb.base/step-test.exp: large struct by value
FAIL: gdb.base/store.exp: var struct 2 u; next to add_struct_2 call
FAIL: gdb.base/store.exp: var struct 2 u; print old u, expecting {s = \{0, 0}}
FAIL: gdb.base/store.exp: var struct 2 u; set u to s_2
FAIL: gdb.base/store.exp: var struct 2 u; print new u, expecting {s = \{1, 2}}
FAIL: gdb.base/store.exp: var struct 3 u; next to add_struct_3 call
FAIL: gdb.base/store.exp: var struct 3 u; print old u, expecting {s = \{0, 0, 0}}
FAIL: gdb.base/store.exp: var struct 3 u; set u to s_3
FAIL: gdb.base/store.exp: var struct 3 u; print new u, expecting {s = \{1, 2, 3}}
FAIL: gdb.base/store.exp: var struct 4 u; next to add_struct_4 call
FAIL: gdb.base/store.exp: var struct 4 u; print old u, expecting {s = \{0, 0, 0, 0}}
FAIL: gdb.base/store.exp: var struct 4 u; set u to s_4
FAIL: gdb.base/store.exp: var struct 4 u; print new u, expecting {s = \{1, 2, 3, 4}}
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tc
FAIL: gdb.base/structs.exp: return foo<n>; return 2 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tc
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 2 structs-tc
FAIL: gdb.base/structs.exp: finish foo<n>; return 2 structs-tc
FAIL: gdb.base/structs.exp: value foo<n> finished; return 2 structs-tc
FAIL: gdb.base/structs.exp: return foo<n>; return 3 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 3 structs-tc
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 3 structs-tc
FAIL: gdb.base/structs.exp: finish foo<n>; return 3 structs-tc
FAIL: gdb.base/structs.exp: value foo<n> finished; return 3 structs-tc
FAIL: gdb.base/structs.exp: return foo<n>; return 4 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 4 structs-tc
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 4 structs-tc
FAIL: gdb.base/structs.exp: finish foo<n>; return 4 structs-tc
FAIL: gdb.base/structs.exp: value foo<n> finished; return 4 structs-tc
FAIL: gdb.base/structs.exp: return foo<n>; return 5 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 5 structs-tc
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 5 structs-tc
FAIL: gdb.base/structs.exp: finish foo<n>; return 5 structs-tc
FAIL: gdb.base/structs.exp: value foo<n> finished; return 5 structs-tc
FAIL: gdb.base/structs.exp: return foo<n>; return 6 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 6 structs-tc
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 6 structs-tc
FAIL: gdb.base/structs.exp: finish foo<n>; return 6 structs-tc
FAIL: gdb.base/structs.exp: value foo<n> finished; return 6 structs-tc
FAIL: gdb.base/structs.exp: return foo<n>; return 7 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 7 structs-tc
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 7 structs-tc
FAIL: gdb.base/structs.exp: finish foo<n>; return 7 structs-tc
FAIL: gdb.base/structs.exp: value foo<n> finished; return 7 structs-tc
FAIL: gdb.base/structs.exp: return foo<n>; return 8 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 8 structs-tc
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 8 structs-tc
FAIL: gdb.base/structs.exp: finish foo<n>; return 8 structs-tc
FAIL: gdb.base/structs.exp: value foo<n> finished; return 8 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-ts
FAIL: gdb.base/structs.exp: return foo<n>; return 2 structs-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-ts
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 2 structs-ts
FAIL: gdb.base/structs.exp: finish foo<n>; return 2 structs-ts
FAIL: gdb.base/structs.exp: value foo<n> finished; return 2 structs-ts
FAIL: gdb.base/structs.exp: return foo<n>; return 3 structs-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 3 structs-ts
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 3 structs-ts
FAIL: gdb.base/structs.exp: finish foo<n>; return 3 structs-ts
FAIL: gdb.base/structs.exp: value foo<n> finished; return 3 structs-ts
FAIL: gdb.base/structs.exp: return foo<n>; return 4 structs-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 4 structs-ts
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 4 structs-ts
FAIL: gdb.base/structs.exp: finish foo<n>; return 4 structs-ts
FAIL: gdb.base/structs.exp: value foo<n> finished; return 4 structs-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tll
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tll
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-td
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-td
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tld
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tld
FAIL: gdb.base/structs.exp: return foo<n>; return 2 structs-ts-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-ts-tc
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 2 structs-ts-tc
FAIL: gdb.base/structs.exp: finish foo<n>; return 2 structs-ts-tc
FAIL: gdb.base/structs.exp: value foo<n> finished; return 2 structs-ts-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-ti-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-ti-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tl-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tl-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tf-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tf-tc
FAIL: gdb.base/structs.exp: return foo<n>; return 2 structs-tc-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tc-ts
FAIL: gdb.base/structs.exp: zed L<n> for finish; return 2 structs-tc-ts
FAIL: gdb.base/structs.exp: finish foo<n>; return 2 structs-tc-ts
FAIL: gdb.base/structs.exp: value foo<n> finished; return 2 structs-tc-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tc-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tc-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tc-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tc-tl
FAIL: gdb.base/value-double-free.exp: continue
FAIL: gdb.base/watch-cond-infcall.exp: hw: continue
FAIL: gdb.base/watch-cond-infcall.exp: sw: continue
FAIL: gdb.base/watchpoint-cond-gone.exp: Place the watchpoint
FAIL: gdb.base/watchpoint-cond-gone.exp: Catch the no longer valid watchpoint
FAIL: gdb.base/watchpoint.exp: global_ptr next
FAIL: gdb.base/watchpoint.exp: next over ptr init
FAIL: gdb.base/watchpoint.exp: next over buffer set
FAIL: gdb.base/watchpoint.exp: global_ptr_ptr next
FAIL: gdb.base/watchpoint.exp: next over global_ptr_ptr init
FAIL: gdb.base/watchpoint.exp: next over global_ptr_ptr buffer set
FAIL: gdb.base/watchpoint.exp: next over global_ptr_ptr pointer advance
FAIL: gdb.base/watchpoint.exp: no-hw: global_ptr next
FAIL: gdb.base/watchpoint.exp: no-hw: next over ptr init
FAIL: gdb.base/watchpoint.exp: no-hw: next over buffer set
FAIL: gdb.base/watchpoint.exp: no-hw: global_ptr_ptr next
FAIL: gdb.base/watchpoint.exp: no-hw: next over global_ptr_ptr init
FAIL: gdb.base/watchpoint.exp: no-hw: next over global_ptr_ptr buffer set
FAIL: gdb.base/watchpoint.exp: no-hw: next over global_ptr_ptr pointer advance
FAIL: gdb.base/watchpoints.exp: watchpoint ival1 hit, second time
FAIL: gdb.base/watchpoints.exp: Watchpoint ival1 hit count is 2
FAIL: gdb.base/watchpoints.exp: watchpoint hit, second time
FAIL: gdb.base/watchpoints.exp: Watchpoint hit count is 2
FAIL: gdb.base/watchpoints.exp: watchpoint ival1 hit, third time
FAIL: gdb.base/watchpoints.exp: Watchpoint ival1 hit count is 3
FAIL: gdb.base/watchpoints.exp: watchpoint hit, third time
FAIL: gdb.base/watchpoints.exp: Watchpoint hit count is 3
FAIL: gdb.base/watchpoints.exp: watchpoint hit, fourth time
FAIL: gdb.base/watchpoints.exp: Watchpoint hit count is 4
FAIL: gdb.base/watchpoints.exp: watchpoint hit, fifth time
FAIL: gdb.base/watchpoints.exp: Watchpoint hit count is 5
FAIL: gdb.cp/expand-sals.exp: continue to breakpoint: func
FAIL: gdb.cp/expand-sals.exp: continue to breakpoint: next caller func
FAIL: gdb.cp/extern-c.exp: continue to breakpoint: c_func
FAIL: gdb.cp/extern-c.exp: continue to breakpoint: c_funcs_1
FAIL: gdb.cp/extern-c.exp: continue to breakpoint: c_funcs_2
FAIL: gdb.cp/namespace-nested-import.exp: print C::x
FAIL: gdb.dwarf2/dw2-cp-infcall-ref-static.exp: p f()
FAIL: gdb.dwarf2/dw2-ref-missing-frame.exp: func_nofb backtrace
FAIL: gdb.dwarf2/dw2-ref-missing-frame.exp: func_loopfb backtrace
FAIL: gdb.linespec/linespec.exp: set breakpoint at lspec.cc instance of NameSpace::overload
FAIL: gdb.linespec/linespec.exp: set breakpoint at specific instance of NameSpace::overload
FAIL: gdb.mi/dw2-ref-missing-frame.exp: test func_nofb_marker
FAIL: gdb.mi/mi-var-display.exp: print FP register
FAIL: gdb.mi/mi2-var-display.exp: print FP register
FAIL: gdb.opt/inline-bt.exp: continue to bar (1)
FAIL: gdb.opt/inline-bt.exp: continue to bar (2)
FAIL: gdb.opt/inline-bt.exp: continue to bar (3)
FAIL: gdb.opt/inline-cmds.exp: continue to bar (1)
FAIL: gdb.opt/inline-cmds.exp: continue to bar (2)
FAIL: gdb.opt/inline-cmds.exp: continue to marker
FAIL: gdb.opt/inline-cmds.exp: next over inlined functions
FAIL: gdb.opt/inline-cmds.exp: next past inlined func1
FAIL: gdb.opt/inline-cmds.exp: step into finish marker
FAIL: gdb.opt/inline-cmds.exp: enter inlined_fn from noinline
FAIL: gdb.opt/inline-cmds.exp: backtrace at inlined_fn from noinline
FAIL: gdb.opt/inline-cmds.exp: inlined_fn from noinline inlined
FAIL: gdb.opt/inline-cmds.exp: up to noinline
FAIL: gdb.opt/inline-cmds.exp: noinline from outer_inline1 not inlined
FAIL: gdb.opt/inline-cmds.exp: up to outer_inline1
FAIL: gdb.opt/inline-cmds.exp: outer_inline1 inlined
FAIL: gdb.opt/inline-cmds.exp: up to outer_inline2
FAIL: gdb.opt/inline-cmds.exp: outer_inline2 inlined
FAIL: gdb.opt/inline-cmds.exp: up from outer_inline2
FAIL: gdb.opt/inline-cmds.exp: main not inlined
FAIL: gdb.opt/inline-locals.exp: continue to bar (1)
FAIL: gdb.opt/inline-locals.exp: continue to bar (2)
FAIL: gdb.opt/inline-locals.exp: continue to bar (3)
FAIL: gdb.stabs/gdb11479.exp: Stop at first breakpoint forced_stabs (the program exited)
FAIL: gdb.stabs/gdb11479.exp: Inspect t in test2 forced_stabs
FAIL: gdb.stabs/gdb11479.exp: sizeof (e) in test2 forced_stabs
FAIL: gdb.stabs/gdb11479.exp: Stop at first breakpoint forced_stabs (the program is no longer running)
FAIL: gdb.stabs/gdb11479.exp: Inspect t in test forced_stabs
FAIL: gdb.stabs/gdb11479.exp: sizeof (e) in test forced_stabs

Here is a list of FAILs that my patch introduced (regressions). There
are 9 of them:

FAIL: gdb.base/store.exp: continue to add_charest
FAIL: gdb.base/store.exp: continue to add_short
FAIL: gdb.base/store.exp: continue to add_int
FAIL: gdb.base/store.exp: continue to add_long
FAIL: gdb.base/store.exp: continue to add_longest
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-td-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-td-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tf-td
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tf-td

Here are the FAILs that your patch fixed. There are 127 of them.

FAIL: gdb.base/arrayidx.exp: Print array with array-indexes off
FAIL: gdb.base/arrayidx.exp: Print array with array-indexes on
FAIL: gdb.base/break-always.exp: continue to breakpoint: bar
FAIL: gdb.base/break-inline.exp: start
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tc
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tc
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-ts
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-ts
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-ti
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-ti
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tl
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tl
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tll
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tll
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tf
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tf
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-td
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-td
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tld
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tld
FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-te
FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-te
FAIL: gdb.base/chng-syms.exp: running to stop_here first time
FAIL: gdb.base/chng-syms.exp: continue until exit at breakpoint first time through (the program is no longer running)
FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
FAIL: gdb.base/reread.exp: breakpoint foo in first file
FAIL: gdb.base/reread.exp: run to foo()
FAIL: gdb.base/return.exp: continue to return of -5
FAIL: gdb.base/return.exp: continue to return of -5.0
FAIL: gdb.base/return2.exp: void function returned successfully
FAIL: gdb.base/scope.exp: print funclocal at bar
FAIL: gdb.base/scope.exp: print funclocal_bss at bar
FAIL: gdb.base/skip.exp: step after deleting 1 (3)
FAIL: gdb.base/skip.exp: step after disabling 3 (5)
FAIL: gdb.base/skip.exp: step after enable 3 (3)
FAIL: gdb.base/step-resume-infcall.exp: step
FAIL: gdb.base/step-test.exp: step into
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-ts
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tll
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tll
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tf
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-td
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-td
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 1 structs-tld
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 1 structs-tld
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-ti-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-ti-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tl-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tl-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tf-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tf-tc
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tc-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tc-ti
FAIL: gdb.base/structs.exp: advance to fun<n> for return; return 2 structs-tc-tl
FAIL: gdb.base/structs.exp: advance to fun<n> for finish; return 2 structs-tc-tl
FAIL: gdb.base/value-double-free.exp: continue
FAIL: gdb.base/watch-cond-infcall.exp: hw: continue
FAIL: gdb.base/watch-cond-infcall.exp: sw: continue
FAIL: gdb.base/watchpoint.exp: global_ptr next
FAIL: gdb.base/watchpoint.exp: next over ptr init
FAIL: gdb.base/watchpoint.exp: next over buffer set
FAIL: gdb.base/watchpoint.exp: global_ptr_ptr next
FAIL: gdb.base/watchpoint.exp: next over global_ptr_ptr init
FAIL: gdb.base/watchpoint.exp: next over global_ptr_ptr buffer set
FAIL: gdb.base/watchpoint.exp: next over global_ptr_ptr pointer advance
FAIL: gdb.base/watchpoint.exp: no-hw: global_ptr next
FAIL: gdb.base/watchpoint.exp: no-hw: next over ptr init
FAIL: gdb.base/watchpoint.exp: no-hw: next over buffer set
FAIL: gdb.base/watchpoint.exp: no-hw: global_ptr_ptr next
FAIL: gdb.base/watchpoint.exp: no-hw: next over global_ptr_ptr init
FAIL: gdb.base/watchpoint.exp: no-hw: next over global_ptr_ptr buffer set
FAIL: gdb.base/watchpoint.exp: no-hw: next over global_ptr_ptr pointer advance
FAIL: gdb.base/watchpoints.exp: watchpoint ival1 hit, second time
FAIL: gdb.base/watchpoints.exp: Watchpoint ival1 hit count is 2
FAIL: gdb.base/watchpoints.exp: watchpoint hit, second time
FAIL: gdb.base/watchpoints.exp: Watchpoint hit count is 2
FAIL: gdb.base/watchpoints.exp: watchpoint ival1 hit, third time
FAIL: gdb.base/watchpoints.exp: Watchpoint ival1 hit count is 3
FAIL: gdb.base/watchpoints.exp: watchpoint hit, third time
FAIL: gdb.base/watchpoints.exp: Watchpoint hit count is 3
FAIL: gdb.base/watchpoints.exp: watchpoint hit, fourth time
FAIL: gdb.base/watchpoints.exp: Watchpoint hit count is 4
FAIL: gdb.base/watchpoints.exp: watchpoint hit, fifth time
FAIL: gdb.base/watchpoints.exp: Watchpoint hit count is 5
FAIL: gdb.cp/expand-sals.exp: continue to breakpoint: func
FAIL: gdb.cp/expand-sals.exp: continue to breakpoint: next caller func
FAIL: gdb.cp/extern-c.exp: continue to breakpoint: c_func
FAIL: gdb.cp/extern-c.exp: continue to breakpoint: c_funcs_1
FAIL: gdb.cp/extern-c.exp: continue to breakpoint: c_funcs_2
FAIL: gdb.cp/namespace-nested-import.exp: print C::x
FAIL: gdb.linespec/linespec.exp: set breakpoint at lspec.cc instance of NameSpace::overload
FAIL: gdb.linespec/linespec.exp: set breakpoint at specific instance of NameSpace::overload
FAIL: gdb.opt/inline-bt.exp: continue to bar (1)
FAIL: gdb.opt/inline-bt.exp: continue to bar (2)
FAIL: gdb.opt/inline-bt.exp: continue to bar (3)
FAIL: gdb.opt/inline-cmds.exp: continue to bar (1)
FAIL: gdb.opt/inline-cmds.exp: continue to bar (2)
FAIL: gdb.opt/inline-cmds.exp: continue to marker
FAIL: gdb.opt/inline-cmds.exp: step into finish marker
FAIL: gdb.opt/inline-cmds.exp: enter inlined_fn from noinline
FAIL: gdb.opt/inline-cmds.exp: backtrace at inlined_fn from noinline
FAIL: gdb.opt/inline-cmds.exp: inlined_fn from noinline inlined
FAIL: gdb.opt/inline-cmds.exp: up to noinline
FAIL: gdb.opt/inline-cmds.exp: noinline from outer_inline1 not inlined
FAIL: gdb.opt/inline-cmds.exp: up to outer_inline1
FAIL: gdb.opt/inline-cmds.exp: outer_inline1 inlined
FAIL: gdb.opt/inline-cmds.exp: up to outer_inline2
FAIL: gdb.opt/inline-cmds.exp: outer_inline2 inlined
FAIL: gdb.opt/inline-cmds.exp: up from outer_inline2
FAIL: gdb.opt/inline-cmds.exp: main not inlined
FAIL: gdb.opt/inline-locals.exp: continue to bar (1)
FAIL: gdb.opt/inline-locals.exp: continue to bar (2)
FAIL: gdb.opt/inline-locals.exp: continue to bar (3)

Your patch did not introduce any regressions.

So my testing showed that my patch fixed more failures, but introduced
regressions. I find it conceivable, however, that my patch might not
fare as well on some other target. (That's what your testing
demonstrates, right?)

Is there a different simulator multilib that I should use for testing?

> Looking at the first one:
>
> (gdb) PASS: gdb.base/store.exp: var doublest l; print incremented l, expecting 2
> tbreak add_charest
> Temporary breakpoint 10 at 0x400720: file /scratch/tschwing/FM_sh-linux-gnu/src/gdb-mainline/gdb/testsuite/gdb.base/store.c, line 14.
> (gdb) PASS: gdb.base/store.exp: tbreak add_charest
> continue
> Continuing.
>
> Temporary breakpoint 10, add_charest (u=-1 '\377', v=32 ' ') at /scratch/tschwing/FM_sh-linux-gnu/src/gdb-mainline/gdb/testsuite/gdb.base/store.c:14
> 14 {
> (gdb) FAIL: gdb.base/store.exp: continue to add_charest
>
> gdb.base/store.c:
>
> 10 typedef signed char charest;
> 11
> 12 charest
> 13 add_charest (register charest u, register charest v)
> 14 {
> 15 return u + v;
> 16 }
>
> So the ``tbreak add_charest'' chose line 14 instead of 15.

I took a look at this regression. add_charest is a leaf function.

0x1154 <add_charest>: mov r4,r2
0x1156 <add_charest+2>: mov r5,r1
0x1158 <add_charest+4>: exts.b r2,r2
0x115a <add_charest+6>: exts.b r1,r1
0x115c <add_charest+8>: extu.b r2,r2
0x115e <add_charest+10>: extu.b r1,r1
0x1160 <add_charest+12>: add r2,r1
0x1162 <add_charest+14>: extu.b r1,r1
0x1164 <add_charest+16>: exts.b r1,r1
0x1166 <add_charest+18>: mov r1,r0
0x1168 <add_charest+20>: rts
0x116a <add_charest+22>: nop

I asked it about line 14 too...

(gdb) info line *0x1154
Line 14 of "/ironwood1/sourceware-sh/sh-elf/../src/gdb/testsuite/gdb.base/store.c" starts at address 0x1154 <add_charest> and ends at 0x115c <add_charest+8>.

So, according to that, the prologue consists of "mov r4,r2", "mov r5,r1",
"exts.b r2,r2", "exts.b r1,r1". These certainly have nothing to do with
setting up a frame. I think it will be hard for the prologue analyzer to
distinguish these from the body instructions. That's always a problem
with prologue analyzers.

I'll have to think about it some more to see if there's a way around
this. E.g. maybe we can tweak the test at the end of sh_skip_prologue
to give us better results.

I'll try to answer your questions about my patch, though it's been a
while since I wrote it. But perhaps this exercise will help to
refresh my memory...

> > Index: sh-tdep.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/sh-tdep.c,v
> > retrieving revision 1.236
> > diff -u -p -r1.236 sh-tdep.c
> > --- sh-tdep.c 28 Jan 2012 18:08:20 -0000 1.236
> > +++ sh-tdep.c 15 Feb 2012 23:55:14 -0000
> > @@ -518,39 +518,43 @@ sh_breakpoint_from_pc (struct gdbarch *g
> >
> > static CORE_ADDR
> > sh_analyze_prologue (struct gdbarch *gdbarch,
> > - CORE_ADDR pc, CORE_ADDR current_pc,
> > + CORE_ADDR pc, CORE_ADDR limit_pc,
> > struct sh_frame_cache *cache, ULONGEST fpscr)
> > {
> > enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
> > ULONGEST inst;
> > - CORE_ADDR opc;
> > + CORE_ADDR after_last_frame_setup_insn = pc;
>
> Save the original pc instead of having the caller do that.

The goal here is to wind up with after_last_frame_setup_insn set the
instruction immediately after the last discernable prologue
instruction. These will be things like manipulation of SP, FP, and
instructions which store callee saved registers to the stack.

We've used this method with some success in other architecture ports.
I had hoped that the variable name was self documenting. ;)

> > + CORE_ADDR next_pc;
> > int offset;
> > int sav_offset = 0;
> > int r3_val = 0;
> > int reg, sav_reg = -1;
> >
> > - if (pc >= current_pc)
> > - return current_pc;
> > -
> > cache->uses_fp = 0;
>
> That sets cache->uses_fp to false even in case that the limit_pc (was:
> current_pc) was already reached.

True. But I don't believe that sh_analyze_prologue is ever called
in an instance where it will have a useful value ahead of time. It
needs to be initialized.

> > - for (opc = pc + (2 * 28); pc < opc; pc += 2)
> > +
> > + for (;pc < limit_pc; pc = next_pc)
>
> The limit of 28 instructions is no longer checked here, but is now the
> caller's responsibility. (Are all callers doing the right thing?)

For sh_skip_prologue(), we limit the scan to the end of the function
in question. For sh_frame_cache(), the scan is limited to the current
pc.

Note too that the scan will be terminated when a call (JSR)
instruction is found.

> > @@ -681,7 +692,10 @@ sh_analyze_prologue (struct gdbarch *gdb
> > so, note that before returning the current pc. */
> > inst = read_memory_integer (pc + 2, 2, byte_order);
> > if (IS_MOV_SP_FP (inst))
> > - cache->uses_fp = 1;
> > + {
> > + cache->uses_fp = 1;
> > + after_last_frame_setup_insn = pc;
> > + }
>
> Shouldn't this perhaps be pc + 2?

This is the JSR case. If we set it to be pc+2, we'll be past the JSR
which definitely isn't part of the prologue. Yet the instruction in
the delay slot is part of the prologue.

I have a vague recollection of trying it with

after_last_frame_setup_insn = nextpc;

and getting bad results.

I should have put a comment on that one since it differs from the
norm.

[...]
> > static CORE_ADDR
> > sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
> > {
> > - CORE_ADDR pc;
> > + CORE_ADDR pc, sal_end, func_addr, func_end;
> > struct sh_frame_cache cache;
> > + const char *name;
> >
> > - /* See if we can determine the end of the prologue via the symbol table.
> > - If so, then return either PC, or the PC after the prologue, whichever
> > - is greater. */
> > - pc = after_prologue (start_pc);
> > -
> > - /* If after_prologue returned a useful address, then use it. Else
> > - fall back on the instruction skipping code. */
> > - if (pc)
> > - return max (pc, start_pc);
> > + /* Try to find the extent of the function that contains PC. */
> > + if (!find_pc_partial_function (start_pc, &name, &func_addr, &func_end))
> > + return start_pc;
>
> Now start_pc is directly returned if find_pc_partial_function fails,
> without invoking sh_analyze_prologue. Is that right?

I may be wrong, but I don't think we can do a useful prologue analysis
unless we start at the beginning of the function. That said, it seems
likely that start_pc is the start of the function in this instance.

> > cache.sp_offset = -4;
> > - pc = sh_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache, 0);
> > - if (!cache.uses_fp)
> > - return start_pc;
> > + pc = sh_analyze_prologue (gdbarch, func_addr, func_end, &cache, 0);
> >
> > - return pc;
> > + sal_end = skip_prologue_using_sal (gdbarch, start_pc);
>
> I had func_addr here, instead of start_pc.

I like your way better. I think that start_pc == func_addr, but I'm
not entirely certain that this is true.

Kevin