-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Want to konw how to use wrapper and ld-preload together. #609
Comments
https://github.com/rizsotto/Bear/wiki/Troubleshooting#how-it-works I've wrote this wiki page to explain the internals. Hope that answer the questions you had. |
I write a demo: intercept, libhook.so and wrapper.
I don't know why it didn't work as expected with bear. It failed in the bitbake build system. And I find there has a subprocess clean env , the |
Would it be possible to run Bear in a verbose mode to see the logs what it does? (Maybe against a smaller project with a few file.) Also, the library preload does have limitations: does not work with static compilers; does not work if the build cleans up the environment variables; might not work if the build manipulates the |
Sorry, after specifying --verbose, bitbake may be interrupted by using standard output or standard error output. |
The intercept demo I wrote sets up ld-preload, and then ld-preload captures |
About how the wrapper is not statically linked, and still not called by the pre-loaded exec method... The process spawn has a version which looks up the libc symbol directly. About the bitbake has server and client... I am not familiar with that tool, but have seen gradle which has similar concept. And these tools does not work together with Bear. The reason for that the server process which executes the build is not receives the environment variables that needed for the reporting. And if it receives, it caches and subsequent runs have different address to report the executions, so those report will be lost.... If there is an option to force to run the build as a child process and not under a server, that might have a chance to work. The current version of Bear is using a supervisor process. This supervisor makes decision which intercept mode will be used. And then sets up the environment and execute the build process. During the build process the |
Thank you very much for your answer🌹. I understand that posix_spawn in wrapper uses the original libc symbol, which can avoid the problem of circular calling. 😄 |
If the Alternatively ptrace can be a method where you can intercept these process executions. Bear does not implemented this. (Might do in the next version.) It also have strengths and weaknesses. (It does not work within docker. And it makes the execution slow.) |
How does wrapper call ld-preload, and how does ld-preload call wrapper
Environment:
OS:Ubuntu 20.04
Articature: X86-64 amd
Bear:3.1.5 debug
Build System:bitbake
Project url:https://gitee.com/jiangwei0512/poky.git
Built Command:
cd poky && source oe-init-build-env && bitbake go-helloworld
Additional context
Hello, I was recently looking at the code of the bear project. When I saw the wrapper and ld-preload, there was something I didn't quite understand.
For the bitbake project, after using the --force-wrapper and --force-preload parameters respectively, I found that no compilation instructions were collected.
But by default, compilation instructions can be collected. I want to know how the wrapper and ld-preload work together.
At the same time, I also found that the wrapper is a dynamically linked software, and the wrapper will be affected by ld-preload during operation, but it does not cause a circular call.
I want to konw how does wrapper call ld-preload, and how does ld-preload call wrapper, that can intercept all the compile commands.
The text was updated successfully, but these errors were encountered: