diff options
author | Stan Cox <scox@redhat.com> | 2009-12-09 10:57:36 -0500 |
---|---|---|
committer | Stan Cox <scox@redhat.com> | 2009-12-09 10:57:36 -0500 |
commit | 3a31e709a19d469c217cc1b65f9f1d6b2ee51ffb (patch) | |
tree | e09bc86d0eb2cff329a90d80c23e6c7567ba51ff | |
parent | f4ba7c13533b7e99edd0e66a0f6ccd6c0f55ec38 (diff) | |
download | systemtap-steved-3a31e709a19d469c217cc1b65f9f1d6b2ee51ffb.tar.gz systemtap-steved-3a31e709a19d469c217cc1b65f9f1d6b2ee51ffb.tar.xz systemtap-steved-3a31e709a19d469c217cc1b65f9f1d6b2ee51ffb.zip |
Handle .probes section big endian 32 bit case.
sdt.h (STAP_PROBE_ADDR): Add 32 bit big endian case.
(STAP_PROBE_DATA_): Use .balign
tapsets.cxx (sdt_query::get_next_probe): Stop if there is no probe name.
-rw-r--r-- | includes/sys/sdt.h | 18 | ||||
-rw-r--r-- | tapsets.cxx | 10 |
2 files changed, 19 insertions, 9 deletions
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index d85d8e2e..7c23d55a 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -12,9 +12,11 @@ #ifdef __LP64__ -#define STAP_PROBE_ADDR "\t.quad " +#define STAP_PROBE_ADDR(arg) "\t.quad " arg +#elif defined (__BIG_ENDIAN__) +#define STAP_PROBE_ADDR(arg) "\t.long 0\n\t.long " arg #else -#define STAP_PROBE_ADDR "\t.long " +#define STAP_PROBE_ADDR(arg) "\t.long " arg #endif /* Allocated section needs to be writable when creating pic shared objects @@ -26,14 +28,14 @@ /* An allocated section .probes that holds the probe names and addrs. */ #define STAP_PROBE_DATA_(probe,guard,arg) \ __asm__ volatile (".section .probes," ALLOCSEC "\n" \ - "\t.align 8\n" \ + "\t.balign 8\n" \ "1:\n\t.asciz " #probe "\n" \ - "\t.align 4\n" \ + "\t.balign 4\n" \ "\t.int " #guard "\n" \ - "\t.align 8\n" \ - STAP_PROBE_ADDR "1b\n" \ - "\t.align 8\n" \ - STAP_PROBE_ADDR #arg "\n" \ + "\t.balign 8\n" \ + STAP_PROBE_ADDR("1b\n") \ + "\t.balign 8\n" \ + STAP_PROBE_ADDR(#arg "\n") \ "\t.int 0\n" \ "\t.previous\n") diff --git a/tapsets.cxx b/tapsets.cxx index bad72091..555a6587 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -3829,7 +3829,13 @@ sdt_query::init_probe_scn() bool sdt_query::get_next_probe() { - // Extract probe info from the .probes section + // Extract probe info from the .probes section, e.g. + // 74657374 5f70726f 62655f32 00000000 test_probe_2.... + // 50524233 00000000 980c2000 00000000 PRB3...... ..... + // 01000000 00000000 00000000 00000000 ................ + // test_probe_2 is probe_name, probe_type is 50524233, + // *probe_name (pbe->name) is 980c2000, probe_arg (pbe->arg) is 1 + // probe_scn_offset is position currently being scanned in .probes while (probe_scn_offset < pdata->d_size) { @@ -3855,6 +3861,8 @@ sdt_query::get_next_probe() probe_scn_offset += sizeof(__uint32_t); probe_scn_offset += probe_scn_offset % sizeof(__uint64_t); pbe = (struct probe_entry*) ((char*)pdata->d_buf + probe_scn_offset); + if (pbe->name == 0) + return false; probe_name = (char*)((char*)pdata->d_buf + pbe->name - (char*)probe_scn_addr); probe_arg = pbe->arg; if (sess.verbose > 4) |