From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 3DBD33858C60 for ; Tue, 2 Nov 2021 16:43:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3DBD33858C60 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhwsX-0004JG-OG for gdb@sourceware.org; Tue, 02 Nov 2021 12:43:17 -0400 Received: from ip5f5a8d68.dynamic.kabel-deutschland.de ([95.90.141.104]:51331 helo=[192.168.111.41]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhwsX-00066V-Ec for gdb@sourceware.org; Tue, 02 Nov 2021 12:43:17 -0400 Subject: Re: How to create maintenance breakpoints for running programs? From: Simon Sobisch To: gdb@sourceware.org References: <6b1622f3-ef58-642a-b320-1ebfeae59b98@gnu.org> Message-ID: <111ac135-4dfa-7104-ea47-7f59aad400f8@gnu.org> Date: Tue, 2 Nov 2021 17:43:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <6b1622f3-ef58-642a-b320-1ebfeae59b98@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP 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: Tue, 02 Nov 2021 16:43:19 -0000 I _guess_ GDB has an "internal" event handler which checks for libc being loaded in the inferior and sets those maintainance breakpoints then and likely also deletes them on unload of libc. Can anyone point out a sample how to do the same for an own library from a python module, please? Thank you, Simon Am 28.10.2021 um 11:35 schrieb Simon Sobisch: > We can create  maintenance breakpoints with > gdb.Breakpoint(internal=True), which is good. > > I've now stumbled over the problem that this _does_ work with not > running / attached targets but raises an error message "No symbol table > is loaded.  Use the "file" command." > > the breakpoint is then shown under "maint info break" as PENDING (as > expected) and is resolved on "start". > > > What I _want_ to achieve is the same as one can see with "plain GDB": > > $ gdb -q > (gdb) maint info break > No breakpoints or watchpoints. > (gdb) file prog > (gdb) star > ... > (gdb) maint info break > (gdb) maint info break > Num     Type                  Disp Enb Address            What > -1      shlib events          keep y   0x00007ffff7fe2590 > <__GI__dl_debug_state> inf 1 > -1.1                               y   0x00007ffff7fe2590 > <__GI__dl_debug_state> inf 1 > -2      longjmp master        keep n   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -2.1                               y   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -3      longjmp master        keep n   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -3.1                               y   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -4      longjmp master        keep n   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -4.1                               y   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -5      longjmp master        keep n   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -5.1                               y   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -6      longjmp master        keep n   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -6.1                               y   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -7      longjmp master        keep n   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -7.1                               y   0x00007ffff7db3950 > <__libc_siglongjmp> inf 1 > -8      std::terminate master keep n   0x00007ffff59369c0 > inf 1 > -8.1                               y   0x00007ffff59369c0 > inf 1 > > > I'd like to do the same - is there any event I can register to so that I > don't create a breakpoint and an error but instead create the > breakpoint when GDB actually has a running program? > > Thanks for any insights, > Simon