On Mon, Jul 23, 2018 at 7:48 AM, Y Song <[email protected]> wrote:

>
> We did not have such an example in BCC. In Facebook, we have a bpf
> program to catch
> stack traces for python programs. It is very similar to what you want
> to achieve in the above.
>

Can you share it with me? Maybe I can use it as an example.


> Basically, you need to walk the stack by yourself. Since verifier do
> not support unbounded loops,
> you need to have a fully-unrollable loop with progma unroll.
>

I have never used pragma unroll before, but I understand what it is
supposed to do.
Quick search gives me usages for CUDA and several little known examples for
gcc/clang.
Are you talking about them?
https://stackoverflow.com/questions/4071690/tell-gcc-to-specifically-unroll-a-loop



> During each loop iteration, you can access the frame pointer, you need
> some mechanism to
> get the real function name based on that level frame pointer and then
> you move on
> to the next. In bpf program, you can access current task structure,
> which contains some
> data related to TLS which could be used by the bpf program.
>
>
As far as I understand it would work if my program is built with frame
pointers. In that case going throigh stack trace shold be straightforward.
Never done it before though :-)
But usually programs are build omitting frame pointers. In that case you
need additional info from DWARF and code is much more complex. Right?
Are you suggesting implementing all this?

Sorry for newbie questions :-)

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#1396): https://lists.iovisor.org/g/iovisor-dev/message/1396
Mute This Topic: https://lists.iovisor.org/mt/23787733/21656
Group Owner: [email protected]
Unsubscribe: https://lists.iovisor.org/g/iovisor-dev/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to