205-backtrace_module_info.patch 936 B

123456789101112131415161718192021222324252627282930313233343536
  1. --- a/lib/vsprintf.c
  2. +++ b/lib/vsprintf.c
  3. @@ -614,8 +614,10 @@ char *symbol_string(char *buf, char *end
  4. struct printf_spec spec, const char *fmt)
  5. {
  6. unsigned long value;
  7. -#ifdef CONFIG_KALLSYMS
  8. char sym[KSYM_SYMBOL_LEN];
  9. +#ifndef CONFIG_KALLSYMS
  10. + struct module *mod;
  11. + int len;
  12. #endif
  13. if (fmt[1] == 'R')
  14. @@ -629,15 +631,15 @@ char *symbol_string(char *buf, char *end
  15. sprint_symbol(sym, value);
  16. else
  17. sprint_symbol_no_offset(sym, value);
  18. -
  19. - return string(buf, end, sym, spec);
  20. #else
  21. - spec.field_width = 2 * sizeof(void *);
  22. - spec.flags |= SPECIAL | SMALL | ZEROPAD;
  23. - spec.base = 16;
  24. + len = snprintf(sym, sizeof(sym), "0x%lx", value);
  25. - return number(buf, end, value, spec);
  26. + mod = __module_address(value);
  27. + if (mod)
  28. + snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]",
  29. + mod->name, mod->module_core, mod->core_size);
  30. #endif
  31. + return string(buf, end, sym, spec);
  32. }
  33. static noinline_for_stack