From: "Maciej W. Rozycki" <macro@imgtec.com>
To: Tom Tromey <tom@tromey.com>
Cc: Yao Qi <qiyaoltc@gmail.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA 5/6] Remove unused variables
Date: Wed, 20 Jul 2016 18:37:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.00.1607201848070.4076@tp.orcam.me.uk> (raw)
In-Reply-To: <87furdnubd.fsf@tromey.com>
On Wed, 13 Jul 2016, Tom Tromey wrote:
> commit c097ec493b76209e6cf830ffca9b36fe2c2643fc
> Author: Tom Tromey <tom@tromey.com>
> Date: Mon Jun 6 14:18:30 2016 -0600
>
> Remove unused variables
>
> This patch removes set-but-unused variables. This holds all the
> removals I consider to be simple and relatively uncontroversial.
I see you got to committing it actually now, before I got to the MIPS
part (sorry about it), already proposed by Trevor Saunders previously BTW.
> 2016-07-13 Tom Tromey <tom@tromey.com>
>
> * mips-tdep.c (micromips_scan_prologue): Remove "frame_addr".
> (mips_o32_push_dummy_call): Remove "stack_used_p".
TBH I disagree the changes to `micromips_scan_prologue' are
uncontroversial -- it looks to me like the presence of `frame_addr',
clearly copied over from `mips32_scan_prologue', is a sign of broken
virtual frame pointer tracking code, which has not been completed for
frames produced by microMIPS code. Obviously they need to follow the same
rules WRT `alloca' calls as frames made with regular MIPS code, as there's
nothing special defined in the ABI for microMIPS code.
Of course one could argue that keeping broken code (though in a manner
harmless to irrelevant cases) has little value, but at least it serves as
a reminder to do something about it sometime. I'll see if I can add the
missing piece regardless sometime, though regrettably I can't give it a
high priority.
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.
What I think could work is combining PDR records with reduced heuristic
unwinders, which in that case do not actually need to search for frame
offsets as they're already provided in PDR records. So for non-leaf
frames there's really nothing to do beyond interpreting these records,
because by the time a nested function call has been made, the caller's
frame has already been fully populated.
For leaf frames it's a tad more complicated, because the records do not
carry information as to where in the prologue individual slots are
initialised (i.e. registers stored). But for that you do not have to
teach the unwinder of the whole instruction set, it just needs to know
these actually used for register saves, which there are a small number
only. And the frame offset does not have to be decoded from the
instruction stream either, as it's already in the PDR record.
One could argue DWARF records are the modern and therefore natural choice
for this, but typically they're gone with stripping unless special care is
taken and records are removed selectively. I doubt such care is taken in
the field on a regular basis -- i.e. people just run `strip' or maybe even
`gcc -s', or use the `install-strip' Makefile target, which again just
boils down to `strip' typically -- though I'd be happy to be proved wrong.
PDR records are always kept OTOH and they are really tiny, so they don't
consume much disk space either. Unlike DWARF records they're also usually
present even in handcoded assembly, as they're set up with the `.frame',
`.mask' and `.fmask' pseudo-ops, the former of which is actually required
for MIPS PIC code to assemble at all, and PDR generation is on by default
in GAS. The only drawback is some toolchain configurations may disable
them explicitly with the `-mno-pdr' GAS option in the GCC driver.
NB, on the contrary the changes to `mips_o32_push_dummy_call' look good
to me as they stand, without reservation.
FWIW,
Maciej
next prev parent reply other threads:[~2016-07-20 18:37 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 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 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 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 [this message]
2016-07-20 18:46 ` Paul_Koning
2016-07-21 23:41 ` Maciej W. Rozycki
2016-07-20 19:49 ` Tom Tromey
2016-07-25 13:36 ` Maciej W. Rozycki
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-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-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 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: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: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.1607201848070.4076@tp.orcam.me.uk \
--to=macro@imgtec.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