public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Simon Marchi <simark@simark.ca>, Nagmat Nazar <nagmat@gmail.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: RE: What are the procedures to use self declared convenience functions in GDB?
Date: Thu, 19 Nov 2020 07:48:11 +0000	[thread overview]
Message-ID: <SN6PR11MB2893B29380034B5FE56491A8C4E00@SN6PR11MB2893.namprd11.prod.outlook.com> (raw)
In-Reply-To: <8477dd9d-5952-ca65-3b11-386259f27e61@simark.ca>

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

  reply	other threads:[~2020-11-19  7:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  9:03 Nagmat Nazar
2020-11-17 14:34 ` Simon Marchi
     [not found]   ` <CAJnvuZ_UEox9FvcNVS2rUC+=5P8_g=_hLOG13FdQBP-2x_e+pg@mail.gmail.com>
2020-11-18 20:39     ` Simon Marchi
2020-11-19  7:48       ` Aktemur, Tankut Baris [this message]
2020-11-19  8:34         ` Nagmat Nazar
2020-11-19 10:39           ` Christian Biesinger
2020-11-19 10:59             ` Aktemur, Tankut Baris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SN6PR11MB2893B29380034B5FE56491A8C4E00@SN6PR11MB2893.namprd11.prod.outlook.com \
    --to=tankut.baris.aktemur@intel.com \
    --cc=gdb@sourceware.org \
    --cc=nagmat@gmail.com \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).