From patchwork Wed Jun 8 13:30:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 69649 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2508548qgf; Wed, 8 Jun 2016 06:54:54 -0700 (PDT) X-Received: by 10.140.137.136 with SMTP id 130mr4785908qhj.100.1465394094833; Wed, 08 Jun 2016 06:54:54 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d207si721221qkg.81.2016.06.08.06.54.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:54:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdwc-0000ts-7k for patch@linaro.org; Wed, 08 Jun 2016 09:54:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZT-0004M2-Iz for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZR-0005nf-D0 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:58 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:33692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZR-0005nW-5Z for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:57 -0400 Received: by mail-lf0-x234.google.com with SMTP id s64so5904737lfe.0 for ; Wed, 08 Jun 2016 06:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DYAJY32M/+s34fQf3Uti+Uw1e5x04tNPsCFEX3/9b4E=; b=kS81cb3RrKnrtyMTpY2Ms85aBa7FdshFP8qzSni93VPsAcXRyE/LqSG9aGGv68v7zN R5fZ858MdfCFc5ZqckFbis63Zw26fZ8toGntrhOCLO/j+yuURrDd61Gtb14VqrEEGLKj uN3nGRat0W+fzXnt1771nvfBkiYiNxkSOhUfE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DYAJY32M/+s34fQf3Uti+Uw1e5x04tNPsCFEX3/9b4E=; b=HuS73bZ/02IhLkBNeCIv2rSZ0A3PEuaJQwNoyzcVL9siB1h9LF+KL70RP/rbVtksqk InnopUBk/APCzUV2dpli+Wpl1ygkJIESHQ7DLIXJvoDuFMlyTRMg71xrnOHH2KS4vt5z ZEjBrVfvRp+Ewr6KwxmK1WMf8ierys6+ve2odIRBGm4qgQR4WwsTfOFdlitbXHfq8k8M JPgDj6hR/JFLRPD+azAuBu7yZ5k4o+jgLgavTD5KWXPdZuuhmqxvZnGj7lqImV5+I7/r QP2s46KrXA12/otr//QxAERQvT4bpEklsnt4P5nnz5knyKoTYO2q4EgQRUDE46myWaVk yPzQ== X-Gm-Message-State: ALyK8tII1p4hdkgxVGmPmtGafckycOlbxvmy7o3cQ/zhUhLjJMzE3510uUkVJHyLjrMqxfBY X-Received: by 10.46.9.11 with SMTP id 11mr1390243ljj.5.1465392656283; Wed, 08 Jun 2016 06:30:56 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.30.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:30:55 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:05 +0300 Message-Id: <9e024732f53b368abdd578e1795bf3d2779ea88a.1465392531.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::234 Subject: [Qemu-devel] [PULL 24/44] linux-user: provide frame information in x86-64 safe_syscall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Use cfi directives in the x86-64 safe_syscall to allow gdb to get backtraces right from within it. (In particular this will be quite a common situation if the user interrupts QEMU while it's in a blocked safe-syscall: at the point of the syscall insn RBP is in use for something else, and so gdb can't find the frame then without assistance.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Riku Voipio --- linux-user/host/x86_64/safe-syscall.inc.S | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.1.4 diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/linux-user/host/x86_64/safe-syscall.inc.S index dde434c..e09368d 100644 --- a/linux-user/host/x86_64/safe-syscall.inc.S +++ b/linux-user/host/x86_64/safe-syscall.inc.S @@ -24,6 +24,7 @@ * -1-and-errno-set convention is done by the calling wrapper. */ safe_syscall_base: + .cfi_startproc /* This saves a frame pointer and aligns the stack for the syscall. * (It's unclear if the syscall ABI has the same stack alignment * requirements as the userspace function call ABI, but better safe than @@ -31,6 +32,8 @@ safe_syscall_base: * does not list any ABI differences regarding stack alignment.) */ push %rbp + .cfi_adjust_cfa_offset 8 + .cfi_rel_offset rbp, 0 /* The syscall calling convention isn't the same as the * C one: @@ -70,12 +73,19 @@ safe_syscall_start: safe_syscall_end: /* code path for having successfully executed the syscall */ pop %rbp + .cfi_remember_state + .cfi_def_cfa_offset 8 + .cfi_restore rbp ret return_ERESTARTSYS: /* code path when we didn't execute the syscall */ + .cfi_restore_state mov $-TARGET_ERESTARTSYS, %rax pop %rbp + .cfi_def_cfa_offset 8 + .cfi_restore rbp ret + .cfi_endproc .size safe_syscall_base, .-safe_syscall_base