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]

Re: Too larger number in badkprobe test on 32 bits machine.


Frank Ch. Eigler wrote:
Wenji Huang <wenji.huang@oracle.com> writes:

[...]
kernel.statement(-1).absolute {} probe timer.s(1) { exit() }'
[...]
/tmp/staplt6ZIz/stap_84012a21d1a75884e8298817a3e8ad51_390.c:235:
warning: integer constant is too large for 'unsigned long' type
/tmp/staplt6ZIz/stap_84012a21d1a75884e8298817a3e8ad51_390.c:235:
warning: large integer implicitly truncated to unsigned type
make[1]: ***
[...]
Seems "-1" is interpreted as 64-bit number and not appropriate for 32
bits machine. Change to other number or update translate.cxx to
perform explicitly truncation ?

Yeah, translate.cxx could do it - the trick is finding a series of casts that quietly truncates the value. (Changing the test case to some other number like 0 would only paper over the problem.)

- FChE

Seems the following patch can solve the problem.
diff --git a/tapsets.cxx b/tapsets.cxx
index 20bea45..abc0fae 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -5039,7 +5039,7 @@ dwarf_derived_probe_group::emit_module_decls (systemtap_session& s)
assert (p->maxactive_val >= 0 && p->maxactive_val <= USHRT_MAX);
s.op->line() << " .maxactive_val=" << p->maxactive_val << ",";
}
- s.op->line() << " .address=0x" << hex << p->addr << dec << "UL,";
+ s.op->line() << " .address=(unsigned long)0x" << hex << p->addr << dec << "ULL,";
s.op->line() << " .module=\"" << p->module << "\",";
s.op->line() << " .section=\"" << p->section << "\",";
s.op->line() << " .pp=" << lex_cast_qstring (*p->sole_location()) << ",";


Did some tests on x86 and x86_64. The good result is achieved. Probe kernel.statement(0x123456789) will be truncated into kernel.statement(0x12345678) on 32 bits machine.
$ uname -mr
2.6.26 i686
$ sudo stap -g -w -e 'probe kernel.statement(-1).absolute {}probe timer.s(1) { exit() }'
WARNING: probe kernel.statement(-1).absolute registration error (rc -22)


Regards,
Wenji


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]