Skip to content
Snippets Groups Projects
Commit a03be3cb authored by Tomasz Grabiec's avatar Tomasz Grabiec Committed by Pekka Enberg
Browse files

trace: fix serialization of const char * tracepoint arguments


The serializer was reading from the destination buffer instead of the
source string. As a result all string arguments appeard as empty
strings in the trace.

Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 05694daf
No related branches found
No related tags found
No related merge requests found
......@@ -180,18 +180,21 @@ struct object_serializer<const char*> {
size_t len = 0;
unsigned char tmp;
// destination is in "pascal string" layout
while (len < max_len -1 && (tmp = try_load(buffer + len, '?')) != 0) {
while (len < max_len -1 && (tmp = try_load(val + len, '?')) != 0) {
buffer[len++ + 1] = tmp;
}
*buffer = len;
}
unsigned char try_load(unsigned char* bad_addr, unsigned char alt) {
unsigned char ret;
template<typename T>
T try_load(const T* bad_addr, T alt) {
T ret;
if (!safe_load(bad_addr, ret)) {
return alt;
}
return ret;
}
size_t size() { return max_len; }
size_t alignment() { return 1; }
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment