From 3c172ea74c92f5162eb71460426a5517ffd5d567 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 29 Oct 2013 21:48:01 +0100 Subject: [PATCH] build: make systemtap probes work with gyp build The following now works though the used approach is nothing to write home about: $ ./gyp_uv -Duv_use_dtrace=true # $ make -C out BUILDTYPE=Debug # $ cd out/Debug && stap -L 'process("./run-tests").mark("*")' process("./run-tests").mark("tick__start") $arg1:long $arg2:long process("./run-tests").mark("tick__stop") $arg1:long $arg2:long --- uv.gyp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/uv.gyp b/uv.gyp index 74768a09..95095642 100644 --- a/uv.gyp +++ b/uv.gyp @@ -268,13 +268,17 @@ ['library=="shared_library"', { 'defines': [ 'BUILDING_UV_SHARED=1' ] }], + # FIXME(bnoordhuis or tjfontaine) Unify this, it's extremely ugly. ['uv_use_dtrace=="true"', { 'defines': [ 'HAVE_DTRACE=1' ], 'dependencies': [ 'uv_dtrace_header' ], 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ], 'conditions': [ - ['OS != "mac"', { - 'sources': ['src/unix/dtrace.c' ], + [ 'OS not in "mac linux"', { + 'sources': [ 'src/unix/dtrace.c' ], + }], + [ 'OS=="linux"', { + 'sources': [ '<(SHARED_INTERMEDIATE_DIR)/dtrace.o' ] }], ], }], @@ -480,11 +484,12 @@ ], }, + # FIXME(bnoordhuis or tjfontaine) Unify this, it's extremely ugly. { 'target_name': 'uv_dtrace_provider', 'type': 'none', 'conditions': [ - [ 'uv_use_dtrace=="true" and OS!="mac"', { + [ 'uv_use_dtrace=="true" and OS not in "mac linux"', { 'actions': [ { 'action_name': 'uv_dtrace_o', @@ -499,7 +504,19 @@ '-o', '<@(_outputs)' ] } ] - } ] + }], + [ 'uv_use_dtrace=="true" and OS=="linux"', { + 'actions': [ + { + 'action_name': 'uv_dtrace_o', + 'inputs': [ 'src/unix/uv-dtrace.d' ], + 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/dtrace.o' ], + 'action': [ + 'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)' + ], + } + ] + }], ] },