summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-04-13 19:50:23 -0700
committerJosh Stone <jistone@redhat.com>2009-04-13 19:50:23 -0700
commitb9c2e81cc7a62336ec1daf374cb3411add772ab4 (patch)
treea4bd05ef043f77e6cfe8c78b6f24879f68689910 /runtime
parent675e4d2a0635f822e8258c3f219c6dda685c67cf (diff)
downloadsystemtap-steved-b9c2e81cc7a62336ec1daf374cb3411add772ab4.tar.gz
systemtap-steved-b9c2e81cc7a62336ec1daf374cb3411add772ab4.tar.xz
systemtap-steved-b9c2e81cc7a62336ec1daf374cb3411add772ab4.zip
PR10067: fix bitfield access
* tapsets.cxx (dwflpp::translate_components): Eliminate the extra die-dereference at the end of the loop (a regression from @casts). * runtime/loc2c-runtime.h (store_bitfield): Use the target as the representative type, since the base is always int64_t. Also be a bit more aggressive with masking and parentheses. * testsuite/systemtap.base/bitfield.*: New test for R/W bitfields.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/loc2c-runtime.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h
index eaf47cad..620e1615 100644
--- a/runtime/loc2c-runtime.h
+++ b/runtime/loc2c-runtime.h
@@ -29,11 +29,12 @@
& (((__typeof (base)) 1 << (nbits)) - 1))
#define store_bitfield(target, base, higherbits, nbits) \
- target = (target \
- &~ ((((__typeof (base)) 1 << (nbits)) - 1) \
- << (sizeof (base) * 8 - (higherbits) - (nbits))) \
- | ((__typeof (base)) (base) \
- << (sizeof (base) * 8 - (higherbits) - (nbits))))
+ target = ((target \
+ &~ ((((__typeof (target)) 1 << (nbits)) - 1) \
+ << (sizeof (target) * 8 - (higherbits) - (nbits)))) \
+ | ((((__typeof (target)) (base)) \
+ & (((__typeof (target)) 1 << (nbits)) - 1)) \
+ << (sizeof (target) * 8 - (higherbits) - (nbits))))
/* Given a DWARF register number, fetch its intptr_t (long) value from the