From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8647 Path: news.gmane.org!not-for-mail From: Alex Dowad Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 2/3] fix matching errors related to i386 addressing modes in CFI generation script Date: Mon, 12 Oct 2015 15:58:59 +0200 Message-ID: <1444658340-10065-2-git-send-email-alexinbeijing@gmail.com> References: <1444658340-10065-1-git-send-email-alexinbeijing@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1444658376 7050 80.91.229.3 (12 Oct 2015 13:59:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Oct 2015 13:59:36 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8659-gllmg-musl=m.gmane.org@lists.openwall.com Mon Oct 12 15:59:35 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 1ZlddV-0003gs-Te for gllmg-musl@m.gmane.org; Mon, 12 Oct 2015 15:59:34 +0200 Original-Received: (qmail 20017 invoked by uid 550); 12 Oct 2015 13:59:30 -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 19591 invoked from network); 12 Oct 2015 13:59:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=lRpTMmLg/GwJ/zahYCvbMFIaX2JQgLOWe6jMGFMu8oo=; b=TAVnKK6ec0KjnXXa0TLUM8I4ec5lzIOh5t5+wtQfWiiZKu8Tga4P6dcpLdlmucTMs/ 5N4+wU+hMHKJjxiA54uWafJZr+UDH6cHck+x0VpTAF2FmGZ0DZfsWRsFMRlb2LpUVMVd /8uPqXZcn6Koj6plKKPuTTVgHBXsDnyoNx43sY4Bi6XqQP6MuMkRAP7qRglIlijz4P3H eja2shLPZtMUXQNe4iXkKO+V+Zo0HJ+++lyv9pjSc1HmfDVS/4mEmF74plwuokkiz8oE lLj8fcQpedn1sFRzaHXl1qKRBrK//giFov4+iH5nzTpXBKOys1SaoUaTi+yksVnTxDON +iig== X-Received: by 10.194.239.104 with SMTP id vr8mr30615232wjc.72.1444658348287; Mon, 12 Oct 2015 06:59:08 -0700 (PDT) X-Mailer: git-send-email 2.0.0.GIT In-Reply-To: <1444658340-10065-1-git-send-email-alexinbeijing@gmail.com> Xref: news.gmane.org gmane.linux.lib.musl.general:8647 Archived-At: the regexps previously used to identify registers clobbered by MOVs, ADDs, and various other operations would erroneously match index registers. In other words, the following asm: mov $0, (%eax,%ebx,4) ...would cause EBX to be considered as overwritten, which might prevent a debugger from displaying a variable's value in a higher stack frame. thanks to Rich Felker for noticing this problem. --- tools/add-cfi.i386.awk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/add-cfi.i386.awk b/tools/add-cfi.i386.awk index fc0d8cf..bd7932f 100644 --- a/tools/add-cfi.i386.awk +++ b/tools/add-cfi.i386.awk @@ -184,13 +184,13 @@ function trashed(register) { } # this does NOT exhaustively check for all possible instructions which could # overwrite a register value inherited from the caller (just the common ones) -/mov.*,%e(ax|bx|cx|dx|si|di|bp)/ { trashed(get_reg2()) } -/(add|addl|sub|subl|and|or|xor|lea|sal|sar|shl|shr).*,%e(ax|bx|cx|dx|si|di|bp)/ { +/mov.*,%e(ax|bx|cx|dx|si|di|bp)$/ { trashed(get_reg2()) } +/(add|addl|sub|subl|and|or|xor|lea|sal|sar|shl|shr).*,%e(ax|bx|cx|dx|si|di|bp)$/ { trashed(get_reg2()) } -/^i?mul [^,]*$/ { trashed("eax"); trashed("edx") } -/^i?mul.*,%e(ax|bx|cx|dx|si|di|bp)/ { trashed(get_reg2()) } -/^i?div/ { trashed("eax"); trashed("edx") } +/^i?mul [^,]*$/ { trashed("eax"); trashed("edx") } +/^i?mul.*,%e(ax|bx|cx|dx|si|di|bp)$/ { trashed(get_reg2()) } +/^i?div/ { trashed("eax"); trashed("edx") } /(dec|inc|not|neg|pop) %e(ax|bx|cx|dx|si|di|bp)/ { trashed(get_reg()) } /cpuid/ { trashed("eax"); trashed("ebx"); trashed("ecx"); trashed("edx") } -- 2.0.0.GIT