New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable heap profiling on macOS #2314
base: dev
Are you sure you want to change the base?
Conversation
d508d10
to
42d1314
Compare
@@ -4698,7 +4698,7 @@ sub ParseLibraries { | |||
$offset = HexExtend($3); | |||
$lib = $4; | |||
$lib =~ s|\\|/|g; # turn windows-style paths into unix-style paths | |||
} elsif ($l =~ /^\s*($h)-($h):\s*(\S+\.so(\.\d+)*)/) { | |||
} elsif ($l =~ /^\s*($h)-($h):\s*(.*$)/) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match for library mappings on macOS dump. The library names can have .dylib extension or no extension at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit concerned that the regex is too relaxed. Any idea to tighten the no extension case a bit? It looks space is allowed on macOS.
@@ -1369,7 +1380,7 @@ fi | |||
if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ | |||
-a "x$GCC" = "xyes" ; then | |||
AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"]) | |||
if test "x${enable_prof_libgcc}" = "x1" ; then | |||
if test "x${enable_prof_libgcc}" = "x1" -a "x${je_cv_clang}" != "xyes" ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to link with lgcc for clang.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we still perform the _Unwind_Backtrace
availability test for clang? Or it's for sure present with unwind.h
?
42d1314
to
46455aa
Compare
@@ -4698,7 +4698,7 @@ sub ParseLibraries { | |||
$offset = HexExtend($3); | |||
$lib = $4; | |||
$lib =~ s|\\|/|g; # turn windows-style paths into unix-style paths | |||
} elsif ($l =~ /^\s*($h)-($h):\s*(\S+\.so(\.\d+)*)/) { | |||
} elsif ($l =~ /^\s*($h)-($h):\s*(.*$)/) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit concerned that the regex is too relaxed. Any idea to tighten the no extension case a bit? It looks space is allowed on macOS.
@@ -1369,7 +1380,7 @@ fi | |||
if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \ | |||
-a "x$GCC" = "xyes" ; then | |||
AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"]) | |||
if test "x${enable_prof_libgcc}" = "x1" ; then | |||
if test "x${enable_prof_libgcc}" = "x1" -a "x${je_cv_clang}" != "xyes" ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we still perform the _Unwind_Backtrace
availability test for clang? Or it's for sure present with unwind.h
?
typedef int (prof_dump_open_maps_t)(); | ||
extern prof_dump_open_maps_t *JET_MUTABLE prof_dump_open_maps; | ||
#endif // __APPLE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: /* */
for comments
typedef struct segment_command_64 je_dyld_segment_command; | ||
|
||
#define JE_DYLD_IMAGE_MAGIC MH_MAGIC_64 | ||
#define JE_DYLD_IMAGE_MAGIC_INV MH_CIGAM_64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe _REVERSE
or stick to _CIGAM
? The _INV
feels a bit close to invalid
.
|
||
TEST_BEGIN(test_mdump_maps_error) { | ||
test_skip_if(!config_prof); | ||
test_skip_if(!config_debug); | ||
|
||
prof_dump_open_file_t *open_file_orig = prof_dump_open_file; | ||
prof_dump_write_file_t *write_file_orig = prof_dump_write_file; | ||
#ifndef __APPLE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It looks we can remove this too?
@@ -128,10 +128,12 @@ TEST_BEGIN(test_mdump_output_error) { | |||
} | |||
TEST_END | |||
|
|||
#ifndef __APPLE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: not really necessary?
Enable heap profiling on macOS.
Both prof-libgcc and prof-gcc works with clang on macOS. The library mappings are dumped via dyld API.