This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH,Testsuite] Add .align 2 for labels on Thumb
On Thu, Aug 12, 2010 at 08:34:39AM -0400, Daniel Jacobowitz wrote:
> On Thu, Aug 12, 2010 at 07:49:08PM +0800, Yao Qi wrote:
> > In original test case, breakpoint is set on insn nop, while main
> > branches to insn push, so breakpoint is not hit.
> >
> > 0000000a <func_loopfb_start>:
> > a: bf00 nop
> >
> > 0000000c <func_loopfb>:
> > c: b480 push {r7}
> >
> > I thought this nop is generated for alignment, so I added '.align 2'
> > for label func_loopfb_start to force it to be equal to func_loopfb. I
> > make a mistake here.
> >
> > I don't know why nop is generated on label func_loopfb_start, and once
> > '.align 2' is added, nop is *not* generated, so failures go away by
> > accident.
>
> Can you use func_loopfb instead of func_loopfb_start in the .S file?
> Or, can you define func_loopfb_start as asm ("func_loopfb_start =
> func_loopfb")?
>
> A third option is to address Mark's concern by using ".p2align 4"; I
> believe that is 16-byte alignment on all platforms gas supports, and
> this test probably requires gas in practice already.
Yeah, update my patch by replacing '.align 2' with '.p2align 4'.
Is that OK?
>
> The existing code is not correct, for the reason you've found; the
> compiler typically uses .align or .p2align at the start of a function.
I see, thanks.
--
Yao Qi
CodeSourcery
yao@codesourcery.com
(650) 331-3385 x739
gdb/testsuite/
2010-08-12 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-ref-missing-frame-func.c: Add .p2align 4 for labels
func_nofb_start and func_loopfb_start, so that address of functions
is equal to these labels on Thumb.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
index 5f77883..e6fa680 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame-func.c
@@ -19,6 +19,7 @@ asm (".globl cu_text_start");
asm ("cu_text_start:");
asm (".globl func_nofb_start");
+asm (".p2align 4");
asm ("func_nofb_start:");
void
@@ -31,6 +32,7 @@ asm (".globl func_nofb_end");
asm ("func_nofb_end:");
asm (".globl func_loopfb_start");
+asm (".p2align 4");
asm ("func_loopfb_start:");
void