Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Johannes Stoelp <Johannes.Stoelp@synopsys.com>
To: Yao Qi <qiyaoltc@gmail.com>,
	Johannes Stoelp	<Johannes.Stoelp@synopsys.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>,
	Andreas Ropers <Andreas.Ropers@synopsys.com>,
	Marc Mones <Marc.Mones@synopsys.com>,
	"Kai  Schuetz" <Kai.Schuetz@synopsys.com>,
	Johannes Stoelp <Johannes.Stoelp@synopsys.com>
Subject: RE: Infinite Stack Unwinding ARM
Date: Fri, 07 Apr 2017 07:15:00 -0000	[thread overview]
Message-ID: <6ECCE8A0904A1643BE093611EF2098CE01475738@DE02WEMBXB.internal.synopsys.com> (raw)
In-Reply-To: <86pogrp0vj.fsf@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1671 bytes --]

Yao Qi <qiyaoltc@gmail.com> writes:

> I don't expect prologue analyzer supporting SYSRegs and instruction MRS.  All the prologue analyzers in GDB are written in a way that understanding instructions according to the ABI/calling convention of each architecture and  compiler's behavior, so it should be able to parse the instruction in prologues complying to the ABI.  GDB prologue analyzer may not understand what does handwritten assembly do.


Hi Yao,

I see what you are saying about the prologue analyzer and the ABI/calling conventions. 

I understand that gdb does not have to understand every hand written assembler routine, but I would like to emphasize that gdb in this particular case ends in an "infinite" loop printing the backtrace line by line (I put infinite in quotes because the loop is limited by the lower boundary of an integer). 
I would expect gdb to be more defensive in this case and either try other unwinding techniques like backward unwinding (from bottom up) or just stop unwinding because of to less information.
In my understanding situations like this can also occur when the stack gets corrupted. There I would also expect gdb to not end in an infinite loop since gdb is intended to analyze the non-expected situation.

One other question that came up by comparing the arm and the aarch64 analyzer:
    * Is there a special reason/trick why the arm analyzer (gdb/arm-tdep.c:arm_analyze_prologue(...)) skips instructions that it doesn't recognize while the aarch64 analyzer (gdb/aarch64-tdep.c:aarch64_prologue_analyzer(...)) stops when the first unrecognized instruction is hit?

Best,
Johannes 
 
\x16º&ÖëzÛ«ŸŽ{ÓÙb²Ö«r\x18\x1d

  reply	other threads:[~2017-04-07  7:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 12:54 Johannes Stoelp
2017-04-05 11:09 ` Yao Qi
2017-04-07  7:15   ` Johannes Stoelp [this message]
2017-04-08  5:00     ` Duane Ellis
2017-04-10 12:01     ` Yao Qi
2017-04-11 16:20       ` Johannes Stoelp

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=6ECCE8A0904A1643BE093611EF2098CE01475738@DE02WEMBXB.internal.synopsys.com \
    --to=johannes.stoelp@synopsys.com \
    --cc=Andreas.Ropers@synopsys.com \
    --cc=Kai.Schuetz@synopsys.com \
    --cc=Marc.Mones@synopsys.com \
    --cc=gdb@sourceware.org \
    --cc=qiyaoltc@gmail.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