From: "Valentin Vidić" <vvidic@valentin-vidic.from.hr>
To: kernelnewbies@kernelnewbies.org
Subject: Re: printk() format %pS wrong symbol
Date: Sat, 4 Jul 2020 19:14:34 +0200 [thread overview]
Message-ID: <20200704171433.GD6573@valentin-vidic.from.hr> (raw)
In-Reply-To: <CAF8i9mMY5vHnCM+e4i0L6_BeGPYRDMcdbPUPwG-wzamEt026zg@mail.gmail.com>
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:
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
next prev parent reply other threads:[~2020-07-04 17:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 10:11 printk() format %pS wrong symbol William Tambe
2020-07-04 10:29 ` Valentin Vidić
2020-07-04 16:04 ` William Tambe
2020-07-04 17:14 ` Valentin Vidić [this message]
2020-07-06 22:06 ` William Tambe
2020-07-07 18:39 ` Valentin Vidić
2020-07-07 18:53 ` Valentin Vidić
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200704171433.GD6573@valentin-vidic.from.hr \
--to=vvidic@valentin-vidic.from.hr \
--cc=kernelnewbies@kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).