From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36671 invoked by alias); 21 Jun 2019 13:43:31 -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 36662 invoked by uid 89); 21 Jun 2019 13:43:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2274, love, Looking X-HELO: mail-wm1-f67.google.com Received: from mail-wm1-f67.google.com (HELO mail-wm1-f67.google.com) (209.85.128.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Jun 2019 13:43:30 +0000 Received: by mail-wm1-f67.google.com with SMTP id 207so6393567wma.1 for ; Fri, 21 Jun 2019 06:43:30 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id f12sm5414596wrg.5.2019.06.21.06.43.27 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jun 2019 06:43:27 -0700 (PDT) Subject: Re: [PATCH] gdb: Don't skip prologue for explicit line breakpoints in assembler To: Andrew Burgess , Kevin Buettner References: <20190612123403.14348-1-andrew.burgess@embecosm.com> <20190619181147.69974f43@f29-4.lan> <20190620205759.GI23204@embecosm.com> <20190620232314.GJ23204@embecosm.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <406d910b-8b63-1e93-d340-7e9ab841ad0b@redhat.com> Date: Fri, 21 Jun 2019 13:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190620232314.GJ23204@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-06/txt/msg00421.txt.bz2 On 6/21/19 12:23 AM, Andrew Burgess wrote: > I spent some more time trying to find a path that would call both > 'decode_digits_list_mode' and then 'skip_prologue_sal', but I still > can't find one. But won't that change affect any code path that ends up in skip_prologue_sal with explicit_line set? E.g.: /* Helper function for break_command_1 and disassemble_command. */ void resolve_sal_pc (struct symtab_and_line *sal) { CORE_ADDR pc; if (sal->pc == 0 && sal->symtab != NULL) { if (!find_line_pc (sal->symtab, sal->line, &pc)) error (_("No line %d in file \"%s\"."), sal->line, symtab_to_filename_for_display (sal->symtab)); sal->pc = pc; /* If this SAL corresponds to a breakpoint inserted using a line number, then skip the function prologue if necessary. */ if (sal->explicit_line) skip_prologue_sal (sal); } Is that path unreachable today? > > Looking back at how the explicit_line flag was originally used when > it was added in commit ed0616c6b78a0966, things have changed quite a > bit in the 10+ years since. There were some tests added along with > the explicit_line flag (gdb.cp/mb-*.exp) and these all pass both in > master and in my patched branch. > > My current thinking is that the explicit_line flag was no longer doing > anything useful in master, but if someone disagrees I'd love to > understand more about this. I seem to recall that GDB didn't use to update a breakpoint's line number to advance to the next line number that includes some actual compiled code. Like if you set a breakpoint at line 10 below: 10 // just a comment 11 i++; you end up with a breakpoint at line 11. Maybe it's old code related to that. Maybe I'm misremembering. In any case, if you change this, then you also should change the function's entry comment: /* Adjust SAL to the first instruction past the function prologue. If the PC was explicitly specified, the SAL is not changed. If the line number was explicitly specified, at most the SAL's PC ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ is updated. If SAL is already past the prologue, then do nothing. */ ^^^^^^^^^^ void skip_prologue_sal (struct symtab_and_line *sal) { Thanks, Pedro Alves