#define ERR_STRING "ERROR: "
enum code { INFO=0, WARN, ERROR, DBUG };
+static void _stp_vlog (enum code type, const char *func, int line, const char *fmt, va_list args)
+ __attribute ((format (printf, 4, 0)));
+
static void _stp_vlog (enum code type, const char *func, int line, const char *fmt, va_list args)
{
int num;
start = sizeof(ERR_STRING) - 1;
}
- num = _stp_vscnprintf (buf + start, STP_LOG_BUF_LEN - start - 1, fmt, args);
+ num = vscnprintf (buf + start, STP_LOG_BUF_LEN - start - 1, fmt, args);
if (num + start) {
if (buf[num + start - 1] != '\n') {
buf[num + start] = '\n';
#define stp_for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
#endif
-static void _stp_dbug (const char *func, int line, const char *fmt, ...);
-static void _stp_error (const char *fmt, ...);
-static void _stp_warn (const char *fmt, ...);
+static void _stp_dbug (const char *func, int line, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
+static void _stp_error (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
+static void _stp_warn (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
static void _stp_exit(void);
continue;
if (memcmp(m->build_id_bits, (unsigned char*) notes_addr, m->build_id_len)) {
const char *basename;
-
basename = strrchr(m->path, '/');
if (basename)
basename++;
else
basename = m->path;
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
- _stp_error ("Build-id mismatch: \"%s\" %.*M"
- " vs. \"%s\" %.*M\n",
- m->name, m->build_id_len, notes_addr,
- basename, m->build_id_len, m->build_id_bits);
+ _stp_error ("Build-id mismatch: \"%s\" vs. \"%s\"\n",
+ m->name, basename);
return 1;
#else
/* This branch is a surrogate for kernels
* affected by Fedora bug #465873. */
- printk(KERN_WARNING
- "Build-id mismatch: \"%s\" vs. \"%s\"\n",
- m->name, basename);
+ _stp_warn (KERN_WARNING
+ "Build-id mismatch: \"%s\" vs. \"%s\"\n",
+ m->name, basename);
#endif
}
} /* end checking */
if (*cie <= sizeof(*cie) + 4 || *cie >= fde[1] - sizeof(*fde)
|| (*cie & (sizeof(*cie) - 1))
|| (cie[1] != 0xffffffff && cie[1] != 0)) {
- dbug_unwind(1, "cie is not valid %lx %x %x %x\n", cie, *cie, fde[1], cie[1]);
+ dbug_unwind(1, "cie is not valid %lx %x %x %x\n", (unsigned long)cie, *cie, fde[1], cie[1]);
return NULL; /* this is not a (valid) CIE */
}
static void set_rule(uleb128_t reg, enum item_location where, uleb128_t value, struct unwind_state *state)
{
- dbug_unwind(1, "reg=%d, where=%d, value=%lx\n", reg, where, value);
+ dbug_unwind(1, "reg=%lx, where=%d, value=%lx\n", reg, where, value);
if (reg < ARRAY_SIZE(state->regs)) {
state->regs[reg].where = where;
state->regs[reg].value = value;
num = read_pointer(&ptr, end, hdr[2]);
if (num == 0 || num != (end - ptr) / (2 * tableSize) || (end - ptr) % (2 * tableSize)) {
- dbug_unwind(1, "Bad num=%d end-ptr=%ld 2*tableSize=%d", num, end - ptr, 2 * tableSize);
+ dbug_unwind(1, "Bad num=%d end-ptr=%ld 2*tableSize=%d", num, (long)(end - ptr), 2 * tableSize);
return NULL;
}
if (num == 1 && (startLoc = adjustStartLoc(read_pointer(&ptr, ptr + tableSize, hdr[3]), m, s, hdr[3], 1)) != 0 && pc >= startLoc)
fde = (void *)read_pointer(&ptr, ptr + tableSize, hdr[3]);
- dbug_unwind(1, "returning fde=%lx startLoc=%lx", fde, startLoc);
+ dbug_unwind(1, "returning fde=%lx startLoc=%lx", (unsigned long) fde, startLoc);
return fde;
}
}
fde = _stp_search_unwind_hdr(pc, m, s);
- dbug_unwind(1, "%s: fde=%lx\n", m->name, fde);
+ dbug_unwind(1, "%s: fde=%lx\n", m->name, (unsigned long) fde);
/* found the fde, now set startLoc and endLoc */
if (fde != NULL) {
}
}
- dbug_unwind(1, "cie=%lx fde=%lx startLoc=%lx endLoc=%lx, pc=%lx\n", cie, fde, startLoc, endLoc, pc);
+ dbug_unwind(1, "cie=%lx fde=%lx startLoc=%lx endLoc=%lx, pc=%lx\n",
+ (unsigned long) cie, (unsigned long)fde, (unsigned long) startLoc, (unsigned long) endLoc, pc);
if (cie == NULL || fde == NULL)
goto err;
if (STACK_LIMIT(startLoc) != STACK_LIMIT(endLoc)) {
startLoc = min(STACK_LIMIT(cfa), cfa);
endLoc = max(STACK_LIMIT(cfa), cfa);
- dbug_unwind(1, "cfa startLoc=%p, endLoc=%p\n", (u64)startLoc, (u64)endLoc);
+ dbug_unwind(1, "cfa startLoc=%lx, endLoc=%lx\n",
+ (unsigned long)startLoc, (unsigned long)endLoc);
}
#ifndef CONFIG_64BIT
# define CASES CASE(8); CASE(16); CASE(32)
#else
# define CASES CASE(8); CASE(16); CASE(32); CASE(64)
#endif
- dbug_unwind(1, "cie=%lx fde=%lx\n", cie, fde);
+ dbug_unwind(1, "cie=%lx fde=%lx\n", (unsigned long) cie, (unsigned long) fde);
for (i = 0; i < ARRAY_SIZE(state.regs); ++i) {
if (REG_INVALID(i)) {
if (state.regs[i].where == Nowhere)