From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108487 invoked by alias); 16 Oct 2017 11:50:36 -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 107628 invoked by uid 89); 16 Oct 2017 11:50:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS,UNSUBSCRIBE_BODY autolearn=ham version=3.3.2 spammy=forgot, H*r:sk:static. X-HELO: mail-wm0-f65.google.com Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Oct 2017 11:50:34 +0000 Received: by mail-wm0-f65.google.com with SMTP id k4so2401188wmc.1 for ; Mon, 16 Oct 2017 04:50:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LnR9ll8v4Q+VFc030Ktiqid5jfpj44A4KuQ7VIHYsXg=; b=dIZEADOJxNlkFNr7+Yck8QEE65DpRy3kdeD5KAc85qOCyC5TeLvuTRYZmbJiwLD/sF gQigY5yL7Po+tl6JYPYcoN8OCIQDkK+uh7Oz9iyG4WAMKrcrjNF0SGyQ4rUfrqUtC35P VyAooHZYZy8fgalQOqy/GGZYLM5TzRZujnAC5O1SYN0N668t6mebe6RMDCLfU8bexmRr 941rPlj69lymBql4y9lu8HAcg4D9Hone2MfL1TD/Ukualy8J0b7HUk9uxz/p3x75F/bf njlwWlMNUl26rFCqnaawGf3xmzt5mM7aUzX0ofRohKgohPzntAYjChdsS1uK4PRVDLsP t4Xw== X-Gm-Message-State: AMCzsaUStlGAy4zPh1Z8uKPKAC+OYSEWFQ15JzoaVfH18DLmDOdtOuta Reip6aLhKYY8YwU7MIxbm8y0yw== X-Google-Smtp-Source: ABhQp+T2fKWWrZE1eATmAjZkL6S0zj0vGgzCAlLKFhysexy8ajO6rQlaGTzsk+dBrtfZHwBM2clg0A== X-Received: by 10.223.151.198 with SMTP id t6mr392433wrb.2.1508154632526; Mon, 16 Oct 2017 04:50:32 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id l19sm8371759wre.26.2017.10.16.04.50.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Oct 2017 04:50:31 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Cc: sandra@codesourcery.com Subject: [PATCH] Fix PR 8841 for nios2-linux Date: Mon, 16 Oct 2017 11:50:00 -0000 Message-Id: <1508154626-389-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00434.txt.bz2 This patch is to use gdbarch method code_of_frame_writable, to skip signal trampoline frame for breakpoint setting on nios2-linux. The patch was written last year, but forgot to upstream it. I don't have the env to test this patch, so Sandra could you try this patch? gdb: 2017-10-16 Yao Qi PR gdb/8841 * nios2-linux-tdep.c (nios2_linux_code_of_frame_writable): New function. (nios2_linux_init_abi): Install gdbarch code_of_frame_writable. --- gdb/nios2-linux-tdep.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c index 8cada54..788d711 100644 --- a/gdb/nios2-linux-tdep.c +++ b/gdb/nios2-linux-tdep.c @@ -185,6 +185,22 @@ static struct tramp_frame nios2_r2_linux_rt_sigreturn_tramp_frame = nios2_linux_rt_sigreturn_init }; +/* Implement the code_of_frame_writable gdbarch method. */ + +static int +nios2_linux_code_of_frame_writable (struct gdbarch *gdbarch, + struct frame_info *frame) +{ + if (get_frame_type (frame) == SIGTRAMP_FRAME) + { + /* The kernel creates a signal trampoline at address 0x1044 + that GDB cannot write to to set a software breakpoint. */ + return 0; + } + else + return 1; +} + /* When FRAME is at a syscall instruction, return the PC of the next instruction to be executed. */ @@ -234,6 +250,9 @@ nios2_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->syscall_next_pc = nios2_linux_syscall_next_pc; + set_gdbarch_code_of_frame_writable (gdbarch, + nios2_linux_code_of_frame_writable); + /* Index of target address word in glibc jmp_buf. */ tdep->jb_pc = 10; } -- 1.9.1