This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Mike Mason wrote:So should the following generate an error? It doesn't. It just prints "ptr = 0" and exits.-----------------------------------------^
function test_addr:long () %{ void *nullptr = NULL; THIS->__retvalue = (long) kread(&(nullptr));
You're reading the address *of* your pointer, not the address in the pointer. Thus kread() is dereferencing an address on the stack, and the value there is NULL. Drop the '&', and change nullptr to a type that's meaningful to dereference (e.g., long*), and you'll get your error.
The "&(xxx)" pattern you see everywhere is because usually the "xxx" is a struct value, and so you pass kread() a pointer to that value.
Thanks, Mike
Josh
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |