linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
To: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>, acme@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com,
	Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Subject: Re: [PATCH] perf annotate: Fix objdump comment parsing for Intel mov dissassembly
Date: Wed, 29 Nov 2017 20:52:13 +0530	[thread overview]
Message-ID: <9c33e7e2-9101-27fa-d1f4-cbdb4777fcc5@linux.vnet.ibm.com> (raw)
In-Reply-To: <d2e2818d-6d49-c208-68f5-8cd28034bbfc@linux.vnet.ibm.com>



On 11/29/2017 08:33 PM, Thomas-Mich Richter wrote:
> On 11/29/2017 02:24 PM, Ravi Bangoria wrote:
>>
>> On 11/28/2017 01:26 PM, Thomas Richter wrote:
>>> The command 'perf annotate' parses the output of objdump and also
>>> investigates the comments produced by objdump. For example the
>>> output of objdump produces (on x86):
>>>
>>> 23eee:  4c 8b 3d 13 01 21 00 mov 0x210113(%rip),%r15
>>>                                 # 234008 <stderr@@GLIBC_2.2.5+0x9a8>
>>>
>>> and the function mov__parse() is called to investigate the complete
>>> line. Mov__parse() breaks this line into several parts and finally
>>> calls function comment__symbol() to parse the data after the comment
>>> character '#'. Comment__symbol() expects a hexadecimal address followed
>>> by a symbol in '<' and '>' brackets.
>>>
>>> However the 2nd parameter given to function comment__symbol()
>>> always points to the comment character '#'. The address parsing
>>> always returns 0 because the character '#' is not a digit and
>>> strtoull() fails without being noticed.
>>>
>>> Fix this by advancing the second parameter to function comment__symbol()
>>> by one byte before invocation and add an error check after strtoull()
>>> has been called.
>> Yeah, looks like it fails to get correct value in 'addrp'.
>>
>> Can you please show the difference in perf annotate output before
>> and after patch.
>>
>> Thanks,
>> Ravi
>>
>
> There is no difference in output of --stdio. The adress value is not
> read and remains 0x0 in ops->source.addr or ops->target.addr.
> That is not visible because in function mov__scnprintf() that wrong
> address is not printed:
>
> static int mov__scnprintf(struct ins *ins, char *bf, size_t size,
>                            struct ins_operands *ops)
> {
>         return scnprintf(bf, size, "%-6.6s %s,%s", ins->name,
>                          ops->source.name ?: ops->source.raw,
>                          ops->target.name ?: ops->target.raw);
> }

Looks good.  Ack-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>

Thanks,
Ravi

  reply	other threads:[~2017-11-29 15:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28  7:56 [PATCH] perf annotate: Fix objdump comment parsing for Intel mov dissassembly Thomas Richter
2017-11-29 13:24 ` Ravi Bangoria
2017-11-29 15:03   ` Thomas-Mich Richter
2017-11-29 15:22     ` Ravi Bangoria [this message]
2017-11-30 19:20       ` Arnaldo Carvalho de Melo

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=9c33e7e2-9101-27fa-d1f4-cbdb4777fcc5@linux.vnet.ibm.com \
    --to=ravi.bangoria@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tmricht@linux.vnet.ibm.com \
    /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).