From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7552 Path: news.gmane.org!not-for-mail From: Timo Teras Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] generate debug_frame info for __syscall_cp_asm (i386) so gdb can get backtrace Date: Wed, 29 Apr 2015 10:46:41 +0300 Message-ID: <20150429104641.57185766@vostro> References: <1430134355-10228-1-git-send-email-alexinbeijing@gmail.com> <20150427205722.GG17573@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1430293686 4661 80.91.229.3 (29 Apr 2015 07:48:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Apr 2015 07:48:06 +0000 (UTC) Cc: musl@lists.openwall.com To: Rich Felker Original-X-From: musl-return-7565-gllmg-musl=m.gmane.org@lists.openwall.com Wed Apr 29 09:48:06 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YnMix-0005uT-6q for gllmg-musl@m.gmane.org; Wed, 29 Apr 2015 09:48:03 +0200 Original-Received: (qmail 23749 invoked by uid 550); 29 Apr 2015 07:48:01 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 23705 invoked from network); 29 Apr 2015 07:48:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=aWNcaHBUIQndfbIfgfibNUfIGJXHNXjW38M0kLB1YiM=; b=s7n3smmEBTLJKJF5eXa2oHlxRRty3srYH1ghNL/Vk3uNdUkLwiggOhztNS2ZKciL1h 5d1ItLiRSU/CDMJkOhqwVafpvj0LEP+98UZ69VXFxm/sSKc8kh7uKLMvm8pYCitV9bsE Bu8/0gWhOgBna7H9MDCjM1bu9QazjMG8SoB/4eUuEVkByxL0yERuOrAcczYG6uQu4kwp qqqcHrp7rgdxPSRTEt1EhA6K6WL5uisVq5R+BQG8I8PSfXzFX7a8YUBcnM1lQuByCy19 zOMJh0cR8hzG5cpq4baQBCEamuHSQ0t+jakjPxL3PS0LlRjSqklCkjTyTTjS8w6F1TNu 84bg== X-Received: by 10.112.93.72 with SMTP id cs8mr17867848lbb.15.1430293669819; Wed, 29 Apr 2015 00:47:49 -0700 (PDT) Original-Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= In-Reply-To: <20150427205722.GG17573@brightrain.aerifal.cx> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-alpine-linux-musl) Xref: news.gmane.org gmane.linux.lib.musl.general:7552 Archived-At: On Mon, 27 Apr 2015 16:57:22 -0400 Rich Felker wrote: > On Mon, Apr 27, 2015 at 01:32:35PM +0200, Alex Dowad wrote: > > Please have a look at this patch, and CC me on any discussion. > > (I've never worked on musl before and haven't joined the mailing > > list.) Your feedback will be appreciated. (Just to let you know, I > > have build-tested this code and tried it in gdb.) > > > > If you would like to add similar stack frame debug information to > > other asm functions, I would be happy to send more patches. The CFI > > directives can be made more concise using asm macros if desired. > > This has been requested before, but it really uglifies the asm and > makes it unreadable. Do you have any ideas for mitigating the problem? > > One possibility would be omitting instruction-grained cfi and just > having enough to produce meaningful information when blocked at the > syscall. That's what's actually going to matter in practice for > debugging. But that's not very elegant. > > 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. .cfi_sections directive can be used to say if it should go to .eh_frame, .debug_frame or both. Tuning that right, strip should be able to get rid of the excess baggage. I'd at least arm the syscall, and the startup code with manual .cfi stuff for debugging purposes. If we want to do universal .cfi annotations for all asm, it'd make sense to have some programmatic way to generate it. But I'd really appreciate having usable backtraces. Thanks, Timo