From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 7C04D384841A for ; Fri, 3 Sep 2021 14:53:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7C04D384841A Received: by mail-wm1-x32c.google.com with SMTP id m25-20020a7bcb99000000b002e751bcb5dbso3752168wmi.5 for ; Fri, 03 Sep 2021 07:53:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gd+kHrX056JJQMMSBM6UcaWon5b1tGiWW/sZunVOpnc=; b=D5XtFSkr02Oj9dwbtKXW/K/deIUCDMHUFAs3ZwI1l2EuZ2vYh0cpexw6/OB5jnljgC omsqr3bSWNoVsP01ySwLRy/5RXszwGPOgmGUJu/0H8clzIJXp3/54ncZ7o9tJxHF+Kly zBSGXIRYVTrJUna5VEh2NKARHhq4NlWT/ETcY1s4w4W7yzTV2DcqwAA0z8B22SA4vqze HXAs/3TLBGe7x1n6qFHvfoPR3LhXI3G0vxcGkPI5lgVanY9oh8SDu2pcC3joqBYJnplv 4yxD4K57YfEbk66llawhtjo2DkfXNKMnv5rDel/7nSceKIZvd1zAORgWGoWIYuJPVUzR pArw== X-Gm-Message-State: AOAM531Ue9xz5I6gd9lZMJvLVwz9Zb5q2DYzF3ZblyKcn5GxnIMwOQun 5Z/MwDKNXP/mejnUvk30FkSSc06s/NVEXt4mnFloaoSkv5KdyQ== X-Google-Smtp-Source: ABdhPJza0pPryZSeITatIyG81fceraY26+kSWbhcpXQxAaif58y8mA/ZgTk02tHAkY8fHDtAQN8iihcAbt8goRa4p0I= X-Received: by 2002:a1c:7c0e:: with SMTP id x14mr8936170wmc.30.1630680822553; Fri, 03 Sep 2021 07:53:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Matt Rice Date: Fri, 3 Sep 2021 14:53:30 +0000 Message-ID: Subject: Re: Disambiguating symbols by module To: Alexander Miloslavskiy Cc: GDB Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: Fri, 03 Sep 2021 14:53:44 -0000 On Fri, Sep 3, 2021 at 2:35 PM Alexander Miloslavskiy wrote: > > > > On 03.09.2021 17:31, Matt Rice wrote: > > Been a while since I've needed to do this, but IIRC you can just set a > > breakpoint using the symbol address too, like: > > > > (gdb) break *0x00007ffff6d7a3b0 > > > > I don't know of or believe there is any nicer syntax like > > object_file.o:symbol_name, which one could imagine might be possible. > > Thanks! > > Right, currently in order to call 'ps()' I have to manually do the > following: > > (gdb) info function ^ps$ > Non-debugging symbols: > 0x00007ffff6d7a3b0 ps > > (gdb) call (void)0x00007ffff6d7a3b0() > > That is, I manually find the address, then use it to call the function. > > I'd like to avoid that extra first step somehow and have some > address-independent command. I don't really know of any satisfactory solution then... The best workaround I can come up with is to put the address in a convience variable (which could perhaps be automated with some python scripts in your gdbinit, to gain some address independence). (gdb) set $ps = 0x00007ffff6d7a3b0 With that, you can at least use: (gdb) call (void)($ps)() I haven't tried it, but if you look at https://sourceware.org/systemtap/wiki/MakeDoWithoutDebugInfo Given that there is some probe support in gdb, maybe there is a way to make use of kprobe.module(NAME).function(FUNCTION) to get the address.