From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27613 invoked by alias); 15 Apr 2016 14:30:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 27556 invoked by uid 89); 15 Apr 2016 14:30:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=criterion, HX-Received:10.66.78.73, yao.qi@linaro.org, yaoqilinaroorg X-HELO: mail-pa0-f41.google.com Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 15 Apr 2016 14:29:56 +0000 Received: by mail-pa0-f41.google.com with SMTP id fs9so37088436pac.2 for ; Fri, 15 Apr 2016 07:29:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=Me90C80Xo8mcytgYgkw/dYtwH4ZpwDzLUiKlR1Ao/1c=; b=Ahu4h+s2wnPHeIZz6IgxBazTD93yGS4UwRqkj3dYNI6OHbF1zVay6H9TODv3wuPZJ3 9dCX/L94AldEA1dKTWYVyi8WRNr7556oyhRQwsu6YveZYSlzWC+n1NLoKrabAeFyi6PH c2xZtOeXOthOYhg/ZnkuNQzUZvhSL7Z68nXQih1oGtHWYjzAljAod+Nlnp2TxOI0PV0U UCxg6aRN9amiX8Sz2zui01V/oyVCwTfwCrdGaX5C7KOB3sjRZRirdsadwhrJEd3pLryj CuqyrfA9nSZX5e0oLIall7RhuaLr5qSsnvYhH+EUE399oROKpz3p5ofF2y1YyumULTAz K05g== X-Gm-Message-State: AOPr4FWpBJdXC7UrLnHkorrY652J4rrigs/aCec+tRsg2xoqT3hvTBlih1JM0HbJcHS6Gg== X-Received: by 10.66.78.73 with SMTP id z9mr11665734paw.4.1460730594983; Fri, 15 Apr 2016 07:29:54 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id wy7sm65372359pab.5.2016.04.15.07.29.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Apr 2016 07:29:54 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] [ARM] minor opt in thumb_stack_frame_destroyed_p Date: Fri, 15 Apr 2016 14:30:00 -0000 Message-Id: <1460730578-28723-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00357.txt.bz2 thumb_stack_frame_destroyed_p scans the instructions from PC to the end of the function, but if PC is far from the end of pc, we don't have to scan, because PC should be in epilogue if it is still far from the end of the function. The criterion I use here is 16 bytes, which is more than 4 instructions. Regression tested on aarch64-linux with mutli-arch debug. I'll push it in. gdb: 2016-04-15 Yao Qi * arm-tdep.c (thumb_stack_frame_destroyed_p): Return zero if PC is far from the end of function. --- gdb/ChangeLog | 5 +++++ gdb/arm-tdep.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 09937a9..e85023e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-04-15 Yao Qi + + * arm-tdep.c (thumb_stack_frame_destroyed_p): Return zero if + PC is far from the end of function. + 2016-04-14 Pedro Alves * cli/cli-cmds.c (alias_usage_error): New function. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index fb698a4..02e66e5 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -3135,6 +3135,14 @@ thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) if (!find_pc_partial_function (pc, NULL, &func_start, &func_end)) return 0; + if (func_end - pc > 4 * 4) + { + /* There shouldn't be more than four instructions in epilogue. + If PC is still 16 bytes away from FUNC_END, it isn't in + epilogue. */ + return 0; + } + /* The epilogue is a sequence of instructions along the following lines: - add stack frame size to SP or FP -- 1.9.1