From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OL1rGDc3MmEtEAAAWB0awg (envelope-from ) for ; Fri, 03 Sep 2021 10:54:47 -0400 Received: by simark.ca (Postfix, from userid 112) id 524661EE22; Fri, 3 Sep 2021 10:54:47 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8672F1EDF5 for ; Fri, 3 Sep 2021 10:54:46 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D3E2F3848424 for ; Fri, 3 Sep 2021 14:54:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D3E2F3848424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1630680885; bh=Gd+kHrX056JJQMMSBM6UcaWon5b1tGiWW/sZunVOpnc=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Cs55Zm5PdcU1mquFA62QYMVOu3Y7e+l/JnQxvdgSIFBetI2A+R0T1THtfurV5PLh3 9rDZ0cKO//k1XFQtPVttEIvszv+RkaPwKxIajPMOTUk+FGM2FYHSyT5CO9piGZs7hR Mek+FSCT4xCc0NnUmSXeQojo6PW6rHkkP+6dCMNU= 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: Date: Fri, 3 Sep 2021 14:53:30 +0000 Message-ID: Subject: Re: Disambiguating symbols by module To: Alexander Miloslavskiy Content-Type: text/plain; charset="UTF-8" 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: , From: Matt Rice via Gdb Reply-To: Matt Rice Cc: GDB Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" 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.