Skip to content

Instantly share code, notes, and snippets.

@agentzh
Created April 17, 2020 22:42
Show Gist options
  • Save agentzh/a465564e2c41f1353de46690eeb4f4cf to your computer and use it in GitHub Desktop.
Save agentzh/a465564e2c41f1353de46690eeb4f4cf to your computer and use it in GitHub Desktop.
diff --git a/tapset/uconversions.stp b/tapset/uconversions.stp
index 2b1fa8a15..1b2b52e4b 100644
--- a/tapset/uconversions.stp
+++ b/tapset/uconversions.stp
@@ -125,8 +125,8 @@ function user_string_n:string (addr:long, n:long)
if (rc < 0) {
strlcpy(STAP_RETVALUE, "<unknown>", MAXSTRINGLEN);
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault %ld at %p [man error::fault]", rc,
- (void *) (uintptr_t) STAP_ARG_addr);
+ "user string copy fault %ld at 0x%lx [man error::fault]", rc,
+ (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
} else
STAP_RETVALUE[len - 1] = '\0';
@@ -228,7 +228,7 @@ function user_string_n_warn:string (addr:long, n:long, warn_msg:string)
// NB: using error_buffer to get local space for the warning, but we're
// not aborting, so leave last_error alone.
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault %ld at %p [man error::fault]", rc,
+ "user string copy fault 0x%ld at %lx [man error::fault]", rc,
(void *) (uintptr_t) STAP_ARG_addr);
_stp_warn(CONTEXT->error_buffer);
strlcpy (STAP_RETVALUE, STAP_ARG_warn_msg, MAXSTRINGLEN);
@@ -319,7 +319,7 @@ function user_string_n_quoted:string (addr:long, inlen:long, outlen:long)
#if STAP_COMPAT_VERSION < STAP_VERSION(2,3) // PR15044
strlcpy(STAP_RETVALUE, "NULL", MAXSTRINGLEN);
#else
- snprintf(STAP_RETVALUE, MAXSTRINGLEN, "%p", (void *)(uintptr_t)STAP_ARG_addr);
+ snprintf(STAP_RETVALUE, MAXSTRINGLEN, "(null)");
#endif
else {
int rc = _stp_text_str(STAP_RETVALUE,
@@ -334,8 +334,8 @@ function user_string_n_quoted:string (addr:long, inlen:long, outlen:long)
(compat_long_t)STAP_ARG_addr);
else
#endif
- snprintf(STAP_RETVALUE, MAXSTRINGLEN, "%p",
- (void *)(uintptr_t)STAP_ARG_addr);
+ snprintf(STAP_RETVALUE, MAXSTRINGLEN, "0x%lx",
+ (uintptr_t)STAP_ARG_addr);
#endif
}
}
@@ -366,7 +366,7 @@ function user_string_utf32:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-32 character U+%X at 0x%p", c32, source);
+ "invalid UTF-32 character U+%X at 0x%lx", c32, (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -379,7 +379,7 @@ function user_string_utf32:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault at 0x%p [man error::fault]", source);
+ "user string copy fault at 0x%lx [man error::fault]", (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -447,7 +447,7 @@ function user_string_utf16:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-16 character U+%X at 0x%p", c32, source);
+ "invalid UTF-16 character U+%X at 0x%lx", c32, source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -460,7 +460,7 @@ function user_string_utf16:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault at 0x%p [man error::fault]", source);
+ "user string copy fault at 0x%lx [man error::fault]", (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment