mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Re: [PATCH] generate debug_frame info for __syscall_cp_asm (i386) so gdb can get backtrace
Date: Wed, 29 Apr 2015 11:57:03 -0400	[thread overview]
Message-ID: <20150429155703.GV17573@brightrain.aerifal.cx> (raw)
In-Reply-To: <20150429144618.GA12549@alex-ThinkPad-L530>

On Wed, Apr 29, 2015 at 04:46:18PM +0200, Alex Dowad wrote:
> On Mon, 27 Apr 2015 16:57:22 -0400, Rich Felkner wrote:
> > This has been requested before, but it really uglifies the asm and
> > makes it unreadable. Do you have any ideas for mitigating the problem?
> 
> Perhaps using PUSH() and POP() macros which automatically add .cfi_*
> directives?

The reason I don't like solutions like this is that anyone reading the
code immediately wonders what those macros are and whether there is
important functionality hidden in them that's obscuring what the code
is doing. I know that's my first thought when I see asm (or C) written
like that.

Also this is rather x86-specific; many other archs don't have/use
push/pop instructions.

> > Another idea would be programmatically generating the cfi from the asm
> > with a script that runs at compile-time, and passing the output of the
> > script to the assembler. One benefit of this approach is that it could
> > be tuned based on whether -g is in use or not. With hard-coded .cfi_*
> > I don't see a clear way to suppress it when -g is not in use.
> 
> Conditionally defining the PUSH() and POP() macros to omit the .cfi_*
> stuff when debugging is disabled?
> 
> Of course using a script to parse the asm is SO much more slick... but
> you probably don't want to add too many dependencies to your build process
> either. Would it have to be just a plain shell script?

It would be either sed or awk most likely. Plain shell would work for
writing it too but would probably be uglier, and sed is already
required anyway for alltypes.h generation. If any new tool were
required (unlikely) then configure would just detect its absence and
turn off cfi generation for asm if it's missing/broken.

Rich


  reply	other threads:[~2015-04-29 15:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 14:46 Alex Dowad
2015-04-29 15:57 ` Rich Felker [this message]
2015-04-29 16:51 Alex Dowad
2015-04-29 17:03 ` Rich Felker

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=20150429155703.GV17573@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).