diff --git a/.gitattributes b/.gitattributes index 48783659e4..351bfc714e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -164,6 +164,7 @@ compiler/cstreams.pas svneol=native#text/plain compiler/cutils.pas svneol=native#text/plain compiler/cwindirs.pp svneol=native#text/plain compiler/dbgbase.pas svneol=native#text/plain +compiler/dbgcodeview.pas svneol=native#text/plain compiler/dbgdwarf.pas svneol=native#text/plain compiler/dbgstabs.pas svneol=native#text/plain compiler/dbgstabx.pas svneol=native#text/plain diff --git a/compiler/dbgcodeview.pas b/compiler/dbgcodeview.pas new file mode 100644 index 0000000000..54a96f364b --- /dev/null +++ b/compiler/dbgcodeview.pas @@ -0,0 +1,219 @@ +{ + Copyright (c) 2018 by Nikolay Nikolov + + This units contains support for Microsoft CodeView debug info generation + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +{ documentation for the format, available on the internet: + + earlier versions: + http://pagesperso-orange.fr/pierrelib/exec_formats/MS_Symbol_Type_v1.0.pdf + http://ftp.openwatcom.org/devel/docs/CodeView.pdf + + modern versions: + https://llvm.org/docs/PDB/index.html + https://llvm.org/devmtg/2016-11/Slides/Kleckner-CodeViewInLLVM.pdf +} + +unit dbgcodeview; + +{$i fpcdefs.inc} + +interface + + uses + aasmdata, + dbgbase; + + type + TSymbolIndex = ( + S_COMPILE = $0001, { Compile flags symbol } + S_REGISTER = $0002, { Register variable } + S_CONSTANT = $0003, { Constant symbol } + S_UDT = $0004, { User-defined Type } + S_SSEARCH = $0005, { Start search } + S_END = $0006, { End block, procedure, with, or thunk } + S_SKIP = $0007, { Skip - Reserve symbol space } + S_CVRESERVE = $0008, { Reserved for internal use by the Microsoft debugger } + S_OBJNAME = $0009, { Specify name of object file } + S_ENDARG = $000a, { Specify end of arguments in function symbols } + S_COBOLUDT = $000b, { Microfocus COBOL user-defined type } + S_MANYREG = $000c, { Many register symbol } + S_RETURN = $000d, { Function return description } + S_ENTRYTHIS = $000e, { Description of this pointer at entry } + S_BPREL16 = $0100, { BP relative 16:16 } + S_LDATA16 = $0101, { Local data 16:16 } + S_GDATA16 = $0102, { Global data 16:16 } + S_PUB16 = $0103, { Public symbol 16:16 } + S_LPROC16 = $0104, { Local procedure start 16:16 } + S_GPROC16 = $0105, { Global procedure start 16:16 } + S_THUNK16 = $0106, { Thunk start 16:16 } + S_BLOCK16 = $0107, { Block start 16:16 } + S_WITH16 = $0108, { With start 16:16 } + S_LABEL16 = $0109, { Code label 16:16 } + S_CEXMODEL16 = $010a, { Change execution model 16:16 } + S_VFTPATH16 = $010b, { Virtual function table path descriptor 16:16 } + S_REGREL16 = $010c, { Specify 16:16 offset relative to arbitrary register } + S_BPREL32 = $0200, { BP relative 16:32 } + S_LDATA32 = $0201, { Local data 16:32 } + S_GDATA32 = $0202, { Global data 16:32 } + S_PUB32 = $0203, { Public symbol 16:32 } + S_LPROC32 = $0204, { Local procedure start 16:32 } + S_GPROC32 = $0205, { Global procedure start 16:32 } + S_THUNK32 = $0206, { Thunk start 16:32 } + S_BLOCK32 = $0207, { Block start 16:32 } + S_VFTPATH32 = $020b, { Virtual function table path descriptor 16:32 } + S_REGREL32 = $020c, { 16:32 offset relative to arbitrary register } + S_LTHREAD32 = $020d, { Local Thread Storage data } + S_GTHREAD32 = $020e, { Global Thread Storage data } + S_LPROCMIPS = $0300, { Local procedure start MIPS } + S_GPROCMIPS = $0301, { Global procedure start MIPS } + S_PROCREF = $0400, { Reference to a procedure } + S_DATAREF = $0401, { Reference to data } + S_ALIGN = $0402 { Page align symbols } + ); + TLeafIndex=( + LF_MODIFIER = $0001, { Type Modifier (const, volatile, unaligned) } + LF_POINTER = $0002, { Pointer } + LF_ARRAY = $0003, { Simple Array } + LF_CLASS = $0004, { Class (C++ class declaration) } + LF_STRUCTURE = $0005, { Structure (C and C++ struct declaration) } + LF_UNION = $0006, { Union } + LF_ENUM = $0007, { Enumeration } + LF_PROCEDURE = $0008, { Procedure } + LF_MFUNCTION = $0009, { Member Function } + LF_VTSHAPE = $000a, { Virtual Function Table Shape } + LF_COBOL0 = $000b, { reserved for Microfocus COBOL } + LF_COBOL1 = $000c, { reserved for Microfocus COBOL } + LF_BARRAY = $000d, { Basic Array } + LF_LABEL = $000e, { Label } + LF_NULL = $000f, { Null } + LF_NOTTRAN = $0010, { Not Translated } + LF_DIMARRAY = $0011, { Multiply Dimensioned Array } + LF_VFTPATH = $0012, { Path to Virtual Function Table } + LF_PRECOMP = $0013, { Reference Precompiled Types } + LF_ENDPRECOMP = $0014, { End of Precompiled Types } + LF_OEM = $0015, { OEM Generic Type } + LF_Reserved = $0016, { Reserved } + + LF_PAD0 = $f0, + LF_PAD1 = $f1, + LF_PAD2 = $f2, + LF_PAD3 = $f3, + LF_PAD4 = $f4, + LF_PAD5 = $f5, + LF_PAD6 = $f6, + LF_PAD7 = $f7, + LF_PAD8 = $f8, + LF_PAD9 = $f9, + LF_PAD10 = $fa, + LF_PAD11 = $fb, + LF_PAD12 = $fc, + LF_PAD13 = $fc, + LF_PAD14 = $fe, + LF_PAD15 = $ff, + + LF_SKIP = $0200, { Skip (used by incremental compilers to reserve space for future indexes) } + LF_ARGLIST = $0201, { Argument List } + LF_DEFARG = $0202, { Default Argument } + LF_LIST = $0203, { Arbitrary List } + LF_FIELDLIST = $0204, { Field List } + LF_DERIVED = $0205, { Derived Classes } + LF_BITFIELD = $0206, { Bit Fields } + LF_METHODLIST = $0207, { Method List } + LF_DIMCONU = $0208, { Dimensioned Array with Constant Upper Bound } + LF_DIMCONLU = $0209, { Dimensioned Array with Constant Lower and Upper Bounds } + LF_DIMVARU = $020a, { Dimensioned Array with Variable Upper Bound } + LF_DIMVARLU = $020b, { Dimensioned Array with Variable Lower and Upper Bounds } + LF_REFSYM = $020c, { Referenced Symbol } + + LF_BCLASS = $0400, { Real Base Class } + LF_VBCLASS = $0401, { Direct Virtual Base Class } + LF_IVBCLASS = $0402, { Indirect Virtual Base Class } + LF_ENUMERATE = $0403, { Enumeration Name and Value } + LF_FRIENDFCN = $0404, { Friend Function } + LF_INDEX = $0405, { Index to Another Type Record } + LF_MEMBER = $0406, { Data Member } + LF_STMEMBER = $0407, { Static Data Member } + LF_METHOD = $0408, { Method } + LF_NESTTYPE = $0409, { Nested Type Definition } + LF_VFUNCTAB = $040a, { Virtual Function Table Pointer } + LF_FRIENDCLS = $040b, { Friend Class } + LF_ONEMETHOD = $040c, { One Method } + LF_VFUNCOFF = $040d, { Virtual Function Offset } + + LF_CHAR = $8000, { Signed Char (8-bit value) } + LF_SHORT = $8001, { Signed Short (16-bit signed value) } + LF_USHORT = $8002, { Unsigned Short (16-bit unsigned value) } + LF_LONG = $8003, { Signed Long (32-bit signed value) } + LF_ULONG = $8004, { Unsigned Long (32-bit unsigned value) } + LF_REAL32 = $8005, { 32-bit Float } + LF_REAL64 = $8006, { 64-bit Float } + LF_REAL80 = $8007, { 80-bit Float } + LF_REAL128 = $8008, { 128-bit Float } + LF_QUADWORD = $8009, { Signed Quad Word (64-bit signed value) } + LF_UQUADWORD = $800a, { Unsigned Quad Word (64-bit unsigned value) } + LF_REAL48 = $800b, { 48-bit Float } + LF_COMPLEX32 = $800c, { 32-bit Complex } + LF_COMPLEX64 = $800d, { 64-bit Complex } + LF_COMPLEX80 = $800e, { 80-bit Complex } + LF_COMPLEX128 = $800f, { 128-bit Complex } + LF_VARSTRING = $8010 { Variable-length String } + ); + + const + LF_NUMERIC = LF_CHAR; + + type + + { TDebugInfoCodeView } + + TDebugInfoCodeView = class(TDebugInfo) + public + procedure insertlineinfo(list:TAsmList);override; + end; + +implementation + + uses + systems; + +{**************************************************************************** + TDebugInfoCodeView +****************************************************************************} + + procedure TDebugInfoCodeView.insertlineinfo(list: TAsmList); + begin + { todo: implement } + inherited insertlineinfo(list); + end; + +{**************************************************************************** +****************************************************************************} + const + dbg_codeview_info : tdbginfo = + ( + id : dbg_codeview; + idtxt : 'CODEVIEW'; + ); + +initialization + RegisterDebugInfo(dbg_codeview_info,TDebugInfoCodeView); + +end. + diff --git a/compiler/i8086/cputarg.pas b/compiler/i8086/cputarg.pas index 6c4ca06610..1e6d6f1d16 100644 --- a/compiler/i8086/cputarg.pas +++ b/compiler/i8086/cputarg.pas @@ -85,6 +85,9 @@ implementation {$ifndef NoDbgDwarf} ,dbgdwarf {$endif NoDbgDwarf} + {$ifndef NoDbgCodeView} + ,dbgcodeview + {$endif NoDbgCodeView} ; diff --git a/compiler/msg/errore.msg b/compiler/msg/errore.msg index 7465e5c73f..bcb1802683 100644 --- a/compiler/msg/errore.msg +++ b/compiler/msg/errore.msg @@ -3874,6 +3874,7 @@ J*2Cv_Var/out parameter copy-out checking *g2gc_Generate checks for pointers (experimental, only available on some targets, might generate false positive) *g2gh_Use heaptrace unit (for memory leak/corruption debugging) *g2gl_Use line info unit (show more info with backtraces) +*g2gm_Generate Microsoft CodeView debug information (experimental) *g2go<x>_Set debug information options *g3godwarfsets_ Enable DWARF 'set' type debug information (breaks gdb < 6.5) *g3gostabsabsincludes_ Store absolute/full include file paths in Stabs diff --git a/compiler/msgidx.inc b/compiler/msgidx.inc index 796bac9e30..90e61ebaba 100644 --- a/compiler/msgidx.inc +++ b/compiler/msgidx.inc @@ -1100,7 +1100,7 @@ const option_info=11024; option_help_pages=11025; - MsgTxtSize = 81927; + MsgTxtSize = 81994; MsgIdxMax : array[1..20] of longint=( 28,106,347,126,96,59,142,34,221,67, diff --git a/compiler/msgtxt.inc b/compiler/msgtxt.inc index a1b4ca0d6f..c28a949ec5 100644 --- a/compiler/msgtxt.inc +++ b/compiler/msgtxt.inc @@ -1555,172 +1555,173 @@ const msgtxt : array[0..000341,1..240] of char=( 'me targets, might generate',' false positive)'#010+ '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+ '*g2gl_Use line info unit (show more info with backtraces)'#010+ - '*g2go<x>_Set debug information options'#010+ - '*g3godwarfsets_ Enable DWARF '#039'set'#039' type debug information (bre', + '*g2gm_Generate Microsoft CodeView debug information (experimental)'#010+ + '*g2go<x>_Set debug information opt','ions'#010+ + '*g3godwarfsets_ Enable DWARF '#039'set'#039' type debug information (bre'+ 'aks gdb < 6.5)'#010+ '*g3gostabsabsincludes_ Store absolute/full include file paths in Stabs'+ #010+ '*g3godwarfmethodclassprefix_ Prefix method names in DWARF with class n'+ 'ame'#010+ - '*g3godwarfcpp_ Simulate C++ debug information in DWARF'#010+ - '*g2gp_Preserve case in st','abs symbol names'#010+ + '*g3godwarfcpp','_ Simulate C++ debug information in DWARF'#010+ + '*g2gp_Preserve case in stabs symbol names'#010+ '*g2gs_Generate Stabs debug information'#010+ '*g2gt_Trash local variables (to detect uninitialized uses; multiple '#039+ 't'#039' changes the trashing value)'#010+ - '*g2gv_Generates programs traceable with Valgrind'#010+ - '*g2gw_Generate DWARFv2 debug inform','ation (same as -gw2)'#010+ + '*g2gv_Generates p','rograms traceable with Valgrind'#010+ + '*g2gw_Generate DWARFv2 debug information (same as -gw2)'#010+ '*g2gw2_Generate DWARFv2 debug information'#010+ '*g2gw3_Generate DWARFv3 debug information'#010+ '*g2gw4_Generate DWARFv4 debug information (experimental)'#010+ - '**1i_Information'#010+ + '**1i_Inform','ation'#010+ '**2iD_Return compiler date'#010+ '**2iSO_Return compiler OS'#010+ - '**2iSP_R','eturn compiler host processor'#010+ + '**2iSP_Return compiler host processor'#010+ '**2iTO_Return target OS'#010+ '**2iTP_Return target processor'#010+ '**2iV_Return short compiler version'#010+ '**2iW_Return full compiler version'#010+ - '**2ia_Return list of supported ABI targets'#010+ - '**2ic_Return list of supported CPU instru','ction sets'#010+ + '**2ia_Return list',' of supported ABI targets'#010+ + '**2ic_Return list of supported CPU instruction sets'#010+ '**2if_Return list of supported FPU instruction sets'#010+ '**2ii_Return list of supported inline assembler modes'#010+ '**2io_Return list of supported optimizations'#010+ - '**2ir_Return list of recognized compiler and RTL features'#010+ - '**2it_Return list of',' supported targets'#010+ + '**2ir_Retur','n list of recognized compiler and RTL features'#010+ + '**2it_Return list of supported targets'#010+ '**2iu_Return list of supported microcontroller types'#010+ '**2iw_Return list of supported whole program optimizations'#010+ '**1I<x>_Add <x> to include path'#010+ - '**1k<x>_Pass <x> to the linker'#010+ + '**1k<x>_Pa','ss <x> to the linker'#010+ '**1l_Write logo'#010+ - '**1M<x>_Set language mode to <','x>'#010+ + '**1M<x>_Set language mode to <x>'#010+ '**2Mfpc_Free Pascal dialect (default)'#010+ '**2Mobjfpc_FPC mode with Object Pascal support'#010+ '**2Mdelphi_Delphi 7 compatibility mode'#010+ '**2Mtp_TP/BP 7.0 compatibility mode'#010+ - '**2Mmacpas_Macintosh Pascal dialects compatibility mode'#010+ - '**2Miso_ISO 7185 mode',#010+ + '**2Mmacpas','_Macintosh Pascal dialects compatibility mode'#010+ + '**2Miso_ISO 7185 mode'#010+ '**2Mextendedpascal_ISO 10206 mode'#010+ '**2Mdelphiunicode_Delphi 2009 and later compatibility mode'#010+ '**1n_Do not read the default config files'#010+ - '**1o<x>_Change the name of the executable produced to <x>'#010+ + '**1o<x>_Change the name of the execut','able produced to <x>'#010+ '**1O<x>_Optimizations:'#010+ - '**2O-_Disable optimizat','ions'#010+ + '**2O-_Disable optimizations'#010+ '**2O1_Level 1 optimizations (quick and debugger friendly)'#010+ '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+ - '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+ - '**2O4_Level 4 optimizations (-O3 + optimizations which might have ','un'+ - 'expected side effects)'#010+ + '**2O3_Level 3 optimizations (-O2 + slow optimizations)',#010+ + '**2O4_Level 4 optimizations (-O3 + optimizations which might have unex'+ + 'pected side effects)'#010+ '**2Oa<x>=<y>_Set alignment'#010+ '**2Oo[NO]<x>_Enable or disable optimizations; see fpc -i or fpc -io fo'+ 'r possible values'#010+ - '**2Op<x>_Set target cpu for optimizing; see fpc -i or fpc -ic for poss'+ - 'ible values'#010+ - '**2OW<x>_Generate ','whole-program optimization feedback for optimizati'+ - 'on <x>; see fpc -i or fpc -iw for possible values'#010+ + '**2Op<x>_Set target cpu for optim','izing; see fpc -i or fpc -ic for po'+ + 'ssible values'#010+ + '**2OW<x>_Generate whole-program optimization feedback for optimization'+ + ' <x>; see fpc -i or fpc -iw for possible values'#010+ '**2Ow<x>_Perform whole-program optimization <x>; see fpc -i or fpc -iw'+ - ' for possible values'#010+ + ' fo','r possible values'#010+ '**2Os_Optimize for size rather than speed'#010+ - '**1pg_G','enerate profile code for gprof (defines FPC_PROFILE)'#010+ + '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+ 'F*1P<x>_Target CPU / compiler related options:'#010+ 'F*2PB_Show default compiler binary'#010+ 'F*2PP_Show default target cpu'#010+ - 'F*2P<x>_Set target CPU (aarch64,arm,avr,i386,i8086,jvm,m68k,mips,mipse'+ - 'l,pow','erpc,powerpc64,sparc,x86_64)'#010+ + 'F*2P<x>_','Set target CPU (aarch64,arm,avr,i386,i8086,jvm,m68k,mips,mip'+ + 'sel,powerpc,powerpc64,sparc,x86_64)'#010+ '**1R<x>_Assembler reading style:'#010+ '**2Rdefault_Use default assembler for target'#010+ '3*2Ratt_Read AT&T style assembler'#010+ - '3*2Rintel_Read Intel style assembler'#010+ + '3*2Rintel_Read Intel style assem','bler'#010+ '4*2Ratt_Read AT&T style assembler'#010+ - '4*2Rintel_Read Intel style a','ssembler'#010+ + '4*2Rintel_Read Intel style assembler'#010+ '8*2Ratt_Read AT&T style assembler'#010+ '8*2Rintel_Read Intel style assembler'#010+ '6*2RMOT_Read Motorola style assembler'#010+ '**1S<x>_Syntax options:'#010+ '**2S2_Same as -Mobjfpc'#010+ - '**2Sc_Support operators like C (*=,+=,/= and -=)'#010+ + '**2Sc_Su','pport operators like C (*=,+=,/= and -=)'#010+ '**2Sa_Turn on assertions'#010+ - '*','*2Sd_Same as -Mdelphi'#010+ + '**2Sd_Same as -Mdelphi'#010+ '**2Se<x>_Error options. <x> is a combination of the following:'#010+ '**3*_<n> : Compiler halts after the <n> errors (default is 1)'#010+ - '**3*_w : Compiler also halts after warnings'#010+ + '**3*_w : Compiler also hal','ts after warnings'#010+ '**3*_n : Compiler also halts after notes'#010+ - '**3*_h :',' Compiler also halts after hints'#010+ + '**3*_h : Compiler also halts after hints'#010+ '**2Sf_Enable certain features in compiler and RTL; see fpc -i or fpc -'+ 'ir for possible values)'#010+ - '**2Sg_Enable LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+ - '**2Sh_Use reference counted strings (ansistring by def','ault) instead '+ - 'of shortstrings'#010+ + '**2Sg_Enable LABEL and GOTO (default in -Mtp a','nd -Mdelphi)'#010+ + '**2Sh_Use reference counted strings (ansistring by default) instead of'+ + ' shortstrings'#010+ '**2Si_Turn on inlining of procedures/functions declared as "inline"'#010+ '**2Sj_Allows typed constants to be writeable (default in all modes)'#010+ - '**2Sk_Load fpcylix unit'#010+ + '**2Sk_L','oad fpcylix unit'#010+ '**2SI<x>_Set interface style to <x>'#010+ - '**3SIcom_COM c','ompatible interface (default)'#010+ + '**3SIcom_COM compatible interface (default)'#010+ '**3SIcorba_CORBA compatible interface'#010+ '**2Sm_Support macros like C (global)'#010+ '**2So_Same as -Mtp'#010+ '**2Sr_Transparent file names in ISO mode'#010+ - '**2Ss_Constructor name must be init (destructor must be done)'#010+ - '**2Sv_Support',' vector processing (use CPU vector extensions if availa'+ - 'ble)'#010+ + '**2Ss_Co','nstructor name must be init (destructor must be done)'#010+ + '**2Sv_Support vector processing (use CPU vector extensions if availabl'+ + 'e)'#010+ '**2Sx_Enable exception keywords (default in Delphi/ObjFPC modes)'#010+ - '**2Sy_@<pointer> returns a typed pointer, same as $T+'#010+ + '**2Sy_@<pointer> returns a typed pointer, same a','s $T+'#010+ '**1s_Do not call assembler and linker'#010+ - '**2sh_Generate script t','o link on host'#010+ + '**2sh_Generate script to link on host'#010+ '**2st_Generate script to link on target'#010+ '**2sr_Skip register allocation phase (use with -alr)'#010+ '**1T<x>_Target operating system:'#010+ '3*2Tandroid_Android'#010+ - '3*2Taros_AROS'#010+ + '3*2Taros_ARO','S'#010+ '3*2Tbeos_BeOS'#010+ '3*2Tdarwin_Darwin/Mac OS X'#010+ '3*2Tembedded_Embedded'#010+ - '3*','2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+ + '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+ '3*2Tfreebsd_FreeBSD'#010+ '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+ '3*2Thaiku_Haiku'#010+ - '3*2Tiphonesim_iPhoneSimulator from iOS SDK 3.2+ (older versions: -Tdar'+ - 'win)'#010+ + '3*2Tiphonesim_iPhoneSimulator from iOS SD','K 3.2+ (older versions: -Td'+ + 'arwin)'#010+ '3*2Tlinux_Linux'#010+ - '3*2Tnativent_Nati','ve NT API (experimental)'#010+ + '3*2Tnativent_Native NT API (experimental)'#010+ '3*2Tnetbsd_NetBSD'#010+ '3*2Tnetware_Novell Netware Module (clib)'#010+ '3*2Tnetwlibc_Novell Netware Module (libc)'#010+ '3*2Topenbsd_OpenBSD'#010+ - '3*2Tos2_OS/2 / eComStation'#010+ + '3*2Tos2_OS/2 / eComStation'#010, '3*2Tsymbian_Symbian OS'#010+ '3*2Tsolaris_Solaris'#010+ - '3*2Twatcom_Watcom compat','ible DOS extender'#010+ + '3*2Twatcom_Watcom compatible DOS extender'#010+ '3*2Twdosx_WDOSX DOS extender'#010+ '3*2Twin32_Windows 32 Bit'#010+ '3*2Twince_Windows CE'#010+ '4*2Taros_AROS'#010+ '4*2Tdarwin_Darwin/Mac OS X'#010+ '4*2Tdragonfly_DragonFly BSD'#010+ - '4*2Tembedded_Embedded'#010+ + '4*2Tembedde','d_Embedded'#010+ '4*2Tfreebsd_FreeBSD'#010+ '4*2Tiphonesim_iPhoneSimulator'#010+ - '4*2Tli','nux_Linux'#010+ + '4*2Tlinux_Linux'#010+ '4*2Tnetbsd_NetBSD'#010+ '4*2Topenbsd_OpenBSD'#010+ '4*2Tsolaris_Solaris'#010+ '4*2Twin64_Win64 (64 bit Windows systems)'#010+ '6*2Tamiga_Commodore Amiga'#010+ '6*2Tatari_Atari ST/STe/TT'#010+ - '6*2Tembedded_Embedded'#010+ + '6*2Tembedded','_Embedded'#010+ '6*2Tlinux_Linux'#010+ '6*2Tnetbsd_NetBSD'#010+ '6*2Tmacos_Mac OS'#010+ - '6*2Tpa','lmos_PalmOS'#010+ + '6*2Tpalmos_PalmOS'#010+ '8*2Tembedded_Embedded'#010+ '8*2Tmsdos_MS-DOS (and compatible)'#010+ '8*2Twin16_Windows 16 Bit'#010+ 'A*2Tandroid_Android'#010+ 'A*2Taros_AROS'#010+ 'A*2Tdarwin_Darwin/iPhoneOS/iOS'#010+ - 'A*2Tembedded_Embedded'#010+ + 'A*2Tembedded_Em','bedded'#010+ 'A*2Tgba_Game Boy Advance'#010+ 'A*2Tlinux_Linux'#010+ - 'A*2Tnds_Nintendo DS',#010+ + 'A*2Tnds_Nintendo DS'#010+ 'A*2Tnetbsd_NetBSD'#010+ 'A*2Tpalmos_PalmOS'#010+ 'A*2Tsymbian_Symbian'#010+ @@ -1730,10 +1731,10 @@ const msgtxt : array[0..000341,1..240] of char=( 'J*2Tandroid_Android'#010+ 'J*2Tjava_Java'#010+ 'm*2Tandroid_Android'#010+ - 'm*2Tembedded_Embedded'#010+ + 'm*2','Tembedded_Embedded'#010+ 'm*2Tlinux_Linux'#010+ 'M*2Tembedded_Embedded'#010+ - 'M*2Tlinux_','Linux'#010+ + 'M*2Tlinux_Linux'#010+ 'P*2Taix_AIX'#010+ 'P*2Tamiga_AmigaOS'#010+ 'P*2Tdarwin_Darwin/Mac OS X'#010+ @@ -1742,154 +1743,154 @@ const msgtxt : array[0..000341,1..240] of char=( 'P*2Tmacos_Mac OS (classic)'#010+ 'P*2Tmorphos_MorphOS'#010+ 'P*2Tnetbsd_NetBSD'#010+ - 'P*2Twii_Wii'#010+ + 'P*2Twii','_Wii'#010+ 'p*2Taix_AIX'#010+ 'p*2Tdarwin_Darwin/Mac OS X'#010+ 'p*2Tembedded_Embedded'#010+ - 'p','*2Tlinux_Linux'#010+ + 'p*2Tlinux_Linux'#010+ 'S*2Tlinux_Linux'#010+ 'S*2Tsolaris_Solaris'#010+ 's*2Tlinux_Linux'#010+ 'V*2Tembedded_Embedded'#010+ '**1u<x>_Undefines the symbol <x>'#010+ '**1U_Unit options:'#010+ - '**2Un_Do not check where the unit name matches the file name'#010+ - '**2Ur_Generate release unit files (nev','er automatically recompiled)'#010+ + '**2Un_Do not check where the uni','t name matches the file name'#010+ + '**2Ur_Generate release unit files (never automatically recompiled)'#010+ '**2Us_Compile a system unit'#010+ '**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+ - '**2*_e : Show errors (default) 0 : Show nothing (except errors)'#010+ - '**2*_w : Show warnings u : Show ','unit info'#010+ + '**2*_e : Show errors (default) 0 : Show not','hing (except errors'+ + ')'#010+ + '**2*_w : Show warnings u : Show unit info'#010+ '**2*_n : Show notes t : Show tried/used files'#010+ '**2*_h : Show hints c : Show conditionals'#010+ - '**2*_i : Show general info d : Show debug info'#010+ - '**2*_l : Show linenumbers r : Rhide/GCC ','compatibility mod'+ - 'e'#010+ + '**2*_i : Show general info d : ','Show debug info'#010+ + '**2*_l : Show linenumbers r : Rhide/GCC compatibility mode'#010+ '**2*_s : Show time stamps q : Show message numbers'#010+ '**2*_a : Show everything x : Show info about invoked tools'+ #010+ - '**2*_b : Write file names messages p : Write tree.log with parse tre'+ - 'e'#010+ - '**2*_ with fu','ll path v : Write fpcdebug.txt with'#010+ + '**2*_b : Write file n','ames messages p : Write tree.log with parse t'+ + 'ree'#010+ + '**2*_ with full path v : Write fpcdebug.txt with'#010+ '**2*_z : Write output to stderr lots of debugging info'#010+ '**2*_m<x>,<y> : Do not show messages numbered <x> and <y>'#010+ - 'F*1V<x>_Append '#039'-<x>'#039' to the used compiler binary name (e.g. f'+ - 'or vers','ion)'#010+ + 'F*','1V<x>_Append '#039'-<x>'#039' to the used compiler binary name (e.g.'+ + ' for version)'#010+ '**1W<x>_Target-specific options (targets)'#010+ '3*2WA_Specify native type application (Windows)'#010+ '4*2WA_Specify native type application (Windows)'#010+ - 'A*2WA_Specify native type application (Windows)'#010+ - '3*2Wb_Create a bundle instead of a library (Darwi','n)'#010+ + 'A*2WA_Specify native type appl','ication (Windows)'#010+ + '3*2Wb_Create a bundle instead of a library (Darwin)'#010+ 'P*2Wb_Create a bundle instead of a library (Darwin)'#010+ 'p*2Wb_Create a bundle instead of a library (Darwin)'#010+ 'a*2Wb_Create a bundle instead of a library (Darwin)'#010+ - 'A*2Wb_Create a bundle instead of a library (Darwin)'#010+ - '4*2Wb_Create a bundle instead',' of a library (Darwin)'#010+ + 'A*2Wb_Create a',' bundle instead of a library (Darwin)'#010+ + '4*2Wb_Create a bundle instead of a library (Darwin)'#010+ '3*2WB_Create a relocatable image (Windows, Symbian)'#010+ '3*2WB<x>_Set image base to <x> (Windows, Symbian)'#010+ '4*2WB_Create a relocatable image (Windows)'#010+ - '4*2WB<x>_Set image base to <x> (Windows)'#010+ - 'A*2WB_Create a relocatable imag','e (Windows, Symbian)'#010+ + '4*2WB','<x>_Set image base to <x> (Windows)'#010+ + 'A*2WB_Create a relocatable image (Windows, Symbian)'#010+ 'A*2WB<x>_Set image base to <x> (Windows, Symbian)'#010+ '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+ - '4*2WC_Specify console type application (Windows)'#010+ + '4*2WC_Specify console type application (Wi','ndows)'#010+ 'A*2WC_Specify console type application (Windows)'#010+ - 'P*2WC_Speci','fy console type application (Classic Mac OS)'#010+ + 'P*2WC_Specify console type application (Classic Mac OS)'#010+ '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+ '4*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+ - 'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+ - '3*2We_Use',' external resources (Darwin)'#010+ + 'A*2W','D_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+ + '3*2We_Use external resources (Darwin)'#010+ '4*2We_Use external resources (Darwin)'#010+ 'a*2We_Use external resources (Darwin)'#010+ 'A*2We_Use external resources (Darwin)'#010+ - 'P*2We_Use external resources (Darwin)'#010+ + 'P*2We_Use external resources (','Darwin)'#010+ 'p*2We_Use external resources (Darwin)'#010+ - '3*2WF_Specify full-sc','reen type application (EMX, OS/2)'#010+ + '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+ '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+ '4*2WG_Specify graphic type application (Windows)'#010+ - 'A*2WG_Specify graphic type application (Windows)'#010+ - 'P*2WG_Specify graphic type application (Classic ','Mac OS)'#010+ + 'A*2WG_Specify graphic type app','lication (Windows)'#010+ + 'P*2WG_Specify graphic type application (Classic Mac OS)'#010+ '3*2Wi_Use internal resources (Darwin)'#010+ '4*2Wi_Use internal resources (Darwin)'#010+ 'a*2Wi_Use internal resources (Darwin)'#010+ 'A*2Wi_Use internal resources (Darwin)'#010+ - 'P*2Wi_Use internal resources (Darwin)'#010+ + 'P*2Wi_Use int','ernal resources (Darwin)'#010+ 'p*2Wi_Use internal resources (Darwin)'#010+ - '3*2W','I_Turn on/off the usage of import sections (Windows)'#010+ + '3*2WI_Turn on/off the usage of import sections (Windows)'#010+ '4*2WI_Turn on/off the usage of import sections (Windows)'#010+ 'A*2WI_Turn on/off the usage of import sections (Windows)'#010+ - '8*2Wh_Use huge code for units (ignored for models with CODE in a uniqu'+ - 'e s','egment)'#010+ + '8*2Wh_','Use huge code for units (ignored for models with CODE in a uni'+ + 'que segment)'#010+ '8*2Wm<x>_Set memory model'#010+ '8*3WmTiny_Tiny memory model'#010+ '8*3WmSmall_Small memory model (default)'#010+ '8*3WmMedium_Medium memory model'#010+ '8*3WmCompact_Compact memory model'#010+ - '8*3WmLarge_Large memory model'#010+ + '8*3Wm','Large_Large memory model'#010+ '8*3WmHuge_Huge memory model'#010+ - '3*2WM<x>_Minim','um Mac OS X deployment version: 10.4, 10.5.1, ... (Dar'+ - 'win)'#010+ + '3*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+ + 'n)'#010+ '4*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+ 'n)'#010+ - 'p*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+ - 'n)'#010+ - 'P*2WM<x>_Minimum Mac OS X deploymen','t version: 10.4, 10.5.1, ... (Dar'+ + 'p*2WM<x>_Minimum Mac OS X deployment vers','ion: 10.4, 10.5.1, ... (Dar'+ 'win)'#010+ + 'P*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+ + 'n)'#010+ '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+ - '4*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+ - 'A*2WN_Do not generate relocation code, needed for debugging (W','indows'+ + '4*2WN_Do not generate relocation code, needed for debugging (Wind','ows'+ ')'#010+ + 'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+ 'A*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+ 'le values'#010+ 'm*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+ 'le values'#010+ - 'V*2Wp<x>_Specify the controller type; see fpc -i or fpc -iu for possib'+ - 'le',' values'#010+ + 'V*2Wp','<x>_Specify the controller type; see fpc -i or fpc -iu for poss'+ + 'ible values'#010+ '3*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ... (iphonesim)'#010+ '4*2WP<x>_Minimum iOS deployment version: 8.0, 8.0.2, ... (iphonesim)'#010+ - 'a*2WP<x>_Minimum iOS deployment version: 7.0, 7.1.2, ... (Darwin)'#010+ - 'A*2WP<x>_Minimum iOS deploym','ent version: 3.0, 5.0.1, ... (Darwin)'#010+ + 'a*2WP<x>_Minimum iOS deploy','ment version: 7.0, 7.1.2, ... (Darwin)'#010+ + 'A*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ... (Darwin)'#010+ '3*2WR_Generate relocation code (Windows)'#010+ '4*2WR_Generate relocation code (Windows)'#010+ 'A*2WR_Generate relocation code (Windows)'#010+ - '8*2Wt<x>_Set the target executable format'#010+ - '8*3Wtexe_Create a DOS .EXE file (defa','ult)'#010+ + '8*2Wt<x>_Set',' the target executable format'#010+ + '8*3Wtexe_Create a DOS .EXE file (default)'#010+ '8*3Wtcom_Create a DOS .COM file (requires tiny memory model)'#010+ 'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+ '**2WX_Enable executable stack (Linux)'#010+ - '**1X_Executable options:'#010+ - '**2X9_Generate linkerscript for GNU Binutils ld older ','than version 2'+ - '.19.1 (Linux)'#010+ + '**1X_Executa','ble options:'#010+ + '**2X9_Generate linkerscript for GNU Binutils ld older than version 2.1'+ + '9.1 (Linux)'#010+ '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+ 'ux)'#010+ '**2Xd_Do not search default library path (sometimes required for cross'+ - '-compiling when not using -XR)'#010+ + '-','compiling when not using -XR)'#010+ '**2Xe_Use external linker'#010+ - '**2Xf_Subst','itute pthread library name for linking (BSD)'#010+ + '**2Xf_Substitute pthread library name for linking (BSD)'#010+ '**2Xg_Create debuginfo in a separate file and add a debuglink section '+ 'to executable'#010+ - '**2XD_Try to link units dynamically (defines FPC_LINK_DYNAMIC)'#010+ + '**2XD_Try to link units dynamically (de','fines FPC_LINK_DYNAMIC)'#010+ '**2Xi_Use internal linker'#010+ - '**2XLA_Define lib','rary substitutions for linking'#010+ + '**2XLA_Define library substitutions for linking'#010+ '**2XLO_Define order of library linking'#010+ '**2XLD_Exclude default order of standard libraries'#010+ '**2Xm_Generate link map'#010+ - '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+ - 's '#039'main'#039')'#010+ - '**2Xn_Use target system',' native linker instead of GNU ld (Solaris, AI'+ - 'X)'#010+ + '**2XM<x>_Set the name of the',' '#039'main'#039' program routine (default'+ + ' is '#039'main'#039')'#010+ + '**2Xn_Use target system native linker instead of GNU ld (Solaris, AIX)'+ + #010+ 'F*2Xp<x>_First search for the compiler binary in the directory <x>'#010+ '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+ - '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+ - 'ile',', see the ld manual for more information) (BeOS, Linux)'#010+ + '**','2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross co'+ + 'mpile, see the ld manual for more information) (BeOS, Linux)'#010+ '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+ ', Linux, Mac OS, Solaris)'#010+ - '**2Xs_Strip all symbols from executable'#010+ - '**2XS_Try to link units statically (default, def','ines FPC_LINK_STATIC'+ - ')'#010+ + '**2Xs_Strip all symbo','ls from executable'#010+ + '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+ '**2Xt_Link with static libraries (-static is passed to linker)'#010+ '**2Xv_Generate table for Virtual Entry calls'#010+ - '**2XV_Use VLink as external linker (default on Amiga, MorphOS)'#010+ - '**2XX_Try to smartlink units ','(defines FPC_LINK_SMART)'#010+ + '**2XV_Use VLink as external linker (d','efault on Amiga, MorphOS)'+ + #010+ + '**2XX_Try to smartlink units (defines FPC_LINK_SMART)'#010+ '**1*_'#010+ '**1?_Show this help'#010+ '**1h_Shows this help without waiting' diff --git a/compiler/ogomf.pas b/compiler/ogomf.pas index 3ef968c3cf..9b8d7e3a53 100644 --- a/compiler/ogomf.pas +++ b/compiler/ogomf.pas @@ -96,6 +96,7 @@ interface TOmfObjData = class(TObjData) private + FMainSource: TPathStr; class function CodeSectionName(const aname:string): string; public constructor create(const n:string);override; @@ -106,6 +107,7 @@ interface function createsection(atype:TAsmSectionType;const aname:string='';aorder:TAsmSectionOrder=secorder_default):TObjSection;override; function reffardatasection:TObjSection; procedure writeReloc(Data:TRelocDataInt;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);override; + property MainSource: TPathStr read FMainSource; end; { TOmfObjOutput } @@ -532,6 +534,7 @@ implementation CObjSymbol:=TOmfObjSymbol; CObjSection:=TOmfObjSection; createsectiongroup('DGROUP'); + FMainSource:=current_module.mainsource; end; function TOmfObjData.sectiontype2options(atype: TAsmSectiontype): TObjSectionOptions; @@ -907,6 +910,7 @@ implementation RawRecord: TOmfRawRecord; Header: TOmfRecord_THEADR; Translator_COMENT: TOmfRecord_COMENT; + DebugFormat_COMENT: TOmfRecord_COMENT; LinkPassSeparator_COMENT: TOmfRecord_COMENT; LNamesRec: TOmfRecord_LNAMES; ModEnd: TOmfRecord_MODEND; @@ -926,7 +930,10 @@ implementation { write header record } RawRecord:=TOmfRawRecord.Create; Header:=TOmfRecord_THEADR.Create; - Header.ModuleName:=Data.Name; + if cs_debuginfo in current_settings.moduleswitches then + Header.ModuleName:=TOmfObjData(Data).MainSource + else + Header.ModuleName:=Data.Name; Header.EncodeTo(RawRecord); RawRecord.WriteTo(FWriter); Header.Free; @@ -940,6 +947,16 @@ implementation RawRecord.WriteTo(FWriter); Translator_COMENT.Free; + if target_dbg.id=dbg_codeview then + begin + DebugFormat_COMENT:=TOmfRecord_COMENT.Create; + DebugFormat_COMENT.CommentClass:=CC_NewOmfExtension; + DebugFormat_COMENT.CommentString:=''; + DebugFormat_COMENT.EncodeTo(RawRecord); + RawRecord.WriteTo(FWriter); + DebugFormat_COMENT.Free; + end; + LNames.Clear; LNames.Add(''); { insert an empty string, which has index 1 } FSegments.Clear; diff --git a/compiler/options.pas b/compiler/options.pas index 5c1e2a0fff..1a6af874e9 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -1706,6 +1706,10 @@ begin else include(init_settings.globalswitches,cs_use_lineinfo); end; + 'm' : + begin + paratargetdbg:=dbg_codeview; + end; 'o' : begin if not UpdateDebugStr(copy(more,j+1,length(more)),init_settings.debugswitches) then diff --git a/compiler/systems.inc b/compiler/systems.inc index 3d4d308a65..9da234156e 100644 --- a/compiler/systems.inc +++ b/compiler/systems.inc @@ -295,6 +295,7 @@ tdbg = (dbg_none ,dbg_stabs,dbg_stabx,dbg_dwarf2,dbg_dwarf3,dbg_dwarf4,dbg_jasmin + ,dbg_codeview ); tscripttype = (script_none diff --git a/compiler/systems/t_msdos.pas b/compiler/systems/t_msdos.pas index 10154f84a4..1b9f3f1c7a 100644 --- a/compiler/systems/t_msdos.pas +++ b/compiler/systems/t_msdos.pas @@ -267,6 +267,8 @@ begin if target_dbg.id in [dbg_dwarf2,dbg_dwarf3,dbg_dwarf4] then LinkRes.Add('debug dwarf') + else if target_dbg.id=dbg_codeview then + LinkRes.Add('debug codeview') else if cs_debuginfo in current_settings.moduleswitches then LinkRes.Add('debug watcom all'); diff --git a/compiler/systems/t_win16.pas b/compiler/systems/t_win16.pas index 7a054eeee0..676ba3e625 100644 --- a/compiler/systems/t_win16.pas +++ b/compiler/systems/t_win16.pas @@ -229,7 +229,9 @@ begin LinkRes.Add('option quiet'); if target_dbg.id in [dbg_dwarf2,dbg_dwarf3,dbg_dwarf4] then - LinkRes.Add('debug dwarf'); + LinkRes.Add('debug dwarf') + else if target_dbg.id=dbg_codeview then + LinkRes.Add('debug codeview'); { add objectfiles, start with prt0 always } case current_settings.x86memorymodel of