On Thu, Apr 6, 2017 at 2:51 PM, Marco Domingues <marcodomingue...@gmail.com>
wrote:

> I’m trying to use ‘gdb’ to debug an OpenCL kernel but I’m having trouble
> using the command: (gdb) break filename:linenum
>
> My idea was to set a breakpoint in the function “clEnqueueNDRangeKernel”
> (in src/librt/primitives/primitive_util.c) because I read online that
> kernels are only visible to ‘gdb’ after they are compiled.
>

It is probably worse than that. The kernels likely are only visible after
they're both compiled and linked.


> But when I run the following commands inside the brlcad main directory:
>
> $ gdb --args build/bin/mged build/bool.g
> (gdb) b src/librt/primitives/primitive_util.c:1063
>
> I get “no source file named src/librt/primitives/primitive_util.c”, even
> when i try to specify the full path to the file
>
> Maybe someone that have used ‘gdb’ with brlcad before could point me what
> is missing?
>

There's another thing you can do, other than set a breakpoint. You can emit
an interrupt in the code (e.g. with kill(0, SIGINT)). Then the executable
will stop. Then you can just use the 'continue' command. Or just hit CTRL-C
in the middle of execution. Assuming the code takes long enough to run that
you can do it...

Still, if you want to debug the raytracer backend, it is not 'mged' you
want to debug. What you want to debug is the 'rt' command. 'mged' is just a
graphic interface that IIRC has no rendering code in it. That's probably
why you can't set the breakpoint in the first place. The code isn't in
'mged'. One good way to check this out, assuming you compiled with debug
symbols, is to run 'ldd build/bin/mged' and see if 'librt.so' shows up in
the list of linked libraries.

If you can also a list of the debug symbols in an executable or a library
with the 'nm' command. e.g. 'nm -S build/bin/mged'.

Regards,

-- 
Vasco Alexandre da Silva Costa
PhD in Computer Engineering (Computer Graphics)
Instituto Superior Técnico/University of Lisbon, Portugal
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to