From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27207 invoked by alias); 16 Mar 2019 23:15:32 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 27066 invoked by uid 89); 16 Mar 2019 23:15:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=architectures, H*c:alternative, person X-HELO: mail-it1-f179.google.com Received: from mail-it1-f179.google.com (HELO mail-it1-f179.google.com) (209.85.166.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 16 Mar 2019 23:15:22 +0000 Received: by mail-it1-f179.google.com with SMTP id z124so16313635itc.2 for ; Sat, 16 Mar 2019 16:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=z+smraHltxmY36RDJAx4NemZY+RVoPyGBssk3xc5Mco=; b=n7rldNWqI52+Rt5xLqXepqANJxMGXLActUlA50TT+yV8VTHvcEsgFKl5Ps2EByW0Vt BAPKs4s7CcV2Z/zoavtTxENNV21SeuFnqVPKi9e8DWoXFw3FcOgJGqpRI+sNmhOjCy/O fZUji+8ptluB7s+6IETnciErv/69/INMr/qF8aX4Ncl+c24bU1BA+uLPgXiZvo0RdGAo 4kcqcvWhkqtinP1ynsiA+wBP+6NmNBhUL83QfQANXj/vAP8cO3IkMWGazBoMpNXNZng2 SnnLBMHwPJCQbiQBiMLJyuppXzMq3pfv5jBnxfMB9UPj8I0zfykqauXT7AOh9JGzFcCb AT+g== MIME-Version: 1.0 From: Justin Paston-Cooper Date: Sat, 16 Mar 2019 23:15:00 -0000 Message-ID: Subject: Command to break before exiting stack frame? To: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2019-03/txt/msg00042.txt.bz2 Hello, I would be interested to see a command which breaks just before exiting the current stack frame. I have so far seen this implemented as a custom command in Python, which searches for 'retq' instructions in the current stack frame. I am not an ASM expert, but I imagine that this might not work for all architectures. In any case, you might ask why I can't just use that instead of expecting it as a native command in gdb. You might also ask why I don't just give the line number of the returns of the function in question. There are a few reasons: 1. We already have a command to break at the beginning of a function given its name (break). 2. We already have a command to continue to the end of the current stack frame and then exit it (finish). 3. Analysing C/C++/other code with gcc is difficult. grep can tell me the line numbers of returns in C/C++, but there might be other languages where such a simple solution is not so readily available. In any case, it's still an extra step. 4. rbreak breaks at the beginning of all functions matching a regex. It would be simple and useful to add a "break on frame exit" command to the commands part of an rbreak command to see the ending state of all chosen functions. I can't imagine that I am the first person to suggest or request this. Are there any architectural or practical reasons as to why this is might be difficult? I was not able to find any, but are there any existing, equivalent and native solutions? Thanks in advance, Justin