•  


[Question] rr-debugger as a library? · Issue #3632 · rr-debugger/rr · GitHub
Skip to content
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

[Question] rr-debugger as a library? #3632

Open
4kreed opened this issue Oct 20, 2023 · 6 comments
Open

[Question] rr-debugger as a library? #3632

4kreed opened this issue Oct 20, 2023 · 6 comments

Comments

@4kreed
Copy link

Would it be possible to use rr-debugger as a library? I have a use case where I want to record the execution of all my tests and only keep the record if the test failed (and do that programatically).

I'm wondering if it is possible to call RecordCommand::run() before executing my test. Maybe this doesn't make sense but I can see a real advantage of being able to at least record by using some APIs from a library.

Thanks for your time.

@rocallahan
Copy link
Collaborator

I have a use case where I want to record the execution of all my tests and only keep the record if the test failed (and do that programatically).

rr returns the exit code of the application you recorded. So you can write a program (e.g. a shell script) that runs rr, checks the exit code, and delete the recording if the test failed.

@4kreed
Copy link
Author

Thanks for your quick response!

Right, I was wondering about a more fine grained execution, so let's say I have a tester that runs 100 tests. I'd like to record each test individually and keep the record only if the test failed (and not the recording of the execution of the entire tester).

Also, and specially, in a fuzz testing scenario, where the same code is tested multiple times based on the generated inputs by the fuzz engine (a process that can't be stopped and relaunched, since metrics like coverage would be loss), I'd like to record the execution of the code for each generated input, and again discard the recording based on the result.

Is there any mechanism that could fit for this scenario?

Again, thanks for your time, any help is much appreciated.

@rocallahan
Copy link
Collaborator

rr can't split up a recording of a single process execution to just isolate one sub-test that failed.

For fuzzing, usually people take the failing fuzzing input, run some minimization algorithm on it, and then re-record that with rr for debugging.

@4kreed
Copy link
Author

Thanks again for your response and sorry for the delay in mine.

I apologize if I haven't expressed myself clearly, it is not about splitting up a recording but making recordings in a more fine tune way. The idea would be to be able to start and stop recordings by calling some public API (let's say, recordStart() and recordStop()) from the source code and thus using rr as a library.

Nevertheless, I understand from your messages that this scenario/functionality is not currently provided by rr. Based on your knowledge about the tool, do you think this is something achievable? I'm thinking about implementing this functionality myself but I'm not even sure if it is possible at all. Any comment or hint about it would be greatly appreciated.

Again, thanks for your time, I appreciate a lot your help.

@4kreed
Copy link
Author

@rocallahan Did you have the chance to see my latest comment? Any thoughts about it?

Greatly appreciated :)

@rocallahan
Copy link
Collaborator

The idea would be to be able to start and stop recordings by calling some public API (let's say, recordStart() and recordStop()) from the source code and thus using rr as a library.

It probably could be done but it would be pretty hard. The especially hard part is taking a snapshot of the current state at the start of the recording and getting everything set up. Right now we rely on setting everything (e.g. seccomp filters) up in an initial process and then all other tracees inheriting the right settings, and also on setting up various things whenever there's an execve.

Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본