Skip to content

hdbg arm64 implementation proposal. #19

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ message(STATUS "Version: ${VERSION_TAG}")
add_definitions("-DVERSION=${VERSION_TAG}")

set(CMAKE_CXX_STANDARD 17)
add_definitions("-std=c++17") # the above does not work for clang.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") # the above does not work for clang.

add_definitions("-Wall -Wextra -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE")
# Adding frame pointers makes things easy to run performance measurements with,
Expand Down
21 changes: 14 additions & 7 deletions heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,7 @@ getframe(void ***bp, void ***ip) {
"ret;"
);
}
#elif defined(__aarch64__) || defined(__arm__)
void
getframe(void ***bp, void ***ip) {
//XXX: TODO: support aarch64
}
#else

#elif defined(__i386__)
static void __attribute__((naked,noinline,optimize("O0")))
getframe(void ***bp, void ***ip) {
asm("mov (%esp), %ecx;"
Expand All @@ -360,6 +354,19 @@ getframe(void ***bp, void ***ip) {
"mov %ebp, (%edx);"
"ret;");
}
#elif defined(__aarch64__)
static void __attribute__((naked,noinline,optimize("O0")))
getframe(void ***bp, void ***ip) {
asm(
"mov x0, x29;"
"mov x1, x30;"
"ret;");
}
#else
void
getframe(void ***bp, void ***ip) {
//XXX: TODO: support other relevant archs
}
#endif

static void getstacktrace(void **ents, int max_ents) {
Expand Down
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ project(pstack-tests C CXX)
set(CMAKE_BUILD_TYPE Debug)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")

add_definitions("-std=c++17 -O0 -D_FORTIFY_SOURCE=0 -I${CMAKE_SOURCE_DIR}")
add_definitions("-O0 -D_FORTIFY_SOURCE=0 -I${CMAKE_SOURCE_DIR}")

add_library(testhelper STATIC abort.c)

Expand Down