* What are the procedures to use self declared convenience functions in GDB? @ 2020-11-17 9:03 Nagmat Nazar 2020-11-17 14:34 ` Simon Marchi 0 siblings, 1 reply; 7+ messages in thread From: Nagmat Nazar @ 2020-11-17 9:03 UTC (permalink / raw) To: gdb I have implemented a convenience function on python in order to use it on GDB. What shall I do in order to use it on GDB. As I know the convenience functions are located in ~/gdb/python/lib/gdb/function/ I have copied context_checker.py into this folder but it is not working. What other procedures shall I do in order to use the convenience function on GDB? https://stackoverflow.com/questions/64815891/what-are-the-procedures-to-use-self-declared-convenience-functions-in-gdb Kind regards Nagmat Nazarov ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: What are the procedures to use self declared convenience functions in GDB? 2020-11-17 9:03 What are the procedures to use self declared convenience functions in GDB? Nagmat Nazar @ 2020-11-17 14:34 ` Simon Marchi [not found] ` <CAJnvuZ_UEox9FvcNVS2rUC+=5P8_g=_hLOG13FdQBP-2x_e+pg@mail.gmail.com> 0 siblings, 1 reply; 7+ messages in thread From: Simon Marchi @ 2020-11-17 14:34 UTC (permalink / raw) To: Nagmat Nazar, gdb On 2020-11-17 4:03 a.m., Nagmat Nazar via Gdb wrote: > I have implemented a convenience function on python in order to use it on > GDB. What shall I do in order to use it on GDB. As I know the convenience > functions are located in > > ~/gdb/python/lib/gdb/function/ > > I have copied context_checker.py into this folder but it is not working. > What other procedures shall I do in order to use the convenience function > on GDB? > > > https://stackoverflow.com/questions/64815891/what-are-the-procedures-to-use-self-declared-convenience-functions-in-gdb > > > > Kind regards > > Nagmat Nazarov > IIRC, you can use them with $ followed by the name of the function. So if you declaire a function foo, use $foo(...). Simon ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <CAJnvuZ_UEox9FvcNVS2rUC+=5P8_g=_hLOG13FdQBP-2x_e+pg@mail.gmail.com>]
* Re: What are the procedures to use self declared convenience functions in GDB? [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 0 siblings, 1 reply; 7+ messages in thread From: Simon Marchi @ 2020-11-18 20:39 UTC (permalink / raw) To: Nagmat Nazar; +Cc: gdb 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: What are the procedures to use self declared convenience functions in GDB? 2020-11-18 20:39 ` Simon Marchi @ 2020-11-19 7:48 ` Aktemur, Tankut Baris 2020-11-19 8:34 ` Nagmat Nazar 0 siblings, 1 reply; 7+ messages in thread From: Aktemur, Tankut Baris @ 2020-11-19 7:48 UTC (permalink / raw) To: Simon Marchi, Nagmat Nazar; +Cc: gdb 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: What are the procedures to use self declared convenience functions in GDB? 2020-11-19 7:48 ` Aktemur, Tankut Baris @ 2020-11-19 8:34 ` Nagmat Nazar 2020-11-19 10:39 ` Christian Biesinger 0 siblings, 1 reply; 7+ messages in thread From: Nagmat Nazar @ 2020-11-19 8:34 UTC (permalink / raw) To: Aktemur, Tankut Baris; +Cc: Simon Marchi, gdb 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? 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 > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: What are the procedures to use self declared convenience functions in GDB? 2020-11-19 8:34 ` Nagmat Nazar @ 2020-11-19 10:39 ` Christian Biesinger 2020-11-19 10:59 ` Aktemur, Tankut Baris 0 siblings, 1 reply; 7+ messages in thread From: Christian Biesinger @ 2020-11-19 10:39 UTC (permalink / raw) To: Nagmat Nazar; +Cc: Aktemur, Tankut Baris, Simon Marchi, Reuben Thomas via Gdb 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 > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: What are the procedures to use self declared convenience functions in GDB? 2020-11-19 10:39 ` Christian Biesinger @ 2020-11-19 10:59 ` Aktemur, Tankut Baris 0 siblings, 0 replies; 7+ messages in thread From: Aktemur, Tankut Baris @ 2020-11-19 10:59 UTC (permalink / raw) To: Christian Biesinger, Nagmat Nazar; +Cc: Simon Marchi, Reuben Thomas via Gdb On Thursday, November 19, 2020 11:39 AM, Christian Biesinger wrote: > 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 Hi Nagmat, Assuming you did "make install" first, you can check if the file is installed by looking at the share/gdb/python/gdb/function/ folder in the install directory. If you did not "make install" but started gdb from its build directory, you may have to pass the --data-directory flag. Like this: $ my-gdb-build-dir/gdb/gdb --data-directory=my-gdb-build-dir/gdb/data-directory -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 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-11-19 10:59 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-11-17 9:03 What are the procedures to use self declared convenience functions in GDB? 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 2020-11-19 10:59 ` Aktemur, Tankut Baris
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).