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.129.124]) by sourceware.org (Postfix) with ESMTPS id 694E23858C2C for ; Wed, 2 Feb 2022 17:51:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 694E23858C2C Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-253-4npunYdXN6GLDl5-P21c3Q-1; Wed, 02 Feb 2022 12:51:30 -0500 X-MC-Unique: 4npunYdXN6GLDl5-P21c3Q-1 Received: by mail-wr1-f70.google.com with SMTP id k12-20020adfe3cc000000b001d6806dfde1so1762wrm.16 for ; Wed, 02 Feb 2022 09:51:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SWBdb0uCyFHJWCuvwZWlAtctf8SCC6bwlKPWzg2BN6Q=; b=E5Kq6v/tMGMtKYOWL02HxAp+pjIaBDrHXfZALHm+JResRbwb0fZJwH9bxlCmP3rib0 mq9h0Vif/MAQGawAMWFPD9rTIdubmcNwkm+JlxKD7BPO/GWXqNR51a2A3gYD/8rbVo3U 1X2haDHxTXVT1P96Xs0CaoSSouXIph199YwDpL4DOdQ2ely8vYiacRWdQS/LDNG0YAUD kgcjO6jTyuA7Qm/+H9X53xKeMskNqnIovR81U7kZVeh3ZWwJH6pTrp4wlm3TNFnl8iz+ VhxE4JZzmpHFIynSZtkYjW/iS+s0MMmepOII3N8G6P2q/7Fzmcej8ptcb0ApdZeJm/m7 /zQQ== X-Gm-Message-State: AOAM5324g3R5lI8WcYuzcy+7rpzpOZcJroD29B4IpQ29G0kTh1oZkH6A 4oByArLG2iGvE32w3BK2ve/9Y5YsPEcOhDGitcmQOq4ZVtXw/SKW687559BqToP+A1fVcLf+8Qe ubY4watfRdnw= X-Received: by 2002:a05:600c:1c16:: with SMTP id j22mr7107447wms.60.1643824289691; Wed, 02 Feb 2022 09:51:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhXSL5NuJQieCKbSS2ZiRwvHoztDoeOfMPoS4UqOncJDEXQsTR3ZmMb0bZrJy2tGalggiHZg== X-Received: by 2002:a05:600c:1c16:: with SMTP id j22mr7107434wms.60.1643824289514; Wed, 02 Feb 2022 09:51:29 -0800 (PST) Received: from localhost (host86-140-92-93.range86-140.btcentralplus.com. [86.140.92.93]) by smtp.gmail.com with ESMTPSA id az16sm5194904wmb.15.2022.02.02.09.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 09:51:29 -0800 (PST) Date: Wed, 2 Feb 2022 17:51:27 +0000 From: Andrew Burgess To: Edgar Mobile Cc: "gdb@sourceware.org" Subject: Re: Problem setting a breakpoint with command in gdbinit Message-ID: <20220202175127.GA1552688@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 17:47:03 up 9 days, 8:33, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2022 17:51:33 -0000 * Edgar Mobile via Gdb [2022-02-02 16:01:11 +0000]: > Greetings, > > I try to set a silent breakpoint with commands via .gdbinit like this: > > > define breakXOpenDisplayRun > set pagination off > break XOpenDisplay > commands > silent > info locals > bt full > cont > end > run > end > > Then I call my application like this: > > > gdb -q -ex breakXOpenDisplayRun ./myapp > > The breakpoint is set and the application starts. However, when it encounters the breakpoint the first time it doesn't execute the command silently but stops there. Entering "continue" will continue with debugging and after that point it works. > If I start up GDB manually, then execute breakXOpenDisplayRun and run manually everything works fine. > > What can I do? > > GDB Version is 8.1.0.20180409-git for Ubuntu Linux 18.04 AMD64. If possible, update your version of gdb. This issue was fixed in this commit: commit 21e051b3d666bcd614391142a936a8a8cccfa3cb Author: Tankut Baris Aktemur Date: Mon Dec 7 09:03:24 2020 +0100 gdb/main: execute breakpoint commands for '-iex' and '-ex' commands Basically, the breakpoint commands are not being executed when gdb is set running as a result of an -ex command line flag. Your example works fine with GDB 11. If you can't update gdb for whatever reason, then you might be able to work around this issue by placing the call to breakXOpenDisplayRun in a file, and sourcing that, so $ cat breakXOpenDisplayRun.gdb breakXOpenDisplayRun $ gdb -q -ex 'source breakXOpenDisplayRun.gdb' ./myapp this seemed to work for me, though clearly not ideal. Thanks, Andrew