public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Christian Biesinger <cbiesinger@google.com>
To: Nagmat Nazar <nagmat@gmail.com>
Cc: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>,
	Simon Marchi <simark@simark.ca>,
	 Reuben Thomas via Gdb <gdb@sourceware.org>
Subject: Re: What are the procedures to use self declared convenience functions in GDB?
Date: Thu, 19 Nov 2020 11:39:08 +0100	[thread overview]
Message-ID: <CAPTJ0XFk-TNmkMLVAjNgmbdfeAV6Q0dLfE9zRv+dn+k-iFc9MA@mail.gmail.com> (raw)
In-Reply-To: <CAJnvuZ8vHxZ=CJhRPsVtLZe4t-pBbuiNQz_forxDK2D0PGShiQ@mail.gmail.com>

On Thu, Nov 19, 2020 at 9:34 AM Nagmat Nazar via Gdb <gdb@sourceware.org> 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
> >

  reply	other threads:[~2020-11-19 10:39 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
2020-11-19  8:34         ` Nagmat Nazar
2020-11-19 10:39           ` Christian Biesinger [this message]
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=CAPTJ0XFk-TNmkMLVAjNgmbdfeAV6Q0dLfE9zRv+dn+k-iFc9MA@mail.gmail.com \
    --to=cbiesinger@google.com \
    --cc=gdb@sourceware.org \
    --cc=nagmat@gmail.com \
    --cc=simark@simark.ca \
    --cc=tankut.baris.aktemur@intel.com \
    /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).