From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6005 invoked by alias); 1 Oct 2009 09:18:20 -0000 Received: (qmail 5975 invoked by uid 22791); 1 Oct 2009 09:18:16 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp3.ugent.be (HELO smtp3.UGent.be) (157.193.49.127) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Oct 2009 09:18:05 +0000 Received: from localhost (mcheck2.ugent.be [157.193.49.249]) by smtp3.UGent.be (Postfix) with ESMTP id 2893B147A86; Thu, 1 Oct 2009 11:18:02 +0200 (CEST) Received: from smtp3.UGent.be ([157.193.49.127]) by localhost (mcheck2.ugent.be [157.193.43.11]) (amavisd-new, port 10024) with ESMTP id GkyQiej-XYCL; Thu, 1 Oct 2009 11:17:59 +0200 (CEST) Received: from mail.elis.ugent.be (mail.elis.UGent.be [157.193.206.48]) by smtp3.UGent.be (Postfix) with ESMTP id 5A669147A59; Thu, 1 Oct 2009 11:17:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.elis.ugent.be (Postfix) with ESMTP id 19CDA918F1E; Thu, 1 Oct 2009 11:17:58 +0200 (CEST) Received: from mail.elis.ugent.be ([127.0.0.1]) by localhost (mail.elis.ugent.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VTpfHMtHYFLI; Thu, 1 Oct 2009 11:17:54 +0200 (CEST) Received: from bigmac.elis.UGent.be (bigmac.elis.UGent.be [157.193.206.33]) by mail.elis.ugent.be (Postfix) with ESMTP id BFC0A918F1C; Thu, 1 Oct 2009 11:17:54 +0200 (CEST) Cc: Tom Tromey , Mark Kettenis , gdb-patches ml Message-Id: From: Jonas Maebe To: Joel Brobecker In-Reply-To: <20090930162510.GE10338@adacore.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: [patch] Set calling convention of methods Date: Thu, 01 Oct 2009 09:18:00 -0000 References: <7B6EF4DA-76C8-4D9C-8B9F-94153EF1C4E1@elis.ugent.be> <691B0BA8-C606-42FF-A796-76CC9C31556A@elis.ugent.be> <200904222215.n3MMF0p2006994@brahms.sibelius.xs4all.nl> <19C107AA-5271-4C23-A6D2-AFF75BBAC4E4@elis.ugent.be> <5AA3BCA9-1ECF-446E-8B49-3132F0E470FB@elis.ugent.be> <20090930000225.GA10338@adacore.com> <8F3B6095-4766-432D-ABB5-AB4DAA2D5572@elis.ugent.be> <267A47C4-C452-4EC5-B74E-7C5C26AF227E@elis.ugent.be> <20090930162510.GE10338@adacore.com> X-j-chkmail-Enveloppe: 4AC473C6.000/157.193.206.48/mail.elis.UGent.be/mail.elis.ugent.be/ X-j-chkmail-Score: MSGID : 4AC473C6.000 on smtp3.UGent.be : j-chkmail score : . : R=. U=. O=. B=0.000 -> S=0.000 X-j-chkmail-Status: Ham Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-10/txt/msg00004.txt.bz2 Sorry for the delayed reply. I recently moved and don't have Internet=20=20 access yet at home. On 30 Sep 2009, at 18:25, Joel Brobecker wrote: > Thanks for doing that, we really like testcases, so I appreciate > the effort. Since I always insist on tests for new functionality added to our=20=20 compiler, it's only reasonable to hold my own patches to other=20=20 projects to the same standard :) > Overall, this looks OK to me, but Mark seemed interested in reviewing > this patch, so please wait for his comments as well. Ok. Note that my mail client is known to wrap text at 80 columns (and=20=20 adds a space at the end of each wrapped line for detecting this=20=20 operation). This behaviour cannot be disabled afaik, and yes, one=20=20 could certainly consider this to be a bug. At the same time, it=20=20 however also adds '"Format=3D"flowed"; DelSp=3D"yes"' to the Content-Type= =20=20 header, so mail clients on the other side can reconstruct the original=20=20 text (if those clients support these modifiers, which I hope is the=20=20 case). In case this fails, too, I've also placed the new patch for download=20=20 at http://users.elis.ugent.be/~jmaebe/gdb/gdb_borland_fastcall7.patch.txt > Again, I think > that dwarf2.h needs to be approved by binutils - it's probably going > to be routine, but you never know. Given that it was later confirmed that the file does belong to gcc,=20=20 should I resend my patch for dwarf2.h to the gcc patches list? I've=20=20 also added a description of the Borland fastcall calling convention to=20=20 dwarf2.h in the attached patch, as requested by Tom. Note that this=20=20 calling convention is different from GCC's fastcall. >> * gdb.dwarf2/dw2-borland_fastcall.S: New. > > The .S file needs a copyright header. Added. > Would you be able to re-generate > the file with -dA, by any chance. It makes the DWARF data more=20=20 > readable. > Otherwise, no problem, it's already fine as it is. The assembler file was generated by the Free Pascal Compiler, which is=20=20 not gcc-based. It does not have an option to produce DWARF any=20=20 prettier than this... > We do not use gdb_suppress_tests anymore. runto_main already logs > a FAIL if it does not work, so you can simply return -1 for instance. > I don't think the return value makes any difference in our context. Done. Thanks for the feedback, Jonas 2009-10-01 Jonas Maebe elis.ugent.be> Add support for the "Borland fastcall" calling convention. * dwarf2.h: Add DW_CC_GNU_borland_fastcall_i386 constant. * i386-tdep.c: #include dwarf2.h (i386_borland_fastcall_push_dummy_call): New. (i386_push_dummy_generic_call): Renamed i386_push_dummy_call. (i386_push_dummy_call): New dispatch function that calls i386_generic_push_dummy_call or i386_push_dummy_borland_fast_call depending on the calling convention. * gdb.dwarf2/dw2-borland_fastcall.exp: New. * gdb.dwarf2/dw2-borland_fastcall.S: New. diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index b79bcd2..dbfcf31 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -53,6 +53,8 @@ #include "record.h" #include +#include "dwarf2.h" + /* Register names. */ static char *i386_register_names[] =3D @@ -1426,7 +1428,7 @@ i386_frame_this_id (struct frame_info=20=20 *this_frame, void **this_cache, if (cache->base =3D=3D 0) return; - /* See the end of i386_push_dummy_call. */ + /* See the end of i386_generic_push_dummy_call. */ (*this_id) =3D frame_id_build (cache->base + 8, cache->pc); } @@ -1620,7 +1622,7 @@ i386_sigtramp_frame_this_id (struct frame_info=20=20 *this_frame, void **this_cache, struct i386_frame_cache *cache =3D i386_sigtramp_frame_cache (this_frame, this_cache); - /* See the end of i386_push_dummy_call. */ + /* See the end of i386_generic_push_dummy_call. */ (*this_id) =3D frame_id_build (cache->base + 8, get_frame_pc=20=20 (this_frame)); } @@ -1697,7 +1699,7 @@ i386_dummy_id (struct gdbarch *gdbarch, struct=20=20 frame_info *this_frame) fp =3D get_frame_register_unsigned (this_frame, I386_EBP_REGNUM); - /* See the end of i386_push_dummy_call. */ + /* See the end of i386_generic_push_dummy_call. */ return frame_id_build (fp + 8, get_frame_pc (this_frame)); } =0C @@ -1765,10 +1767,10 @@ i386_16_byte_align_p (struct type *type) } static CORE_ADDR -i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - struct regcache *regcache, CORE_ADDR bp_addr, int nargs, - struct value **args, CORE_ADDR sp, int struct_return, - CORE_ADDR struct_addr) +i386_generic_push_dummy_call (struct gdbarch *gdbarch, struct value=20=20 *function, + struct regcache *regcache, CORE_ADDR bp_addr, + int nargs, struct value **args, CORE_ADDR sp, + int struct_return, CORE_ADDR struct_addr) { enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); gdb_byte buf[4]; @@ -1861,6 +1863,144 @@ i386_push_dummy_call (struct gdbarch *gdbarch,=20=20 struct value *function, return sp + 8; } +/* Borland fastcall: register parameters are passed from left to=20=20 right, then + stack parameters also from left to right. The first three=20=20 unstructured + parameters <=3D 32 bits are passed in %eax, %edx and %ecx. The=20=20 others are + passed on the stack. Furthermore, in case of a struct return by=20=20 reference, + the address of this struct is passed as the first (register)=20=20=20 parameter. */ +static CORE_ADDR +i386_borland_fastcall_push_dummy_call (struct gdbarch *gdbarch, + struct value *function, + struct regcache *regcache, + CORE_ADDR bp_addr, int nargs, + struct value **args, CORE_ADDR sp, + int struct_return, CORE_ADDR struct_addr) +{ + static const int para_regs[3] =3D { I386_EAX_REGNUM, I386_EDX_REGNUM, + I386_ECX_REGNUM }; + + enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); + gdb_byte buf[4]; + int reg_paras[3] =3D { -1, -1, -1 }; + int i, j; + int write_pass; + int para_regnum =3D 0; + + /* First assign the register parameters (left to right). */ + if (struct_return) + { + store_unsigned_integer (buf, 4, byte_order, struct_addr); + regcache_cooked_write (regcache, para_regs[para_regnum], + buf); + /* Use the otherwise invalid "nargs" argument index to denote the + function result. */ + reg_paras[para_regnum] =3D nargs; + para_regnum++; + } + + for (i =3D 0; i < nargs && para_regnum < 3; i++) + { + struct type *type =3D check_typedef (value_enclosing_type=20=20 (args[i])); + int len =3D TYPE_LENGTH (type); + + if (len <=3D 4 + && TYPE_CODE (type) !=3D TYPE_CODE_ARRAY + && TYPE_CODE (type) !=3D TYPE_CODE_STRUCT + && TYPE_CODE (type) !=3D TYPE_CODE_FLT) + { + regcache_cooked_write (regcache, para_regs[para_regnum], + value_contents_all (args[i])); + reg_paras[para_regnum] =3D i; + para_regnum++; + } + } + + /* Now process the stack parameters from left to right. */ + for (write_pass =3D 0; write_pass < 2; write_pass++) + { + int args_space =3D 0; + int have_16_byte_aligned_arg =3D 0; + + for (i =3D nargs - 1; i >=3D 0; i--) + { + struct type *type =3D check_typedef (value_enclosing_type (args[i])); + int len =3D TYPE_LENGTH (type); + int processed =3D 0; + + /* Skip parameters already assigned to registers. */ + for (j =3D 0; j < para_regnum; j++) + if (reg_paras[j] =3D=3D i) + { + processed =3D 1; + break; + } + if (processed) + continue; + + if (i386_16_byte_align_p (value_enclosing_type (args[i]))) + { + args_space =3D align_up (args_space, 16); + have_16_byte_aligned_arg =3D 1; + } + if (write_pass) + { + write_memory (sp + args_space, + value_contents_all (args[i]), len); + } + args_space +=3D align_up (len, 4); + } + + if (!write_pass) + { + /* Early exit if nothing to do. */ + if (!args_space) + break; + if (have_16_byte_aligned_arg) + args_space =3D align_up (args_space, 16); + sp -=3D args_space; + } + } + + /* Store return address. */ + sp -=3D 4; + store_unsigned_integer (buf, 4, byte_order, bp_addr); + write_memory (sp, buf, 4); + + /* Finally, update the stack pointer... */ + store_unsigned_integer (buf, 4, byte_order, sp); + regcache_cooked_write (regcache, I386_ESP_REGNUM, buf); + + /* ...and fake a frame pointer. */ + regcache_cooked_write (regcache, I386_EBP_REGNUM, buf); + + /* See the end of i386_generic_push_dummy_call. */ + return sp + 8; +} + +static CORE_ADDR +i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + struct regcache *regcache, CORE_ADDR bp_addr, int nargs, + struct value **args, CORE_ADDR sp, int struct_return, + CORE_ADDR struct_addr) +{ + struct type *type =3D check_typedef (value_type (function)); + + /* Look up the target type in case of a function/method pointer. */ + while (type && can_dereference (type)) + type =3D TYPE_TARGET_TYPE (type); + + /* Check calling convention. */ + if (type + && TYPE_CALLING_CONVENTION (type) =3D=3D=20=20 DW_CC_GNU_borland_fastcall_i386) + return i386_borland_fastcall_push_dummy_call (gdbarch, function,=20=20 regcache, + bp_addr, nargs, args, sp, + struct_return, struct_addr); + else + return i386_generic_push_dummy_call (gdbarch, function, regcache,=20=20 bp_addr, + nargs, args, sp, struct_return, + struct_addr); +} + /* These registers are used for returning integers (and on some targets also for returning `struct' and `union' values when their size and alignment match an integer type). */ diff --git a/include/dwarf2.h b/include/dwarf2.h index 385ab22..7209a99 100644 --- a/include/dwarf2.h +++ b/include/dwarf2.h @@ -721,7 +721,14 @@ enum dwarf_calling_convention DW_CC_lo_user =3D 0x40, DW_CC_hi_user =3D 0xff, - DW_CC_GNU_renesas_sh =3D 0x40 + DW_CC_GNU_renesas_sh =3D 0x40, + /* Borland fastcall: register parameters are passed from left to=20=20 right, + then stack parameters also from left to right. The first three + unstructured parameters <=3D 32 bits are passed in %eax, %edx=20=20 and %ecx. + The others are passed on the stack. Furthermore, in case of a=20=20 struct + return by reference, the address of this struct is passed as=20=20 the first + (register) parameter. */ + DW_CC_GNU_borland_fastcall_i386 =3D 0x41 }; /* Inline attribute. */ diff --git a/gdb/testsuite/gdb.dwarf2/dw2-borland_fastcall.S b/gdb/=20 testsuite/gdb.dwarf2/dw2-borland_fastcall.S new file mode 100644 index 0000000..ba88d14 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw2-borland_fastcall.S @@ -0,0 +1,962 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2009 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Test Borland fastcall calling convention. */ + + .file "tgdbcc.pp" +# Begin asmlist al_begin + +.section .debug_line + .type .Ldebug_linesection0,@object +.Ldebug_linesection0: + .type .Ldebug_line0,@object +.Ldebug_line0: + +.section .debug_abbrev + .type .Ldebug_abbrevsection0,@object +.Ldebug_abbrevsection0: + .type .Ldebug_abbrev0,@object +.Ldebug_abbrev0: + +.section .text +.globl DEBUGSTART_P$PROGRAM + .type DEBUGSTART_P$PROGRAM,@object +DEBUGSTART_P$PROGRAM: +# End asmlist al_begin +# Begin asmlist al_stabs +# End asmlist al_stabs +# Begin asmlist al_procedures + +.section .text + .balign 16,0x90 +.globl P$PROGRAM_FUNC$BYTE$BYTE$BYTE$BYTE$BYTE$BYTE$$TR + .type P$PROGRAM_FUNC$BYTE$BYTE$BYTE$BYTE$BYTE$BYTE$$TR,@function +P$PROGRAM_FUNC$BYTE$BYTE$BYTE$BYTE$BYTE$BYTE$$TR: +.Lc1: +# Temps allocated between ebp-12 and ebp-12 +.Ll1: +# [tgdbcc.pp] +# [10] begin + pushl %ebp +.Lc3: +.Lc4: + movl %esp,%ebp +.Lc5: + subl $12,%esp +# Var a located at ebp-4 +# Var b located at ebp-8 +# Var c located at ebp+20 +# Var d located at ebp+16 +# Var e located at ebp+12 +# Var f located at ebp+8 +# Var $result located at ebp-12 + movl %eax,-12(%ebp) + movb %dl,-4(%ebp) + movb %cl,-8(%ebp) +.Ll2: +# [11] fillchar(result.g,sizeof(result.g),0); + pushl %edi + movl -12(%ebp),%edi + leal 6(%edi),%edi + xorl %eax,%eax + movl $250,%ecx + rep stosl + popl %edi +.Ll3: +# [12] result.a:=3Da; + movl -12(%ebp),%eax + movb -4(%ebp),%dl + movb %dl,(%eax) +.Ll4: +# [13] result.b:=3Db; + movl -12(%ebp),%eax + movb -8(%ebp),%dl + movb %dl,1(%eax) +.Ll5: +# [14] result.c:=3Dc; + movl -12(%ebp),%eax + movb 20(%ebp),%dl + movb %dl,2(%eax) +.Ll6: +# [15] result.d:=3Dd; + movl -12(%ebp),%eax + movb 16(%ebp),%dl + movb %dl,3(%eax) +.Ll7: +# [16] result.e:=3De; + movl -12(%ebp),%eax + movb 12(%ebp),%dl + movb %dl,4(%eax) +.Ll8: +# [17] result.f:=3Df; + movl -12(%ebp),%eax + movb 8(%ebp),%dl + movb %dl,5(%eax) +.Ll9: +# [18] end; + leave + ret $16 +.Lc2: +.Lt2: +.Le0: + .size P$PROGRAM_FUNC$BYTE$BYTE$BYTE$BYTE$BYTE$BYTE$$TR, .Le0 - P=20 $PROGRAM_FUNC$BYTE$BYTE$BYTE$BYTE$BYTE$BYTE$$TR +.Ll10: + +.section .text + .balign 16,0x90 +.globl PASCALMAIN + .type PASCALMAIN,@function +PASCALMAIN: +.globl main + .type main,@function +main: +.Lc6: +# Temps allocated between ebp-1008 and ebp+0 +.Ll11: +# [20] begin + pushl %ebp +.Lc8: +.Lc9: + movl %esp,%ebp +.Lc10: + subl $1008,%esp +.Ll12: +# [21] func(255,254,253,252,251,250); + pushl $253 + pushl $252 + pushl $251 + pushl $250 + leal -1008(%ebp),%eax + movb $254,%cl + movb $255,%dl + call P$PROGRAM_FUNC$BYTE$BYTE$BYTE$BYTE$BYTE$BYTE$$TR +.Ll13: +# [22] end. + xorl %eax, %eax + leave + ret +.Lc7: +.Lt1: +.Le1: + .size main, .Le1 - main +.Ll14: + +.section .fpc + .balign 8 + .ascii "FPC 2.5.1 [2009/09/12] for i386 - Linux" + +.section .debug_frame +.Lc11: + .long .Lc13-.Lc12 +.Lc12: + .long -1 + .byte 1 + .byte 0 + .uleb128 1 + .sleb128 -4 + .byte 8 + .byte 12 + .uleb128 4 + .uleb128 4 + .byte 5 + .uleb128 8 + .uleb128 1 + .balign 4,0 +.Lc13: + .long .Lc15-.Lc14 +.Lc14: + .long .Lc11 + .long .Lc1 + .long .Lc2-.Lc1 + .byte 4 + .long .Lc3-.Lc1 + .byte 14 + .uleb128 8 + .byte 4 + .long .Lc4-.Lc3 + .byte 5 + .uleb128 5 + .uleb128 2 + .byte 4 + .long .Lc5-.Lc4 + .byte 13 + .uleb128 5 + .balign 4,0 +.Lc15: + .long .Lc17-.Lc16 +.Lc16: + .long .Lc11 + .long .Lc6 + .long .Lc7-.Lc6 + .byte 4 + .long .Lc8-.Lc6 + .byte 14 + .uleb128 8 + .byte 4 + .long .Lc9-.Lc8 + .byte 5 + .uleb128 5 + .uleb128 2 + .byte 4 + .long .Lc10-.Lc9 + .byte 13 + .uleb128 5 + .balign 4,0 +.Lc17: +# End asmlist al_dwarf_frame +# Begin asmlist al_dwarf_info + +.section .debug_info + .type .Ldebug_info0,@object +.Ldebug_info0: + .long .Ledebug_info0-.Lf1 +.Lf1: + .short 2 + .long .Ldebug_abbrev0 + .byte 4 + .uleb128 1 + .ascii "tgdbcc.pp\000" + .ascii "Free Pascal 2.5.1 2009/09/12\000" + .ascii "/home/jmaebe/private/nobackup/fpc/test/\000" + .byte 9 + .byte 3 + .long .Ldebug_line0 + .long DEBUGSTART_P$PROGRAM + .long DEBUGEND_P$PROGRAM +# Syms - Begin Staticsymtable +# Symbol SYSTEM +# Symbol FPINTRES +# Symbol OBJPAS +# Symbol PROGRAM +# Symbol main +# Symbol TR +# Symbol FUNC +# Symbol SI_PRC +# Syms - End Staticsymtable +# Procdef $main; Register; + .uleb128 2 + .ascii "main\000" + .byte 65 + .byte 1 + .long main + .long .Lt1 + .byte 0 +# Procdef func(,Byte,Byte,Byte,Byte,Byte,Byte):; + .uleb128 3 + .ascii "FUNC\000" + .byte 65 + .byte 1 + .long _$PROGRAM$_Ld1 + .long P$PROGRAM_FUNC$BYTE$BYTE$BYTE$BYTE$BYTE$BYTE$$TR + .long .Lt2 +# Symbol A + .uleb128 4 + .ascii "A\000" + .byte 2 + .byte 117 + .sleb128 -4 + .long _$PROGRAM$_Ld3 +# Symbol B + .uleb128 5 + .ascii "B\000" + .byte 2 + .byte 117 + .sleb128 -8 + .long _$PROGRAM$_Ld3 +# Symbol C + .uleb128 6 + .ascii "C\000" + .byte 2 + .byte 117 + .sleb128 20 + .long _$PROGRAM$_Ld3 +# Symbol D + .uleb128 7 + .ascii "D\000" + .byte 2 + .byte 117 + .sleb128 16 + .long _$PROGRAM$_Ld3 +# Symbol E + .uleb128 8 + .ascii "E\000" + .byte 2 + .byte 117 + .sleb128 12 + .long _$PROGRAM$_Ld3 +# Symbol F + .uleb128 9 + .ascii "F\000" + .byte 2 + .byte 117 + .sleb128 8 + .long _$PROGRAM$_Ld3 +# Symbol result + .uleb128 10 + .ascii "result\000" + .byte 2 + .byte 117 + .sleb128 -12 + .long _$PROGRAM$_Ld2 +# Symbol FUNC + .uleb128 11 + .ascii "FUNC\000" + .byte 2 + .byte 117 + .sleb128 -12 + .long _$PROGRAM$_Ld2 +# Symbol RESULT + .uleb128 12 + .ascii "RESULT\000" + .byte 2 + .byte 117 + .sleb128 -12 + .long _$PROGRAM$_Ld2 + .byte 0 +# Defs - Begin unit SYSTEM has index 1 +# Definition Byte + .type _$PROGRAM$_Ld3,@object +_$PROGRAM$_Ld3: + .uleb128 13 + .ascii "BYTE\000" + .long .La1 + .type .La1,@object +.La1: + .uleb128 14 + .ascii "BYTE\000" + .byte 7 + .byte 1 + .type _$PROGRAM$_Ld4,@object +_$PROGRAM$_Ld4: + .uleb128 15 + .long _$PROGRAM$_Ld3 +# Defs - End unit SYSTEM has index 1 +# Defs - Begin unit FPINTRES has index 2 +# Defs - End unit FPINTRES has index 2 +# Defs - Begin unit OBJPAS has index 3 +# Defs - End unit OBJPAS has index 3 +# Defs - Begin unit SI_PRC has index 3 +# Defs - End unit SI_PRC has index 3 +# Defs - Begin Staticsymtable +# Definition tr + .type _$PROGRAM$_Ld1,@object +_$PROGRAM$_Ld1: + .uleb128 16 + .ascii "TR\000" + .long .La2 + .type .La2,@object +.La2: + .uleb128 17 + .ascii "TR\000" + .uleb128 1006 + .uleb128 18 + .ascii "A\000" + .byte 2 + .byte 35 + .uleb128 0 + .long _$PROGRAM$_Ld3 + .uleb128 19 + .ascii "B\000" + .byte 2 + .byte 35 + .uleb128 1 + .long _$PROGRAM$_Ld3 + .uleb128 20 + .ascii "C\000" + .byte 2 + .byte 35 + .uleb128 2 + .long _$PROGRAM$_Ld3 + .uleb128 21 + .ascii "D\000" + .byte 2 + .byte 35 + .uleb128 3 + .long _$PROGRAM$_Ld3 + .uleb128 22 + .ascii "E\000" + .byte 2 + .byte 35 + .uleb128 4 + .long _$PROGRAM$_Ld3 + .uleb128 23 + .ascii "F\000" + .byte 2 + .byte 35 + .uleb128 5 + .long _$PROGRAM$_Ld3 + .uleb128 24 + .ascii "G\000" + .byte 2 + .byte 35 + .uleb128 6 + .long _$PROGRAM$_Ld5 + .byte 0 + .type _$PROGRAM$_Ld2,@object +_$PROGRAM$_Ld2: + .uleb128 25 + .long _$PROGRAM$_Ld1 +# Definition Array[0..999] Of Byte + .type _$PROGRAM$_Ld5,@object +_$PROGRAM$_Ld5: + .uleb128 26 + .uleb128 1000 + .long _$PROGRAM$_Ld3 + .uleb128 27 + .sleb128 0 + .sleb128 999 + .uleb128 1 + .long _$PROGRAM$_Ld7 + .byte 0 + .type _$PROGRAM$_Ld6,@object +_$PROGRAM$_Ld6: + .uleb128 28 + .long _$PROGRAM$_Ld5 +# Defs - End Staticsymtable +# Definition SmallInt + .type _$PROGRAM$_Ld7,@object +_$PROGRAM$_Ld7: + .uleb128 29 + .ascii "SMALLINT\000" + .long .La3 + .type .La3,@object +.La3: + .uleb128 30 + .ascii "SMALLINT\000" + .byte 5 + .byte 2 + .type _$PROGRAM$_Ld8,@object +_$PROGRAM$_Ld8: + .uleb128 31 + .long _$PROGRAM$_Ld7 + .byte 0 + .type .Ledebug_info0,@object +.Ledebug_info0: +# End asmlist al_dwarf_info +# Begin asmlist al_dwarf_abbrev + +.section .debug_abbrev +# Abbrev 1 + .uleb128 1 + .uleb128 17 + .byte 1 + .uleb128 3 + .uleb128 8 + .uleb128 37 + .uleb128 8 + .uleb128 27 + .uleb128 8 + .uleb128 19 + .uleb128 11 + .uleb128 66 + .uleb128 11 + .uleb128 16 + .uleb128 6 + .uleb128 17 + .uleb128 1 + .uleb128 18 + .uleb128 1 + .byte 0 + .byte 0 +# Abbrev 2 + .uleb128 2 + .uleb128 46 + .byte 1 + .uleb128 3 + .uleb128 8 + .uleb128 54 + .uleb128 11 + .uleb128 63 + .uleb128 12 + .uleb128 17 + .uleb128 1 + .uleb128 18 + .uleb128 1 + .byte 0 + .byte 0 +# Abbrev 3 + .uleb128 3 + .uleb128 46 + .byte 1 + .uleb128 3 + .uleb128 8 + .uleb128 54 + .uleb128 11 + .uleb128 63 + .uleb128 12 + .uleb128 73 + .uleb128 16 + .uleb128 17 + .uleb128 1 + .uleb128 18 + .uleb128 1 + .byte 0 + .byte 0 +# Abbrev 4 + .uleb128 4 + .uleb128 5 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 5 + .uleb128 5 + .uleb128 5 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 6 + .uleb128 6 + .uleb128 5 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 7 + .uleb128 7 + .uleb128 5 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 8 + .uleb128 8 + .uleb128 5 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 9 + .uleb128 9 + .uleb128 5 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 10 + .uleb128 10 + .uleb128 52 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 11 + .uleb128 11 + .uleb128 52 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 12 + .uleb128 12 + .uleb128 52 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 2 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 13 + .uleb128 13 + .uleb128 22 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 14 + .uleb128 14 + .uleb128 36 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 62 + .uleb128 11 + .uleb128 11 + .uleb128 11 + .byte 0 + .byte 0 +# Abbrev 15 + .uleb128 15 + .uleb128 16 + .byte 0 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 16 + .uleb128 16 + .uleb128 22 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 17 + .uleb128 17 + .uleb128 19 + .byte 1 + .uleb128 3 + .uleb128 8 + .uleb128 11 + .uleb128 15 + .byte 0 + .byte 0 +# Abbrev 18 + .uleb128 18 + .uleb128 13 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 56 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 19 + .uleb128 19 + .uleb128 13 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 56 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 20 + .uleb128 20 + .uleb128 13 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 56 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 21 + .uleb128 21 + .uleb128 13 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 56 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 22 + .uleb128 22 + .uleb128 13 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 56 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 23 + .uleb128 23 + .uleb128 13 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 56 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 24 + .uleb128 24 + .uleb128 13 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 56 + .uleb128 10 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 25 + .uleb128 25 + .uleb128 16 + .byte 0 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 26 + .uleb128 26 + .uleb128 1 + .byte 1 + .uleb128 11 + .uleb128 15 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 27 + .uleb128 27 + .uleb128 33 + .byte 0 + .uleb128 34 + .uleb128 13 + .uleb128 47 + .uleb128 13 + .uleb128 81 + .uleb128 15 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 28 + .uleb128 28 + .uleb128 16 + .byte 0 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 29 + .uleb128 29 + .uleb128 22 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 +# Abbrev 30 + .uleb128 30 + .uleb128 36 + .byte 0 + .uleb128 3 + .uleb128 8 + .uleb128 62 + .uleb128 11 + .uleb128 11 + .uleb128 11 + .byte 0 + .byte 0 +# Abbrev 31 + .uleb128 31 + .uleb128 16 + .byte 0 + .uleb128 73 + .uleb128 16 + .byte 0 + .byte 0 + .byte 0 +# End asmlist al_dwarf_abbrev +# Begin asmlist al_dwarf_line + +.section .debug_line +# =3D=3D=3D header start =3D=3D=3D + .long .Ledebug_line0-.Lf2 +.Lf2: + .short 2 + .long .Lehdebug_line0-.Lf3 +.Lf3: + .byte 1 + .byte 1 + .byte 1 + .byte 255 + .byte 13 + .byte 0 + .byte 1 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .byte 0 + .byte 0 + .byte 1 + .byte 0 + .byte 0 + .byte 1 +# include_directories + .byte 0 +# file_names + .ascii "tgdbcc.pp\000" + .uleb128 0 + .uleb128 0 + .uleb128 0 + .byte 0 + .type .Lehdebug_line0,@object +.Lehdebug_line0: +# =3D=3D=3D header end =3D=3D=3D +# function: P$PROGRAM_FUNC$BYTE$BYTE$BYTE$BYTE$BYTE$BYTE$$TR +# [10:1] + .byte 0 + .uleb128 5 + .byte 2 + .long .Ll1 + .byte 5 + .uleb128 1 + .byte 21 +# [11:18] + .byte 2 + .uleb128 .Ll2-.Ll1 + .byte 5 + .uleb128 18 + .byte 13 +# [12:9] + .byte 2 + .uleb128 .Ll3-.Ll2 + .byte 5 + .uleb128 9 + .byte 13 +# [13:9] + .byte 2 + .uleb128 .Ll4-.Ll3 + .byte 13 +# [14:9] + .byte 2 + .uleb128 .Ll5-.Ll4 + .byte 13 +# [15:9] + .byte 2 + .uleb128 .Ll6-.Ll5 + .byte 13 +# [16:9] + .byte 2 + .uleb128 .Ll7-.Ll6 + .byte 13 +# [17:9] + .byte 2 + .uleb128 .Ll8-.Ll7 + .byte 13 +# [18:1] + .byte 2 + .uleb128 .Ll9-.Ll8 + .byte 5 + .uleb128 1 + .byte 13 + .byte 0 + .uleb128 5 + .byte 2 + .long .Ll10 + .byte 0 + .byte 1 + .byte 1 +# ################### +# function: PASCALMAIN +# function: main +# [20:1] + .byte 0 + .uleb128 5 + .byte 2 + .long .Ll11 + .byte 5 + .uleb128 1 + .byte 31 +# [21:3] + .byte 2 + .uleb128 .Ll12-.Ll11 + .byte 5 + .uleb128 3 + .byte 13 +# [22:1] + .byte 2 + .uleb128 .Ll13-.Ll12 + .byte 5 + .uleb128 1 + .byte 13 + .byte 0 + .uleb128 5 + .byte 2 + .long .Ll14 + .byte 0 + .byte 1 + .byte 1 +# ################### + .type .Ledebug_line0,@object +.Ledebug_line0: +# End asmlist al_dwarf_line +# Begin asmlist al_picdata +# End asmlist al_picdata +# Begin asmlist al_resourcestrings +# End asmlist al_resourcestrings +# Begin asmlist al_objc_data +# End asmlist al_objc_data +# Begin asmlist al_end + +.section .text +.globl DEBUGEND_P$PROGRAM + .type DEBUGEND_P$PROGRAM,@object +DEBUGEND_P$PROGRAM: +# End asmlist al_end +.section .note.GNU-stack,"",%progbits + diff --git a/gdb/testsuite/gdb.dwarf2/dw2-borland_fastcall.exp b/gdb/=20 testsuite/gdb.dwarf2/dw2-borland_fastcall.exp new file mode 100644 index 0000000..bd30a20 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw2-borland_fastcall.exp @@ -0,0 +1,52 @@ +# Copyright 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test Borland fastcall calling convention + +# This test can only be run on targets which support DWARF-2 and use=20=20 gas. +# For now pick a sampling of likely targets. +if {![istarget *-*-linux*] + && ![istarget *-*-gnu*] + && ![istarget *-*-elf*] + && ![istarget *-*-openbsd*]} { + return 0; + } + +# This test can only be run on x86 targets. +if {![istarget i?86-*]} { + return 0 +} + +set testfile "dw2-borland_fastcall" +set srcfile ${testfile}.S +set binfile ${objdir}/${subdir}/${testfile}.x + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}"=20=20 executable {nodebug}] !=3D "" } { + return -1 +} + + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if { ![runto_main] } { + return -1 +} + + +gdb_test "p FUNC(1,2,3,4,5,6)" \ + "=3D {A =3D 1, B =3D 2, C =3D 3, D =3D 4, E =3D 5, F =3D 6, G =3D #0 <= repeats 999=20=20 times>}"