From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by sourceware.org (Postfix) with ESMTPS id 682B63861817 for ; Thu, 19 Nov 2020 10:39:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 682B63861817 Received: by mail-qt1-x830.google.com with SMTP id f93so3905664qtb.10 for ; Thu, 19 Nov 2020 02:39:46 -0800 (PST) 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=rqb/MnQhaVmWSRLDdnmPFv1D+QpBpOpwwkuRRElPKEk=; b=fAgnFD0fSD1RXIKZgLLdhvPvNsI0cU2nC3X+AQGKsROcpmDV+LlyXRzJHI7cMcAX3K 9MuYmUhKbVnrXryDDY9mx4vAnL1dOiPF+2GctmUVAE9292g7mt3PGrg/lC+50KeGSg0G HC+8tzU9QDrAdQNPpKYtFCRRELzuBIqm2KL578Soc4tkudPIJrdrbmsOZR/nJMaUW8Wx 8wsck6EZvhhpKnCZEJKkJXiyYHCotVVeUobkHyN0oY7AgTDLwN6CBmn89KleyKuP8g7c NLYd26Z8Ww1QxPkWRkX2/e65vTzP2cBFl2lgLkz4joXC7RgeVYVVJteSK8yhYsI2ed/w DutQ== X-Gm-Message-State: AOAM532SRYEqvIitpN4RarLiL/J3jrAyg0jUWhhe7ueXxTEzLq7aMZBz Mq/TONr5xvlwNLyPrYJAkdJAqKst/mnxdXeQN5dcew== X-Google-Smtp-Source: ABdhPJwykzeM8FIbLTUrsTQ7JGcEl6NP41Qq9q2zAAgYH0P6TQHaBmOrKJCsQSoKRC5zPlqM9snP0e/YBTJHy7lUZmA= X-Received: by 2002:ac8:7619:: with SMTP id t25mr9888685qtq.244.1605782385728; Thu, 19 Nov 2020 02:39:45 -0800 (PST) MIME-Version: 1.0 References: <8477dd9d-5952-ca65-3b11-386259f27e61@simark.ca> In-Reply-To: From: Christian Biesinger Date: Thu, 19 Nov 2020 11:39:08 +0100 Message-ID: Subject: Re: What are the procedures to use self declared convenience functions in GDB? To: Nagmat Nazar Cc: "Aktemur, Tankut Baris" , Simon Marchi , Reuben Thomas via Gdb Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-20.3 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Thu, 19 Nov 2020 10:39:47 -0000 On Thu, Nov 19, 2020 at 9:34 AM Nagmat Nazar via Gdb wrote: > > Dear Mr. Baris, > > Thanks for your response, I have added it to Makefile.in as you told me, > but it is not functioning. How can I check If it was loaded or not? Did you verify that it gets installed with the other python files? And you are using "import greet" when using it? Christian > > Kind regards, > Nagmat > > On Thu, Nov 19, 2020 at 4:48 PM Aktemur, Tankut Baris < > tankut.baris.aktemur@intel.com> wrote: > > > On Wednesday, November 18, 2020 9:39 PM, Simon Marchi wrote: > > > On 2020-11-18 12:18 a.m., Nagmat Nazar wrote: > > > > Dear Simon, > > > > > > > > I have written convenience function as on explanation: > > > > https://sourceware.org/gdb/onlinedocs/gdb/Functions-In-Python.html > > > > greet.py > > > > ``` > > > > > > > > class Greet (gdb.Function): > > > > """Return string to greet someone. > > > > Takes a name as argument.""" > > > > > > > > def __init__ (self): > > > > super (Greet, self).__init__ ("greet") > > > > > > > > def invoke (self, name): > > > > return "Hello, %s!" % name.string () > > > > > > > > Greet () > > > > > > > > ``` > > > > image.png > > > > > > > > I have placed greet.py into ~/gdb/python/lib/gdb/function/, but as you > > see on the picture > > > it still gives error. What else shall I do in order to use this function? > > > > > > > > Kind regards > > > > Nagmat > > > > > > Just putting the file in ~/gdb/python/lib/gdb/function/ won't magically > > load it. > > > > > > You should either use the source command inside GDB (or in a .gdbinit) > > or the -x switch when > > > starting GDB. > > > > > > Simon > > > > If you list the file name in gdb/data-directory/Makefile.in's > > PYTHON_FILE_LIST, I believe > > it's loaded automatically at GDB startup time. > > > > -Baris > > > > > > Intel Deutschland GmbH > > Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany > > Tel: +49 89 99 8853-0, www.intel.de > > Managing Directors: Christin Eisenschmid, Gary Kershaw > > Chairperson of the Supervisory Board: Nicole Lau > > Registered Office: Munich > > Commercial Register: Amtsgericht Muenchen HRB 186928 > >