-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
trace -U cannot show second function from the top of the stack #2555
Comments
I suspect this is a bcc specific thing. kernel stack addresses seem correct. If you create another func_e, you will get,
As you observed, the last second frame is missing. This is because during unwinding, for the first function of Maybe kernel user space framepoint based unwinding could be smart for such cases. |
Thank you for the answer. Is there any workaround or fix for this? |
Without actually tried, I think at that point the address directly below You can also manually attach the uprobe to the instruction right after the frame pointer operations ( @yonghong-song I think this would be a bit tricky to handle in unwinding because we don't know if the binary is doing actual frame pointer per calling convention as we are seeing here. Like if the binary has omitted frame pointer. Would it be possible to handle this at uprobe attaching time? i.e. we either attach to the first instruction, or the instruction directly after the frame pointer operations? I don't understand uprobe internals very well, but if I remember correct this would actually save a few user / kernel context switches in the beginning of uprobe, right? |
Yes, from user perspective, this is a viable solution. I also agree with you this is kind of tricky to do it right. Need to do more analysis in code to ensure this is the case that user did not omit the frame pointer and it has the pattern as we described here. This probably too much for bcc I guess.
Not sure what is the correct fix for this. gdb can do this. For sure bcc can do this as well if doing code analysis... But it might be too complex... So the workaround might just fine. Do not attach to the first insn of the function. Attach to the insn after frame pointer is established correctly. |
Hello! The title of my issue migh leave you with confusion, so let me explain it:
I have a very simple test program, test.c:
For tracing the
func_d
I use the following command:Which give me the following output:
The
func_c
call which should be just under the top of the callstack is missing for some reason. I'm sure this is not because some compiler optimization, because if I check the backtrace (bt
) intgdb
its looks normal (func_a -> func_b -> func_c -> func_d). Also, if I BCC trace thefunc_c
I get this output:As far as I understand, there is certainly something wrong with the second backtrace element, because I lost
func_b
from the outputThe text was updated successfully, but these errors were encountered: