GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SeeFlowerX/unwinddaemon

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
bin
bin
 
 
external
external
 
 
shim_files
shim_files
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
Android.bp
Android.bp
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Snipaste_2022-10-16_21-55-55.png
Snipaste_2022-10-16_21-55-55.png
 
 
build.sh
build.sh
 
 
hook_open_with_stack.py
hook_open_with_stack.py
 
 
init-submodules.sh
init-submodules.sh
 
 
lib.cpp
lib.cpp
 
 
main.cpp
main.cpp
 
 

Repository files navigation

unwinddaemon

CMAKE + NDK编译步骤

拉取本项目,然后执行下面的命令

git submodule init
git submodule update --remote

如果是想手工配置,则执行下面的脚本

./init-submodules.sh

编译执行下面的脚本即可,产物位于build文件夹,注意只有单个so,部分依赖为静态编译,具体请阅读CMakeLists.txt

记得先修改ANDROID_NDK路径,如果要编译Android 10的版本,请将ANDROID_PLATFORM修改为android-29

./build.sh

关于shim_files的构成:

  • liblog

    • 这个下面的头文件其实就是从system/logging拿过来的
    • 为了能编译出在Android10上使用的库,给include/android/log.h添加了一些Android10上没有的函数声明
    • 测试暂时没有出现崩溃迹象
  • libunwindstack

    • 项目所需要的源码是从android14-release分支拉取的,Demangle.cpp有rust相关的内容,这里去掉了
    • ThreadUnwinder.cpp中有关struct sigaction的初始化会被编译器报警告,这里改了一下

本方案编译实现主要参考了以下两个项目,感谢:

  • https://github.com/cinit/libunwindstack
  • https://github.com/Mufanc/libunwindstack-standalone

基于AOSP的编译步骤

  • 同步AOSP
  • 在AOSP源码文件夹下创建system/extras/unwinddaemon文件夹
  • 将本项目的Android.bp和main.cpp放入上一步创建的文件夹
  • 在AOSP源码文件夹下打开终端,执行下面的命令进行编译
    . build/envsetup.sh
    lunch aosp_arm64-eng
    mmma system/extras/unwinddaemon
  • 编译成功后,产物在out/target/product/generic_arm64/system/bin/unwinddaemon

使用

将out/target/product/generic_arm64/system/bin/unwinddaemon推送到手机的/data/local/tmp,授予可执行权限

然后执行/data/local/tmp/unwinddaemon即可

hook_open_with_stack.py是配合bcc修改使用的demo

bin/unwinddaemon是预编译好的,但不一定兼容

bcc修改参见

  • https://github.com/SeeFlowerX/unwindbcc/commit/f6548633e1d8afd527637f0da69959046986a25c

原理,代码修改等,请查阅eBPF on Android之实现基于dwarf的用户态栈回溯

效果示意图


共享库版本

编译lib.cpp得到的产物如下,在SeeFlowerX/stackplz中使用

ld-android.so
libbase.so
libc++.so
libdl.so
liblog.so
liblzma.so
libm.so
libstackplz.so
libunwindstack.so

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity

Stars

42 stars

Watchers

1 watching

Forks

21 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.