extern void
dumpstr(struct tcb *, kernel_ulong_t addr, int len);
-extern void
+extern int
printstr_ex(struct tcb *, kernel_ulong_t addr, kernel_ulong_t len,
unsigned int user_style);
-extern void
+extern int
printpathn(struct tcb *, kernel_ulong_t addr, unsigned int n);
-extern void
+extern int
printpath(struct tcb *, kernel_ulong_t addr);
#define TIMESPEC_TEXT_BUFSIZE \
extern void unwind_capture_stacktrace(struct tcb *);
#endif
-static inline void
+static inline int
printstrn(struct tcb *tcp, kernel_ulong_t addr, kernel_ulong_t len)
{
- printstr_ex(tcp, addr, len, 0);
+ return printstr_ex(tcp, addr, len, 0);
}
-static inline void
+static inline int
printstr(struct tcb *tcp, kernel_ulong_t addr)
{
- printstr_ex(tcp, addr, -1, QUOTE_0_TERMINATED);
+ return printstr_ex(tcp, addr, -1, QUOTE_0_TERMINATED);
}
static inline int
/*
* Print path string specified by address `addr' and length `n'.
* If path length exceeds `n', append `...' to the output.
+ *
+ * Returns the result of umovenstr.
*/
-void
+int
printpathn(struct tcb *const tcp, const kernel_ulong_t addr, unsigned int n)
{
char path[PATH_MAX];
if (!addr) {
tprints("NULL");
- return;
+ return -1;
}
/* Cap path length to the path buffer size */
path[n++] = !nul_seen;
print_quoted_cstring(path, n);
}
+
+ return nul_seen;
}
-void
+int
printpath(struct tcb *const tcp, const kernel_ulong_t addr)
{
/* Size must correspond to char path[] size in printpathn */
- printpathn(tcp, addr, PATH_MAX - 1);
+ return printpathn(tcp, addr, PATH_MAX - 1);
}
/*
* Pass `user_style' on to `string_quote'.
* Append `...' to the output if either the string length exceeds `max_strlen',
* or QUOTE_0_TERMINATED bit is set and the string length exceeds `len'.
+ *
+ * Returns the result of umovenstr if style has QUOTE_0_TERMINATED,
+ * or the result of umoven otherwise.
*/
-void
+int
printstr_ex(struct tcb *const tcp, const kernel_ulong_t addr,
const kernel_ulong_t len, const unsigned int user_style)
{
if (!addr) {
tprints("NULL");
- return;
+ return -1;
}
/* Allocate static buffers if they are not allocated yet. */
if (!str) {
if (rc < 0) {
printaddr(addr);
- return;
+ return rc;
}
if (size > max_strlen)
tprints(outstr);
if (ellipsis)
tprints("...");
+
+ return rc;
}
void