Skip to content

feat(proc, stub): expose GetMarkStubAddr API to scan and record memory partially by intrusively insert stub address in struct definition#75

Open
Lslightly wants to merge 8 commits into
cloudwego:mainfrom
Lslightly:markStub
Open

Conversation

@Lslightly

Copy link
Copy Markdown

What type of PR is this?

feat

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

暴露GetMarkStubAddr API,通过在结构体定义中侵入式插入桩地址实现内存部分扫描和记录

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en: The most significant modification is in pkg/proc/reference.go. A markContext is introduced to indicate whether an object or a field can be recorded. markContext.useMarkStub is always true/false depending on whether --usemarkstub option is enabled. markContext.enableRecord is true when the stub address is found or an object is referenced directly/indirectly by other objects which contain the stub address.

The testcase is test/testdata/stubaddr/main.go. There are two sessions, one session with stub address while markStub of the other one is nil. Only the former session's objects will be recorded using the command grf attach <pid> --usemarkstub

zh(optional):

(Optional) Which issue(s) this PR fixes:

Fixes #71

(optional) The PR that updates user documentation:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

proposal: scan and record memory partially

1 participant