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

Minor endian and debug enhancement #456

Merged
merged 2 commits into from
Mar 29, 2016
Merged

Conversation

yadutaf
Copy link
Contributor

@yadutaf yadutaf commented Mar 29, 2016

  • add DEBUG_* constants in place of the hardcoded values. Should help making self-documenting code
  • move endian fixes to clang, previous PR was merged... fast :)

I was trying to automatically insert bpf_probe_read in situations like https://github.com/iovisor/bcc/blob/master/tools/solisten.py#L105 but did not find the right way. I tried tweaking https://github.com/iovisor/bcc/blob/master/src/cc/frontends/clang/b_frontend_action.cc with no success. Do you have a guide on how to run it into a debugger ?

@4ast
Copy link
Member

4ast commented Mar 29, 2016

lgtm

@drzaeus77 drzaeus77 merged commit 6c08dcb into iovisor:master Mar 29, 2016
@drzaeus77
Copy link
Collaborator

I generally used llvm::errs() to debug, since there is a lot of tree-walking going on such that following in gdb can get confusing. It was easier for me to get a dump of the control flow and stare at it after the fact. That said, the easiest way to get gdb into b_frontend_action is probably to instrument or attach to tests/cc/test_static, since that will be straightforward to test and run.

The probe stuff happens mostly in the ProbeVisitor class (which you may have already come across). Try for instance adding E->dump() wherever memb_visited_.insert(E); occurs. In your case, what I suspect happens is that the call to inet_sk(sk) hides the ProbeChecker::needs_probe_ semantic from the analysis. Otherwise doing evt.lport = inet->inet_sport might have worked automatically.

@drzaeus77 drzaeus77 mentioned this pull request Mar 30, 2016
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

Successfully merging this pull request may close these issues.

None yet

3 participants