On Sat, Jul 4, 2020 at 1:15 PM Valentin Vidić <vvidic@valentin-vidic.from.hr> wrote:
On Sat, Jul 04, 2020 at 12:04:59PM -0400, William Tambe wrote:
How or which function within that file translates an address to the string symbol+offset for the format %pS ?
%pS seems to end up in here:
Thanks, the issue I am having is due to sprint_backtrace() calling __sprint_symbol() with its argument symbol_offset == -1. Despite the comment above its definition, it is hard to understand why sprint_backtrace() calls __sprint_symbol() that way; in our port it results in printing incorrect symbols. As a workaround, we have made sprint_backtrace() to be the same as sprint_symbol().
static int __sprint_symbol(char *buffer, unsigned long address, int symbol_offset, int add_offset) { char *modname; const char *name; unsigned long offset, size; int len;
address += symbol_offset; name = kallsyms_lookup(address, &size, &offset, &modname, buffer); if (!name) return sprintf(buffer, "0x%lx", address - symbol_offset);
if (name != buffer) strcpy(buffer, name); len = strlen(buffer); offset -= symbol_offset;
if (add_offset) len += sprintf(buffer + len, "+%#lx/%#lx", offset, size);
if (modname) len += sprintf(buffer + len, " [%s]", modname);
return len; }
-- Valentin
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies