From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MNt9EnZLtl9oQQAAWB0awg (envelope-from ) for ; Thu, 19 Nov 2020 05:39:50 -0500 Received: by simark.ca (Postfix, from userid 112) id 4751F1F08B; Thu, 19 Nov 2020 05:39:50 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [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 DD3061E58F for ; Thu, 19 Nov 2020 05:39:49 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 48D073861817; Thu, 19 Nov 2020 10:39:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48D073861817 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605782389; bh=rqb/MnQhaVmWSRLDdnmPFv1D+QpBpOpwwkuRRElPKEk=; 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=Aj5ovYa4LsPn8awZKNFuOZSc6kmweIWdLs04/xXGi3iFgDG/5wrkHJymDK0WwuJu4 LtPkFBJuIjbYyrl9oI9tEF10//7LqtX+oGd8uG3peYtT8cle48il5T21UGIpKre2+o eoZAWgXka7Af4SJhIGEf9/TIh/p4XMbWViBgNXMI= 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: 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 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: Christian Biesinger via Gdb Reply-To: Christian Biesinger Cc: Simon Marchi , Reuben Thomas via Gdb Errors-To: gdb-bounces@sourceware.org Sender: "Gdb" 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 > >