This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] Fix ppc64 single step over atomic sequence testcase
Hi,
On 06/12/2012 10:28 AM, Luis Gustavo wrote:> On 06/12/2012 10:16 AM, Joel Brobecker wrote:
>>> GDB is supposed to skip eacho sequence (__asm__ block) in response
>>> to a "next", but it may have had its behavior changed from when i
>>> originally wrote this. It seems to take multiple next's to get to a
>>> different __asm__ block now, so it seems to be broken.
>>>
>>> It may be a difference in GCC's debuginfo output or GDB just got
>>> smarter.
>>
>> I might be wrong, but I don't remember us changing anything in this
>> area. "next/step" behavior is really determined by the line info
>> generated by the compiler. If the compiler was changed from not
>> generated a line entry for the __asm__ blocks, and now does, then
>> it'll change GDB's behavior. If next/step behavior testing is
>> important to the testcase, then it would seem to make sense to
>> convert the testcase to using an assembly file instead.
>>
It seems that's pretty much what's happening here. When checking the testcase built using gcc 4.3.4, got the following line number statements:
...
Special opcode 34: advance Address by 8 to 0x100005a8 and Line by 1 to 25
Special opcode 35: advance Address by 8 to 0x100005b0 and Line by 2 to 27
Special opcode 139: advance Address by 36 to 0x100005d4 and Line by 8 to 35
Special opcode 139: advance Address by 36 to 0x100005f8 and Line by 8 to 43
Special opcode 20: advance Address by 4 to 0x100005fc and Line by 1 to 44
and the tests passes with only 2 'next's, while gcc 4.7.0 (from Fedora 17) provides the following:
...
Special opcode 48: advance Address by 12 to 0x10000670 and Line by 1 to 25
Special opcode 67: advance Address by 16 to 0x10000680 and Line by 6 to 31
Special opcode 15: advance Address by 4 to 0x10000684 and Line by -4 to 27
Special opcode 24: advance Address by 4 to 0x10000688 and Line by 5 to 32
Special opcode 14: advance Address by 4 to 0x1000068c and Line by -5 to 27
Advance Line by 12 to 39
Special opcode 89: advance Address by 24 to 0x100006a4 and Line by 0 to 39
Special opcode 15: advance Address by 4 to 0x100006a8 and Line by -4 to 35
Special opcode 24: advance Address by 4 to 0x100006ac and Line by 5 to 40
Special opcode 14: advance Address by 4 to 0x100006b0 and Line by -5 to 35
Special opcode 111: advance Address by 28 to 0x100006cc and Line by 8 to 43
Special opcode 20: advance Address by 4 to 0x100006d0 and Line by 1 to 44
requiring more 'next's to go though the code.
>
> I agree that using an assembly file is both more apropriate and more
> straightforward when it comes to testing these sequences.
>
> Luis
>
>
>
I had the chance to test the patch and rewriting this in assembly does fixes the tests regardless of gcc version. However, the only "issue" I noticed was that it should be run inside the src directory, otherwise it will fail due to the asm .include's:
spawn -ignore SIGHUP gcc ../../../gdb.git/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s -g -lm -o /home/emachado/gdb/build/gdb/testsuite/gdb.arch/ppc64-atomic-inst^M
../../../gdb.git/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s: Assembler messages:^M
../../../gdb.git/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s:1: Error: can't open gdb.asm/common.inc for reading: No such file or directory^M
../../../gdb.git/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s:2: Error: can't open gdb.asm/powerpc64.inc for reading: No such file or directory^M
../../../gdb.git/gdb/testsuite/gdb.arch/ppc64-atomic-inst.s:5: Error: Unrecognized opcode: `gdbasm_declare'^M
Thanks and regards,
--
Edjunior