Skip to content

Commit

Permalink
Generate and link dtrace probes for libponyrt
Browse files Browse the repository at this point in the history
Dtrace functionality was missed when converting the build system to cmake.
This PR generates and links dtrace probes into `libponyrt` if the
`use=dtrace` option.

Fixes #4449
  • Loading branch information
chalcolith authored and SeanTAllen committed Sep 24, 2023
1 parent be92517 commit 64956ba
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,43 @@ jobs:
.\make.ps1 -Command build -Config Release
- name: Test with Release Runtime
run: .\make.ps1 -Command test -Config Release -Uselldb yes

use_dtrace_directive:
needs: x86_64-linux
runs-on: ubuntu-latest

name: dtrace
container:
image: ${{ matrix.image }}
options: --user pony --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore Libs Cache
id: restore-libs
uses: actions/cache/restore@v3
with:
path: build/libs
key: libs-ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu22.04-builder:20230830-${{ hashFiles('Makefile', 'CMakeLists.txt', 'libs/CMakeLists.txt') }}
- name: Build Libs
if: steps.restore-libs.outputs.cache-hit != 'true'
run: make libs build_flags=-j8
- name: Save Libs Cache
if: steps.restore-libs.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: build/libs
key: libs-ghcr.io/ponylang/ponyc-ci-x86-64-unknown-linux-ubuntu22.04-builder:20230830-${{ hashFiles('Makefile', 'CMakeLists.txt', 'libs/CMakeLists.txt') }}
- name: Build Debug Runtime
run: |
make configure arch=x86-64 config=debug use=dtrace
make build config=debug
- name: Test with Debug Runtime
run: make test-ci config=debug usedebugger='lldb'
- name: Build Release Runtime
run: |
make configure arch=x86-64 config=release use=dtrace
make build config=release
- name: Test with Release Runtime
run: make test-ci config=release usedebugger='lldb'
8 changes: 8 additions & 0 deletions src/libponyrt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ add_library(libponyrt STATIC
${_ll_except_obj}
)

if(PONY_USE_DTRACE)
add_custom_command(OUTPUT dtrace_probes.o
COMMAND dtrace -h -s "${CMAKE_CURRENT_SOURCE_DIR}/../common/dtrace_probes.d" -o "${CMAKE_CURRENT_SOURCE_DIR}/../common/dtrace_probes.h"
COMMAND dtrace -G -s "${CMAKE_CURRENT_SOURCE_DIR}/../common/dtrace_probes.d" -o dtrace_probes.o
)
target_sources(libponyrt PRIVATE dtrace_probes.o)
endif()

if (NOT MSVC)
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86-64")
target_compile_options(libponyrt PUBLIC -mcx16)
Expand Down

0 comments on commit 64956ba

Please sign in to comment.