This is the mail archive of the gdb-patches@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] |
Hi! On SH, gdb.asm/asm-source.exp currently fails to build as follows: Executing on host: sh-linux-gnu-as [...]/gdb/testsuite/gdb.asm/asmsrc1.s -I[...]/gdb/testsuite/gdb.asm -I[...]/gdb.d/gdb.asm -gdwarf2 -o asmsrc1.o (timeout = 3600) [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Assembler messages: [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for _start does not evaluate to a constant [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for main does not evaluate to a constant [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for foo3 does not evaluate to a constant [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for exit does not evaluate to a constant [GDB]/gdb/testsuite/gdb.asm/asmsrc1.s: Error: .size expression for foostatic does not evaluate to a constant assembler exited with status 1 This comes from gdb.asm/sh.inc: 31 comment "subroutine end" 32 .purgem gdbasm_end 33 .macro gdbasm_end name 34 .size \name, .-_foo1 35 .align 1 36 .endm The _foo1 symbol doesn't exist anywhere (and it never has, in gdb.asm's lifetime). This is easily fixed, and makes the tests PASS for sh-elf. (As this code has never been touched since its initial commit in 2003, I wonder for how long this has been broken -- probably ever since? Or what were earlier assembler versions able to make out of that?) gdb/testsuite/ * gdb.asm/sh.inc (gdbasm_end) <.size>: Refer to the function's name. Index: gdb.asm/sh.inc =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/sh.inc,v retrieving revision 1.2 diff -u -p -r1.2 sh.inc --- gdb.asm/sh.inc 7 Mar 2005 21:16:50 -0000 1.2 +++ gdb.asm/sh.inc 22 Mar 2012 17:27:40 -0000 @@ -31,7 +31,7 @@ comment "subroutine end" .purgem gdbasm_end .macro gdbasm_end name - .size \name, .-_foo1 + .size \name, . - \name .align 1 .endm However, that is not enough to make the executable runnable on sh-linux-gnu: it chokes due to the stack pointer setup in gdbasm_startup. There are several ways to address this (see ``diff -u m32r.inc m32r-linux.inc'' for one example); I chose to generalize the code as follows: gdb/testsuite/ * gdb.asm/sh.inc (gdbasm_startup): Only set up the stack pointer if the symbol _stack is defined. Get rid of a hard-coded constant for _stack. Index: gdb.asm/sh.inc =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/sh.inc,v retrieving revision 1.2 diff -u -p -r1.2 sh.inc --- gdb.asm/sh.inc 7 Mar 2005 21:16:50 -0000 1.2 +++ gdb.asm/sh.inc 22 Mar 2012 17:27:40 -0000 @@ -65,13 +65,19 @@ comment "crt0 startup" .macro gdbasm_startup - mov.l .stackaddr,r15 + comment "If there is a _stack symbol, use it for setting up the stack" + comment "pointer. In hosted mode (when there is no _stack symbol)," + comment "the operating system will have initialized it already." + mov.l .stackaddr, r0 + tst r0, r0 + bt .afterstackaddr + mov r0, r15 bra .afterstackaddr nop - nop .align 2 .stackaddr: - .long 196608 ! 0x30000 + .weak _stack + .long _stack .align 1 .afterstackaddr: .endm Now the tests all PASS for both sh-linux-gnu and sh-elf: PASS: gdb.asm/asm-source.exp: f at main PASS: gdb.asm/asm-source.exp: next over macro PASS: gdb.asm/asm-source.exp: step into foo2 PASS: gdb.asm/asm-source.exp: info target PASS: gdb.asm/asm-source.exp: info symbol PASS: gdb.asm/asm-source.exp: list PASS: gdb.asm/asm-source.exp: search PASS: gdb.asm/asm-source.exp: f in foo2 PASS: gdb.asm/asm-source.exp: n in foo2 PASS: gdb.asm/asm-source.exp: bt ALL in foo2 PASS: gdb.asm/asm-source.exp: bt 2 in foo2 PASS: gdb.asm/asm-source.exp: s 2 PASS: gdb.asm/asm-source.exp: n 2 PASS: gdb.asm/asm-source.exp: bt 3 in foo3 PASS: gdb.asm/asm-source.exp: info source asmsrc1.s PASS: gdb.asm/asm-source.exp: finish from foo3 PASS: gdb.asm/asm-source.exp: info source asmsrc2.s PASS: gdb.asm/asm-source.exp: info sources PASS: gdb.asm/asm-source.exp: info line PASS: gdb.asm/asm-source.exp: next over foo3 PASS: gdb.asm/asm-source.exp: return from foo2 PASS: gdb.asm/asm-source.exp: look at global variable PASS: gdb.asm/asm-source.exp: x/i &globalvar PASS: gdb.asm/asm-source.exp: disassem &globalvar, &globalvar+1 PASS: gdb.asm/asm-source.exp: look at static variable PASS: gdb.asm/asm-source.exp: x/i &staticvar PASS: gdb.asm/asm-source.exp: disassem &staticvar, &staticvar+1 PASS: gdb.asm/asm-source.exp: look at static function OK to commit both patches? GrÃÃe, Thomas
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |