|
|
623c0e |
commit fb9529161039e96d44b4b7396450cff04e3d9aa8
|
|
|
623c0e |
Author: Maynard Johnson <maynardj@us.ibm.com>
|
|
|
623c0e |
Date: Tue Oct 15 14:58:16 2013 -0500
|
|
|
623c0e |
|
|
|
623c0e |
Fix operf/ocount default unit mask selection
|
|
|
623c0e |
|
|
|
623c0e |
Many events (particularly in the x86* architectures)
|
|
|
623c0e |
require a unit mask value to specify the exact event
|
|
|
623c0e |
type. For such events, a default unit mask value
|
|
|
623c0e |
is assigned. When a user runs operf, ocount, or
|
|
|
623c0e |
opcontrol and specifies such an event but does not
|
|
|
623c0e |
specify a unit mask, the default unit mask should be
|
|
|
623c0e |
selected and used by the tool. A bug was discovered
|
|
|
623c0e |
with operf and ocount where the unit mask value in
|
|
|
623c0e |
this situation was being set to '0' instead of the
|
|
|
623c0e |
default unit mask value. This patch fixes the bug.
|
|
|
623c0e |
|
|
|
623c0e |
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
|
|
|
623c0e |
|
|
|
623c0e |
diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp
|
|
|
623c0e |
index b85d175..177835e 100644
|
|
|
623c0e |
--- a/libpe_utils/op_pe_utils.cpp
|
|
|
623c0e |
+++ b/libpe_utils/op_pe_utils.cpp
|
|
|
623c0e |
@@ -484,7 +484,8 @@ handle_named_um:
|
|
|
623c0e |
pclose(fp);
|
|
|
623c0e |
event->evt_um = strtoull(mask, &endptr, 10);
|
|
|
623c0e |
if ((endptr >= mask) &&
|
|
|
623c0e |
- (endptr <= (mask + strlen(mask) - 1))) {
|
|
|
623c0e |
+ (endptr <= (mask + strlen(mask) - 2))) { // '- 2' to account for linefeed and '\0'
|
|
|
623c0e |
+
|
|
|
623c0e |
// Must be a default named unit mask
|
|
|
623c0e |
strncpy(event->um_name, mask, OP_MAX_UM_NAME_LEN);
|
|
|
623c0e |
goto handle_named_um;
|