public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "luis.machado at linaro dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug backtrace/27987] aarch64 prologue unwinder does not correctly handle -fpatchable-function-entry=2 flag
Date: Tue, 29 Jun 2021 14:00:33 +0000	[thread overview]
Message-ID: <bug-27987-4717-mmMjumKZ1L@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27987-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27987

Luis Machado <luis.machado at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2021-06-29

--- Comment #4 from Luis Machado <luis.machado at linaro dot org> ---
On a brief look, it may not be the prologue analyzer's fault. When using
"-fpatchable-function-entry=N,M", the entry point of the function is populated
with N nops, and the entry point will point at the (M - 1)-th nop. The function
symbol's address is adjusted to reflect this, but the DWARF information for the
function symbol is not.

objdump output:

00000000000010ec <t_small_values>:
    10ec:       d503201f        nop
    10f0:       d503201f        nop
    10f4:       d503201f        nop
    10f8:       d503201f        nop
    10fc:       d100c3ff        sub     sp, sp, #0x30


DWARF:

 <1><c63>: Abbrev Number: 26 (DW_TAG_subprogram)
    <c64>   DW_AT_external    : 1
    <c64>   DW_AT_name        : (indirect string, offset: 0x1e77):
t_small_values
    <c68>   DW_AT_decl_file   : 1
    <c69>   DW_AT_decl_line   : 288
    <c6b>   DW_AT_decl_column : 1
    <c6c>   DW_AT_type        : <0x3f>
    <c70>   DW_AT_low_pc      : 0x10fc
    <c78>   DW_AT_high_pc     : 0xb8
    <c80>   DW_AT_frame_base  : 1 byte block: 9c        (DW_OP_call_frame_cfa)
    <c82>   DW_AT_GNU_all_call_sites: 1
    <c82>   DW_AT_sibling     : <0xd27>


Notice how DW_AT_low_pc points at 0x10fc, the first real instruction of the
function.

I'm not sure if this is by design, but anything coming before the real entry
point to the function will be ignored by GDB's prologue analyzer.

GDB may need to handle patchable functions in a better way, but this may hint
at a problem in GCC's DWARF generation. If GCC didn't choose to not emit the
adjusted DT_AT_low_pc by design, that is.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-06-29 14:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 15:39 [Bug backtrace/27987] New: " ctice42 at gmail dot com
2021-06-16 15:44 ` [Bug backtrace/27987] " ctice42 at gmail dot com
2021-06-25 13:01 ` luis.machado at linaro dot org
2021-06-26  6:28 ` ctice42 at gmail dot com
2021-06-28 17:52 ` luis.machado at linaro dot org
2021-06-29 14:00 ` luis.machado at linaro dot org [this message]
2021-06-29 14:34 ` luis.machado at linaro dot org
2021-06-29 17:07 ` luis.machado at linaro dot org
2021-06-29 17:08 ` luis.machado at linaro dot org

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=bug-27987-4717-mmMjumKZ1L@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).