From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 9D12A385801E for ; Wed, 28 Sep 2022 07:35:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D12A385801E Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-118-cRLKzNb1MRKTAvRg5RWxIA-1; Wed, 28 Sep 2022 03:35:18 -0400 X-MC-Unique: cRLKzNb1MRKTAvRg5RWxIA-1 Received: by mail-wr1-f72.google.com with SMTP id p7-20020adfba87000000b0022cc6f805b1so295603wrg.21 for ; Wed, 28 Sep 2022 00:35:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=/YS2UmCOJ3LwVOjGa8d1J3Q4r+AQdPXI1eIwZ5HuZkc=; b=oUery23ac3bLRbYgzxIMbWviBNgO5Wj10uzHzaziovA3h82zCDmXFuvWlJlG+4rOG6 Qg7SuJF621WuTsI2yo4tS5zaeXaTrXRzKQGQB6+vRx52FY5BRnkH8Ld+gDP91F9fJCPY 1/fI9ac7u2m0A6xKvBBElqVCNLoWoYYBLI7vTGhPr5HDXlvVnuZKl8ddY5pEaJquDBQz 5OQZFTj2RnUKxczZ2Yn1/QwH8Rj0xyyhWDAn7dMrRyxQosH4oUqY1NwcMR80LsUIlytJ Ff0XpskfIBWNhDwYFvwXNEVx8MZLWDcyRT9CkNmJXOnNL9GKFp0br6R9Dp5npei8hGXR uu+g== X-Gm-Message-State: ACrzQf2KV7my24Whs2K/rbkIWLrqx7GkU41DBiKM7E+dTiA3wFtn1D6v gxtC37RUDzVa4z5g0GGqtpZf7RCmZTL2TeFoftA5c4XZXkz86OAp1EaAbAVs/imTcJfGqFTfKSv otwj9jAoxFp/naWRAAKK3EQ== X-Received: by 2002:a05:6000:a18:b0:22c:c94b:98c0 with SMTP id co24-20020a0560000a1800b0022cc94b98c0mr724957wrb.262.1664350516971; Wed, 28 Sep 2022 00:35:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WoeF/yQgjp9bIr8hufDdeBAEoRGmnmIHerGI+iKG9Q9fqkiLKw2HZv+r2feeZlBlDdexqsg== X-Received: by 2002:a05:6000:a18:b0:22c:c94b:98c0 with SMTP id co24-20020a0560000a1800b0022cc94b98c0mr724947wrb.262.1664350516681; Wed, 28 Sep 2022 00:35:16 -0700 (PDT) Received: from [192.168.0.45] (ip-62-245-66-121.bb.vodafone.cz. [62.245.66.121]) by smtp.gmail.com with ESMTPSA id t18-20020adfe452000000b00228cd9f6349sm3599779wrm.106.2022.09.28.00.35.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Sep 2022 00:35:16 -0700 (PDT) Message-ID: <69b2451b-1baf-8bd4-25dd-a1b46963981f@redhat.com> Date: Wed, 28 Sep 2022 09:35:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH] Fix test next-reverse-bkpt-over-sr.exp To: Carl Love , "gdb-patches@sourceware.org" Cc: Ulrich Weigand References: From: Bruno Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2022 07:35:24 -0000 On 27/09/2022 18:14, Carl Love via Gdb-patches wrote: > GDB maintainers: > > The next-reverse-bkpt-over-sr.exp test sets a breakpoint on *callee. > The intention is the test is setting a breakpoint on the entry point of > the function. However on PowerPC, the statement sets the breakpoint on > the global entry point. The test uses the local entry point to the > function callee and thus the breakpoint on the global entry point is > never hit resulting in the test failing. > > This patch changes the break instruction to callee to properly set the > breakpoint. > > The patch has been tested on both Power10 and X86-64 with no regression > errors. > > Please let me know if this patch is acceptable for mainline. Thanks. > > Carl Love > Hi Carl, I don't think this change is acceptable. Looking at the comment at the top of next-reverse-bkpt-over-sr.exp, we see the following: # reverse-next over a function call sets a step-resume breakpoint at # callee's entry point, runs to it, and then does an extra single-step # to get at the callee's caller.  Test that a user breakpoint set at # the same location as the step-resume breakpoint isn't ignored. Based on this, the test seems to expect that a user has placed the breakpoint at the exact same instruction as where GDB will place the step-resume breakpoint. By getting GDB to print where it is placing the step-resume breakpoint (using the patch at the end of this email), and running the test manually to see where breakpoints are located when using "break callee" and "break *callee", I get the following output: (gdb) rn setting step_resume_breakpoint at 0x401136 55         callee();    /* NEXT OVER THIS CALL */ (gdb) b callee Breakpoint 2 at 0x40113a: file /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.reverse/step-reverse.c, line 26. (gdb) b *callee Breakpoint 3 at 0x401136: file /home/blarsen/Documents/fsf_build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.reverse/step-reverse.c, line 25. As you can see, setting a breakpoint at callee does not create a user breakpoint at the same instruction as the step-resume breakpoint in x86_64 processors, rendering this test useless. I encourage you to try the same patch I used to get the location for the step-resume breakpoint on powerpc architectures, and if they turn out to be the same, maybe you can make an architecture check at the top of this test, changing the location of the breakpoint based on it. Cheers, Bruno diff --git a/gdb/infrun.c b/gdb/infrun.c index 1957e8020dd..1699f4a0c6c 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -7130,6 +7130,7 @@ process_event_stop_test (struct execution_control_state *ecs)                 {                   /* Normal function call return (static or dynamic).  */                   symtab_and_line sr_sal; +                 gdb_printf ("setting step_resume_breakpoint at 0x%lx\n", ecs->stop_func_start);                   sr_sal.pc = ecs->stop_func_start;                   sr_sal.pspace = get_frame_program_space (frame);                   insert_step_resume_breakpoint_at_sal (gdbarch,