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

segmentation fault in if statement #11

Closed
ccb3 opened this issue Oct 26, 2018 · 1 comment
Closed

segmentation fault in if statement #11

ccb3 opened this issue Oct 26, 2018 · 1 comment

Comments

@ccb3
Copy link

ccb3 commented Oct 26, 2018

As one example, I want to print a header the first time I enter a probe. In order to do that I check if a map h[0] is set and if it is not i should print the header information. This works if I use "if (h[0])" but not the other way around, i.e. using "if (!h[0])" instead. This gives segmentation fault. My example is shown below

kretprobe:vfs_read
{
        if (!h[0])
                printf("%-18s %6s %6s %16s %10s\n", "Time",  "PID", "UID", "COMM", "BYTES");

        printf("%v %6d %6d %16s %10d\n", walltime, pid, uid, comm, retval);
        h[0] = 1;
}
@wkz wkz closed this as completed in d115242 Oct 28, 2018
@wkz
Copy link
Owner

wkz commented Oct 28, 2018

Thanks for reporting this!

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