public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@imgtec.com>
To: <Paul_Koning@Dell.com>
Cc: <tom@tromey.com>, <qiyaoltc@gmail.com>, <gdb-patches@sourceware.org>
Subject: Re: [RFA 5/6] Remove unused variables
Date: Thu, 21 Jul 2016 23:41:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.00.1607220005340.4076@tp.orcam.me.uk> (raw)
In-Reply-To: <261F6870-E91C-4747-8B21-10493AD8550C@dell.com>

On Wed, 20 Jul 2016, Paul_Koning@Dell.com wrote:

> > Overall with recent and less so improvements to GCC's and other 
> > compilers' optimizers I think these heuristic unwinders have hardly any 
> > value nowadays, they seem unable to get through function prologues 
> > containing arbitrary instructions thrown there by the scheduler.  This is 
> > very annoying in a common case where you interrupt a debuggee in the 
> > middle of a sleeping syscall, with no way to backtrace through stripped 
> > system shared libraries.
> 
> My experience is that the heuristic unwinders can be made to handle a 
> lot of what's thrown at them now, but it takes quite a lot of extra 
> heuristics to do so.  I have much of this on an internal version.  
> Should I look into making them available?

 Absolutely!

> One thing I've done that may not be generally interesting: make the 
> unwinders work in the kernel (NetBSD) and able to unwind across 
> exception frames so you can use kernel debugging and see the stack all 
> the way into the calling process.  I haven't found this all that 
> interesting in online debugging, but it has sometimes been useful in 
> analyzing kernel crash dumps.

 I think it's a separate matter -- and for post-mortem debugging (and even 
live debugging e.g. with QEMU's integrated debug stub or if you're a lucky 
one who has JTAG probe hardware to hand) you can actually implement an 
exception frame sniffer/unwinder so that GDB can examine it automagically.  
As an example see mips-sde-tdep.c, handling exception frames from the old 
Algorithmics/MTI SDE toolkit/board support package.  If you'd like to add 
a similar handler for the NetBSD kernel, then I'll gladly accept it.

 In a typical user app debug scenario you have cases where you want to 
interrupt the program and see where it is, examine its local state, often 
in the function that made the C library call which ended up in the syscall 
just interrupted.  In the absence of either debug information all the way 
through the syscall's entry point or special support it does not work 
however with ABIs such as these used with the MIPS processor, where the 
structure of the stack frame is variable and you cannot backtrace by just 
taking the value from the frame pointer register and using it recursively 
to fetch previous frame pointers from the stack.

 Unlike say with x86 or Power, where you may not be able to get complete 
information about the innermost or some intermediate frames, but at least 
you can backtrace far enough to reach a frame associated with a function 
from your actual program being debugged and be able to fully examine the 
state there as well as within any previous frames.

 Based on my personal experience with debugging software I think it is a 
serious shortcoming of the MIPS backend, so if you have a way to improve 
the current situation, then by any means please share it and make people's 
life easier.  It'll be a huge step forward even if sometime in the future 
we may get ourselves other means, such as what I have outlined in my 
previous e-mail or maybe yet something else.

  Maciej

  reply	other threads:[~2016-07-21 23:41 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 21:34 [RFA 0/6] Add -Wunused-but-set-parameter and -Wunused-but-set-variable Tom Tromey
2016-06-06 21:34 ` [RFA 4/6] Remove some variables but call functions for side effects Tom Tromey
2016-06-28 14:41   ` Yao Qi
2016-06-06 21:34 ` [RFA 5/6] Remove unused variables Tom Tromey
2016-06-28 14:50   ` Yao Qi
2016-06-28 20:57     ` Tom Tromey
2016-06-29  8:50       ` Yao Qi
2016-07-13 20:43         ` Tom Tromey
2016-07-14  7:30           ` Yao Qi
2016-07-20 18:37           ` Maciej W. Rozycki
2016-07-20 18:46             ` Paul_Koning
2016-07-21 23:41               ` Maciej W. Rozycki [this message]
2016-07-20 19:49             ` Tom Tromey
2016-07-25 13:36               ` Maciej W. Rozycki
2016-06-06 21:34 ` [RFA 1/6] Change reopen_exec_file to check result of stat Tom Tromey
2016-06-28 14:21   ` Yao Qi
2016-06-06 21:34 ` [RFA 3/6] Comment out some unused overlay code Tom Tromey
2016-06-28 14:36   ` Yao Qi
2016-06-28 20:56     ` Tom Tromey
2016-06-29  8:51       ` Yao Qi
2016-06-06 21:34 ` [RFA 2/6] Use ATTRIBUTE_UNUSED in some places Tom Tromey
2016-06-28 18:26   ` Pedro Alves
2016-06-28 20:58     ` Tom Tromey
2016-06-29  9:50       ` Pedro Alves
2016-06-06 21:34 ` [RFA 6/6] Add -Wunused-but-set-* to build Tom Tromey
2016-06-08  2:30   ` Trevor Saunders
2016-06-08  2:46     ` Tom Tromey
2016-06-08  3:18       ` Trevor Saunders
2016-06-08  3:43         ` Tom Tromey
2016-06-08  4:16           ` Tom Tromey
2016-06-08  4:26             ` Trevor Saunders
2016-06-28 15:02 ` [RFA 0/6] Add -Wunused-but-set-parameter and -Wunused-but-set-variable Yao Qi
2016-07-12 17:07   ` Tom Tromey
2016-07-13 13:45     ` Yao Qi
2016-07-14 16:49       ` Tom Tromey
2016-07-21 10:38   ` Pedro Alves
2016-07-21 11:10     ` Yao Qi
2016-07-21 11:35       ` Pedro Alves
2016-07-21 11:38         ` [PATCH 2/2] Remove unused variable in windows-nat.c Pedro Alves
2016-07-21 14:03           ` Yao Qi
2016-07-21 14:31             ` Pedro Alves
2016-07-21 11:38         ` [PATCH 1/2] Remove unused variable in gdb/varobj.c when built without Python support Pedro Alves
2016-07-21 14:01           ` Yao Qi
2016-07-21 14:31             ` Pedro Alves
2016-07-21 11:56         ` [RFA 0/6] Add -Wunused-but-set-parameter and -Wunused-but-set-variable Pedro Alves
2016-07-21 12:16           ` Pedro Alves
2016-07-21 14:47             ` Pedro Alves
2016-07-21 15:18               ` Pedro Alves
2016-07-21 16:38                 ` Yao Qi
2016-07-21 19:22                   ` Tom Tromey

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=alpine.DEB.2.00.1607220005340.4076@tp.orcam.me.uk \
    --to=macro@imgtec.com \
    --cc=Paul_Koning@Dell.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    --cc=tom@tromey.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 read-only IMAP folder(s) and NNTP newsgroup(s).