dmd/compiler/test/runnable/debug_info.d
Mathias LANG eca46c71ad
dmd: Deprecate 'in' parameters on non-extern(D,C++) functions (#14951)
This error was introduced in `-preview=in` in v2.101.0.
In order to make `-preview=in` the default, we add a deprecation
even if `-preview=in` is not used.
2023-03-08 10:57:41 +02:00

50 lines
1.2 KiB
D

// REQUIRED_ARGS: -g
void main()
{
version(OSX) testDebugLineMacOS();
}
version (OSX):
struct mach_header;
struct mach_header_64;
struct section;
struct section_64;
version (D_LP64)
{
alias MachHeader = mach_header_64;
alias Section = section_64;
}
else
{
alias MachHeader = mach_header;
alias Section = section;
}
extern (C)
{
MachHeader* _dyld_get_image_header(uint image_index);
const(section)* getsectbynamefromheader(scope const mach_header* mhp, scope const char* segname, scope const char* sectname);
const(section_64)* getsectbynamefromheader_64(scope const mach_header_64* mhp, scope const char* segname, scope const char* sectname);
}
const(Section)* getSectByNameFromHeader(MachHeader* mhp, in char* segname, in char* sectname)
{
version (D_LP64)
return getsectbynamefromheader_64(mhp, segname, sectname);
else
return getsectbynamefromheader(mhp, segname, sectname);
}
void testDebugLineMacOS()
{
auto header = _dyld_get_image_header(0);
assert(header);
auto section = getSectByNameFromHeader(header, "__DWARF", "__debug_line");
// verify that the __debug_line section is present in the final executable
assert(section);
}