-
Notifications
You must be signed in to change notification settings - Fork 0
Trace checker: check ptr values #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
9918d5e
to
f1385d4
Compare
Signed-off-by: Anastasia Basho <[email protected]>
db49f64
to
10eba8a
Compare
@@ -1,3 +1,4 @@ | |||
#include "coldtrace/entries.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import?
#define PTR_MASK 0xFFFFFFFFFFFF0000UL | ||
#define ZERO_FLAG 0x80 | ||
|
||
#define SHIFT_VALUE 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change to PTR_SHIFT_VALUE
and put it with PTR_MASK
so it's clear that they belong together?
log_info("register expected trace thread=%lu", tid); | ||
_expected[tid] = trace; | ||
_expected[tid] = trace; | ||
size_t array_size = sizeof(entry_ptr) / sizeof(uint64_t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use MAX_ENTRY_VALUES
typedef void (*entry_callback)(const void *entry); | ||
static size_t _entry_callback_count = 0; | ||
static entry_callback _entry_callbacks[MAX_ENTRY_CALLBACKS]; | ||
static uint64_t entry_ptr[MAX_ENTRY_VALUES]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's stick to the same convention as the variables above and start this with _ as it is static as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe _entry_ptr_values
to make more clear what it is?
int i) | ||
{ | ||
// check ptr required | ||
if (iter->check != -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make a macro for the -1 and call it something like NO_CHECK
entry_ptr[iter->check] = type_ptr; | ||
log_info("thread=%lu entry=%d match=%s match=ptr=%lu", tid, i, | ||
coldtrace_entry_type_str((iter->e)->type), type_ptr); | ||
// ptr match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's put the comments inside the block that they concern
|
||
for (int i = 0; iter_next(it); iter_advance(&it), i++) { | ||
coldtrace_entry_type type = iter_type(it); | ||
uint64_t type_ptr = iter_pointer_value(it); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also call it ptr_value or pointer_value on the left side? Let's make naming consistent
_expected[tid] = trace; | ||
size_t array_size = sizeof(entry_ptr) / sizeof(uint64_t); | ||
for (size_t i = 0; i < array_size; i++) { | ||
entry_ptr[i] = (uint64_t)-1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make a define for this -1 to have a CHECK_NONE
or CHECK_UNINITIALIZED
No description provided.