How to check if .gdbinit macros have been loaded?

Martin Simmons qqxnjvamvxwx@dyxyl.com
Thu Aug 12 15:03:45 GMT 2021


>>>>> On Wed, 11 Aug 2021 14:09:06 +0000 (UTC), Mahmood Naderan said:
> 
> >What makes you think these commands (macros) will be called
> >automatically?  I think you have to call them yourself from the gdb
> >command line. 
> >BTW, the "show user" command will tell you if a particular user defined
> command exists.
> 
> Hi Martin,
> Yes if I run ''show user" I see the functions defined in the .gdbinit file.
> 
> I tried your suggestion by manually calling one of the functions which is 'dp 3' [1]. However, it fails with the following error:
> 
> 
> accel-sim.out: shader.cc:1657: unsigned int shader_core_ctx::translate_local_memaddr(address_type, unsigned int, unsigned int, unsigned int, new_addr_type*): Assertion `localaddr % 4 == 0' failed.
> 
> Program received signal SIGABRT, Aborted.
> __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> 50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> (gdb) dp 3
> Dumping pipeline state...
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff7ba9468 in gpgpu_sim::dump_pipeline (this=0x0, mask=69, s=3, m=0) at gpu-sim.cc:2028
> 2028      for (unsigned i = 0; i < m_shader_config->n_simt_clusters; i++) {
> The program being debugged was signaled while in a function called from GDB.
> GDB has restored the context to what it was before the call.
> To change this behavior use "set unwindonsignal off".
> Evaluation of the expression containing the function
> (gpgpu_sim::dump_pipeline(int, int, int) const) will be abandoned.
> 
> 
> 
> I don't know if the .gdbinit functions can be used after the program receives segmentation fault.

Was it actually SIGABRT that stopped the program initially, rather than
segmentation fault?

> Any thoughts on that?

The segmentation fault message says this=0x0, which probably causes it.
The value of "this" comes from gdb's evaluation of
GPGPU_Context()->the_gpgpusim->g_the_gpu so maybe that is NULL at that
point in the program?

__Martin


> 
> 
> 
> [1] https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/master/.gdbinit#L10
> 
> 
> Regards,
> Mahmood
> 
> 
> 
> 
> 
> 
> On Monday, August 9, 2021, 4:31:34 PM GMT+2, Martin Simmons <qqxnjvamvxwx@dyxyl.com> wrote: 
> 
> 
> 
> 
> 
>>>>> On Sun, 8 Aug 2021 13:28:32 +0000 (UTC), Mahmood Naderan via Gdb said:
> > 
> > Hi
> > 
> > I use a .gdbinit [1] file which is supposed to print some debug information when the program is being run. 
> > When I run GDB, the first printf is written on the screen. So, that means the .gdbinit file has been loaded.
> > However, I don't see the rest of the information that must be printed on the screen. There are a lot of printf for this purpose.
> 
> The other printfs are inside define ... end, so you will only see them
> when the named command is used.
> 
> 
> > How can I be sure that the rest of the macros are called? Maybe they hit errors and I am not able to see those errors.
> 
> 
> What makes you think these commands (macros) will be called
> automatically?  I think you have to call them yourself from the gdb
> command line.
> 
> BTW, the "show user" command will tell you if a particular user defined
> command exists.
> 
> __Martin
> 


More information about the Gdb mailing list