<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>@Miller, no I hadn't. Thanks! I knew there was something like
      that I had neglected. Now I am able to debug with gdb.</p>
    <p>@iohannes, I am still having trouble with this technique. If I
      run Pd from the gdb prompt (with -nrt and -stderr) and a break
      point within the extern (meaning object not compiled into pd)
      nothing happens when I run the function where I want to break. If
      I follow the instructions on Hans' tutorial (run pd in a separate
      process then attach gdb to it) Pd simply hangs when I hit the
      break point and gdb doesn't appear to do anything.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 04/11/2018 08:21 PM, IOhannes m
      zmölnig wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:c7de1ab1-cc7d-a4a5-4d0f-50f7978af339@iem.at">
      <pre wrap="">On 04/11/2018 07:03 PM, David Medine wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">I am trying to debug an extern on linux using gdb and this tutorial
<a class="moz-txt-link-rfc2396E" href="https://puredata.info/docs/developer/DebuggingPdExternals"><https://puredata.info/docs/developer/DebuggingPdExternals></a> (for MacOS
and some years old) does not work on my machine. In fact, I've tried
this a few times in the past with little success. The watchdog just
hangs when I break and gdb and Pd can't do anything.

I remember Miller once suggesting that a way to run gdb on an extern is
to build it into Pd with debugging symbols on. I am trying to do this,
but having trouble there too. I added 'my_extern.c' to the src folder
and to the list of .c files that comprise SRC in makefile.gnu. I also
added -g to CFLAGS. Everything compiles and I see 'my_extern.o' in the
obj folder, but the extern doesn't load when I create the object in Pd.

When I run pd from gdb, i can set a break point on my_extern_new, but
when I create the object, I just get a ...cannot create message in the
console and no debugging symbols. I feel like I'm missing a step somewhere.

</pre>
      </blockquote>
      <pre wrap="">
i never had problems with using gdb and "external" objects (that is:
objects, not copmiled into Pd).

i'm still using gdb, as i'm on linux. on macOS i hear that you should
use the llvm based debugger instead.

a few tricks:

- compile your external with "-g" (so it includes debugging symbols; i
still think that it is a shame that pd-lib-builder doesn't do that by
default; practically all my projects compile with "-g" all the time)
- make sure that you are running Pd with "-nrt" (so you don't have
"watchdog...signalling Pd" messages all over the place once the
execution is halted)
- run pd with "-stderr"
- before setting any breakpoints, do a "warm up" run: just run Pd
(inside the debugger) and load the external. after this, the debugger
should be able to resolve all the symbols.




gfmdsar
IOhannes

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list
UNSUBSCRIBE and account-management -> <a class="moz-txt-link-freetext" href="https://lists.puredata.info/listinfo/pd-list">https://lists.puredata.info/listinfo/pd-list</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>