diff mbox

testsuite/gdb.dwarf2: Enable dw2-error.exp tests for arm targets

Message ID CANW4E-2JhgU6rNJApL8g_yB1EWWMXKodsbbk9Pwt76e=SKGsMA@mail.gmail.com
State Superseded
Headers show

Commit Message

Omair Javaid July 22, 2013, 3:16 a.m. UTC
dw2-error.exp is not run for arm targets because this test has been
written in x86 assembly language. This patch adds ARM version of
assembly code required to run dw2-error.exp tests on arm targets.
Attached patch is tested on ARMv7 and x86_64 targets.

gdb/testsuite/ChangeLog:

2013-07-22  Omair Javaid  <Omair.Javaid@linaro.org>

        * gdb.dwarf2/dw2-error.S: Adding ARM assembly code.

Comments

Tom Tromey July 22, 2013, 4:06 p.m. UTC | #1
>>>>> "Omair" == Omair Javaid <omair.javaid@linaro.org> writes:

Omair> dw2-error.exp is not run for arm targets because this test has been
Omair> written in x86 assembly language. This patch adds ARM version of
Omair> assembly code required to run dw2-error.exp tests on arm targets.
Omair> Attached patch is tested on ARMv7 and x86_64 targets.


Omair> 2013-07-22  Omair Javaid  <Omair.Javaid@linaro.org>

Omair>         * gdb.dwarf2/dw2-error.S: Adding ARM assembly code.

