Fixes #2518 -- weird behaviour of lookup_or_init (#2520)
* Allow lookup_or_init to return NULL (rather than just returning from the current function)
* Fixed a couple of bad edits found when running tests. Also fixed a bug in the
test runner. Also fixed a bug in libbcc where the python signature did not match
the actual implementation.
diff --git a/tools/biotop.py b/tools/biotop.py
index 6c959f6..3181ba9 100755
--- a/tools/biotop.py
+++ b/tools/biotop.py
@@ -155,10 +155,12 @@
valp = counts.lookup_or_init(&info, &zero);
}
- // save stats
- valp->us += delta_us;
- valp->bytes += req->__data_len;
- valp->io++;
+ if (valp) {
+ // save stats
+ valp->us += delta_us;
+ valp->bytes += req->__data_len;
+ valp->io++;
+ }
start.delete(&req);
whobyreq.delete(&req);