I think it would be just as easy to change this test to use the DWARF
assembler (which didn't exist when the test was first written).  Then
the test case could work on any arch.

Tom
Omair Javaid Sept. 19, 2013, 3:11 p.m. UTC | #2
Hello Tom,

Thanks for your feedback.

Can you kindly direct me to DWARF assembler and how can I use to write
the above testcase.

Thankks for your help..

--
Omair.

On 22 July 2013 17:06, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Omair" == Omair Javaid <omair.javaid@linaro.org> writes:
>
> Omair> dw2-error.exp is not run for arm targets because this test has been
> Omair> written in x86 assembly language. This patch adds ARM version of
> Omair> assembly code required to run dw2-error.exp tests on arm targets.
> Omair> Attached patch is tested on ARMv7 and x86_64 targets.
>
>
> Omair> 2013-07-22  Omair Javaid  <Omair.Javaid@linaro.org>
>
> Omair>         * gdb.dwarf2/dw2-error.S: Adding ARM assembly code.
>
> I think it would be just as easy to change this test to use the DWARF
> assembler (which didn't exist when the test was first written).  Then
> the test case could work on any arch.
>
> Tom
Tom Tromey Sept. 19, 2013, 6:37 p.m. UTC | #3
>>>>> "Omair" == Omair Javaid <omair.javaid@linaro.org> writes:

Omair> Can you kindly direct me to DWARF assembler and how can I use to write
Omair> the above testcase.

The DWARF assembler is in gdb/testsuite/lib/dwarf.exp.
It has a large comment that explains most of how to use it;
plus a few specific comments next to some exported procs.
Search gdb.dwarf2 for Dwarf::assemble for some examples.

In this case I think the test case is just testing that gdb reacts
properly when the DWARF has an invalid version.  This is simple to do
with the assembler; just pass something unusual to the "cu" proc.

Tom
diff mbox

Patch

Index: gdb/testsuite/gdb.dwarf2/dw2-error.S
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-error.S,v
retrieving revision 1.2
diff -u -p -r1.2 dw2-error.S
--- gdb/testsuite/gdb.dwarf2/dw2-error.S 12 Feb 2013 18:27:29 -0000 1.2
+++ gdb/testsuite/gdb.dwarf2/dw2-error.S 22 Jul 2013 02:57:06 -0000
@@ -18,6 +18,8 @@ 

   */

+#ifndef __arm__
+
  .file "dw2-error.c"
  .text
 .Ltext0:
@@ -158,3 +160,177 @@  main:
  .string "dw2-error.c"
  .ident "GCC: (GNU) 4.6.3 20120306 (Red Hat 4.6.3-2)"
  .section .note.GNU-stack,"",@progbits
+
+#else
+
+ .file "dw2-error.c"
+ .text
+.Ltext0:
+ .cfi_sections .debug_frame
+ .align 2
+ .global main
+ .type main, %function
+main:
+.LFB0:
+ .file 1 "dw2-error.c"
+ @ dw2-error.c:19
+ .loc 1 19 0
+ .cfi_startproc
+ @ args = 0, pretend = 0, frame = 0
+ @ frame_needed = 1, uses_anonymous_args = 0
+ @ link register save eliminated.
+@ BLOCK 2 seq:0
+@ PRED: ENTRY (fallthru)
+ str fp, [sp, #-4]!
+.LCFI0:
+ .cfi_def_cfa_offset 4
+ .cfi_offset 11, -4
+ add fp, sp, #0
+.LCFI1:
+ .cfi_def_cfa_register 11
+ @ dw2-error.c:20
+ .loc 1 20 0
+ mov r3, #23
+ @ dw2-error.c:21
+ .loc 1 21 0
+ mov r0, r3
+@ SUCC: EXIT [100.0%]
+ add sp, fp, #0
+ ldmfd sp!, {fp}
+ bx lr
+ .cfi_endproc
+.LFE0:
+ .size main, .-main
+.Letext0:
+ .section .debug_info,"",%progbits
+.Ldebug_info0:
+ .4byte 0x42 @ Length of Compilation Unit Info
+ .2byte 0x99 @ DWARF version number
+ .4byte .Ldebug_abbrev0 @ Offset Into Abbrev. Section
+ .byte 0x4 @ Pointer Size (in bytes)
+ .uleb128 0x1 @ (DIE (0xb) DW_TAG_compile_unit)
+ .4byte .LASF0 @ DW_AT_producer: "GNU C 4.7.3"
+ .byte 0x1 @ DW_AT_language
+ .4byte .LASF1 @ DW_AT_name: "dw2-error.c"
+ .4byte .LASF2 @ DW_AT_comp_dir: "/tmp"
+ .4byte .Ltext0 @ DW_AT_low_pc
+ .4byte .Letext0 @ DW_AT_high_pc
+ .4byte .Ldebug_line0 @ DW_AT_stmt_list
+ .uleb128 0x2 @ (DIE (0x25) DW_TAG_subprogram)
+ .byte 0x1 @ DW_AT_external
+ .4byte .LASF3 @ DW_AT_name: "main"
+ .byte 0x1 @ DW_AT_decl_file (dw2-error.c)
+ .byte 0x12 @ DW_AT_decl_line
+ .4byte 0x3e @ DW_AT_type
+ .4byte .LFB0 @ DW_AT_low_pc
+ .4byte .LFE0 @ DW_AT_high_pc
+ .4byte .LLST0 @ DW_AT_frame_base
+ .byte 0x1 @ DW_AT_GNU_all_call_sites
+ .uleb128 0x3 @ (DIE (0x3e) DW_TAG_base_type)
+ .byte 0x4 @ DW_AT_byte_size
+ .byte 0x5 @ DW_AT_encoding
+ .ascii "int\0" @ DW_AT_name
+ .byte 0 @ end of children of DIE 0xb
+ .section .debug_abbrev,"",%progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 @ (abbrev code)
+ .uleb128 0x11 @ (TAG: DW_TAG_compile_unit)
+ .byte 0x1 @ DW_children_yes
+ .uleb128 0x25 @ (DW_AT_producer)
+ .uleb128 0xe @ (DW_FORM_strp)
+ .uleb128 0x13 @ (DW_AT_language)
+ .uleb128 0xb @ (DW_FORM_data1)
+ .uleb128 0x3 @ (DW_AT_name)
+ .uleb128 0xe @ (DW_FORM_strp)
+ .uleb128 0x1b @ (DW_AT_comp_dir)
+ .uleb128 0xe @ (DW_FORM_strp)
+ .uleb128 0x11 @ (DW_AT_low_pc)
+ .uleb128 0x1 @ (DW_FORM_addr)
+ .uleb128 0x12 @ (DW_AT_high_pc)
+ .uleb128 0x1 @ (DW_FORM_addr)
+ .uleb128 0x10 @ (DW_AT_stmt_list)
+ .uleb128 0x6 @ (DW_FORM_data4)
+ .byte 0
+ .byte 0
+ .uleb128 0x2 @ (abbrev code)
+ .uleb128 0x2e @ (TAG: DW_TAG_subprogram)
+ .byte 0 @ DW_children_no
+ .uleb128 0x3f @ (DW_AT_external)
+ .uleb128 0xc @ (DW_FORM_flag)
+ .uleb128 0x3 @ (DW_AT_name)
+ .uleb128 0xe @ (DW_FORM_strp)
+ .uleb128 0x3a @ (DW_AT_decl_file)
+ .uleb128 0xb @ (DW_FORM_data1)
+ .uleb128 0x3b @ (DW_AT_decl_line)
+ .uleb128 0xb @ (DW_FORM_data1)
+ .uleb128 0x49 @ (DW_AT_type)
+ .uleb128 0x13 @ (DW_FORM_ref4)
+ .uleb128 0x11 @ (DW_AT_low_pc)
+ .uleb128 0x1 @ (DW_FORM_addr)
+ .uleb128 0x12 @ (DW_AT_high_pc)
+ .uleb128 0x1 @ (DW_FORM_addr)
+ .uleb128 0x40 @ (DW_AT_frame_base)
+ .uleb128 0x6 @ (DW_FORM_data4)
+ .uleb128 0x2117 @ (DW_AT_GNU_all_call_sites)
+ .uleb128 0xc @ (DW_FORM_flag)
+ .byte 0
+ .byte 0
+ .uleb128 0x3 @ (abbrev code)
+ .uleb128 0x24 @ (TAG: DW_TAG_base_type)
+ .byte 0 @ DW_children_no
+ .uleb128 0xb @ (DW_AT_byte_size)
+ .uleb128 0xb @ (DW_FORM_data1)
+ .uleb128 0x3e @ (DW_AT_encoding)
+ .uleb128 0xb @ (DW_FORM_data1)
+ .uleb128 0x3 @ (DW_AT_name)
+ .uleb128 0x8 @ (DW_FORM_string)
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_loc,"",%progbits
+.Ldebug_loc0:
+.LLST0:
+ .4byte .LFB0-.Ltext0 @ Location list begin address (*.LLST0)
+ .4byte .LCFI0-.Ltext0 @ Location list end address (*.LLST0)
+ .2byte 0x2 @ Location expression size
+ .byte 0x7d @ DW_OP_breg13
+ .sleb128 0
+ .4byte .LCFI0-.Ltext0 @ Location list begin address (*.LLST0)
+ .4byte .LCFI1-.Ltext0 @ Location list end address (*.LLST0)
+ .2byte 0x2 @ Location expression size
+ .byte 0x7d @ DW_OP_breg13
+ .sleb128 4
+ .4byte .LCFI1-.Ltext0 @ Location list begin address (*.LLST0)
+ .4byte .LFE0-.Ltext0 @ Location list end address (*.LLST0)
+ .2byte 0x2 @ Location expression size
+ .byte 0x7b @ DW_OP_breg11
+ .sleb128 4
+ .4byte 0 @ Location list terminator begin (*.LLST0)
+ .4byte 0 @ Location list terminator end (*.LLST0)
+ .section .debug_aranges,"",%progbits
+ .4byte 0x1c @ Length of Address Ranges Info
+ .2byte 0x2 @ DWARF Version
+ .4byte .Ldebug_info0 @ Offset of Compilation Unit Info
+ .byte 0x4 @ Size of Address
+ .byte 0 @ Size of Segment Descriptor
+ .2byte 0 @ Pad to 8 byte boundary
+ .2byte 0
+ .4byte .Ltext0 @ Address
+ .4byte .Letext0-.Ltext0 @ Length
+ .4byte 0
+ .4byte 0
+ .section .debug_line,"",%progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",%progbits,1
+.LASF0:
+ .ascii "GNU C 4.7.3\000"
+.LASF2:
+ .ascii "/tmp\000"
+.LASF3:
+ .ascii "main\000"
+.LASF1:
+ .ascii "dw2-error.c\000"
+ .ident "GCC: (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3"
+ .section .note.GNU-stack,"",%progbits
+
+#endif