I am trying to debug an extern on linux using gdb and this tutorial https://puredata.info/docs/developer/DebuggingPdExternals (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.
Any help is kindly appreciated.
-David
Did you add the two lines to m_conf.c ?
cheers Miller
On Wed, Apr 11, 2018 at 07:03:20PM +0200, David Medine wrote:
I am trying to debug an extern on linux using gdb and this tutorial https://puredata.info/docs/developer/DebuggingPdExternals (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.
Any help is kindly appreciated.
-David
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On 04/11/2018 07:03 PM, David Medine wrote:
I am trying to debug an extern on linux using gdb and this tutorial https://puredata.info/docs/developer/DebuggingPdExternals (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.
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:
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)
"watchdog...signalling Pd" messages all over the place once the execution is halted)
(inside the debugger) and load the external. after this, the debugger should be able to resolve all the symbols.
gfmdsar IOhannes
@Miller, no I hadn't. Thanks! I knew there was something like that I had neglected. Now I am able to debug with gdb.
@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.
On 04/11/2018 08:21 PM, IOhannes m zmölnig wrote:
On 04/11/2018 07:03 PM, David Medine wrote:
I am trying to debug an extern on linux using gdb and this tutorial https://puredata.info/docs/developer/DebuggingPdExternals (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.
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
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On 04/12/2018 11:18 AM, David Medine wrote:
@Miller, no I hadn't. Thanks! I knew there was something like that I had neglected. Now I am able to debug with gdb.
@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.
but the breakpoint gets resolved correctly? e.g. after a warm-up run, setting the breakpoint yields an address:
$ gdb --args pd -nrt -stderr -lib zexy ./reference/tabdump-help.pd [...] (gdb) run [...] (gdb) break tabdump_bang Breakpoint 1 at 0x7ffff5cb6730: file tabdump.c, line 33. (gdb) run [ ...send "bang" to tabdump... ] Thread 1 "pd" hit Breakpoint 1, tabdump_bang (x=0x555555971ef0) at tabdump.c:33 33 { (gdb) print(x) $1 = (t_tabdump *) 0x555555971ef0 (gdb)
gfdsmrt IOhannes
After starting gdb --args etc. as in your example, and after calling run I get this:
[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Detaching after fork from child process 3889. [New Thread 0x7ffff61ff700 (LWP 3891)]
(Pd is on PID 3888 in this case)
and there is no gdb prompt. If I put a break point in before I hit 'run' I get the same, and the process doesn't break, even though the function I wanted to break is surely called.
On 04/12/2018 12:19 PM, IOhannes m zmölnig wrote:
On 04/12/2018 11:18 AM, David Medine wrote:
@Miller, no I hadn't. Thanks! I knew there was something like that I had neglected. Now I am able to debug with gdb.
@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.
but the breakpoint gets resolved correctly? e.g. after a warm-up run, setting the breakpoint yields an address:
$ gdb --args pd -nrt -stderr -lib zexy ./reference/tabdump-help.pd [...] (gdb) run [...] (gdb) break tabdump_bang Breakpoint 1 at 0x7ffff5cb6730: file tabdump.c, line 33. (gdb) run [ ...send "bang" to tabdump... ] Thread 1 "pd" hit Breakpoint 1, tabdump_bang (x=0x555555971ef0) at tabdump.c:33 33 { (gdb) print(x) $1 = (t_tabdump *) 0x555555971ef0 (gdb)
gfdsmrt IOhannes
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On 04/12/2018 01:11 PM, David Medine wrote:
After starting gdb --args etc. as in your example, and after calling run I get this:
[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Detaching after fork from child process 3889. [New Thread 0x7ffff61ff700 (LWP 3891)]
(Pd is on PID 3888 in this case)
and there is no gdb prompt.
i might have forgotten to mention that: after the initial "run", i manually terminate Pd (so it "hangs" for me as well and there is no gdb prompt, until i quit Pd). this first run is only there to make all the symbols known to gdb.
gfdsamr Iohannes
Hello,
Somme interrogation here with ALSA loopback and Pd.
I used to use ALSA loopback to route audio on my Linux and it works like a charm with ffmpeg : I send the audio to hw:1,0,0 and get it on hw:1,1,0. And the sound sounds good (no glitch).
With Pd, it is not the same. First I need to send the sound on hw:1,1,0 (for instance with ffmpeg) and get it on the card Loopback (in Pd). The sound is noisy.
So, my three questions :
Why the sound is noisy using Pd and how to solve this ? Why I need to send the sound to hw:1,1,0 (and not hw:1,0,0) to get it with Pd ? (not a problem actually) How can I get access to the other device of Loopback with Pd ?
It seems I miss something somewhere...
++
Jack
Le 12/04/2018 à 15:06, Jack a écrit :
Hello,
Somme interrogation here with ALSA loopback and Pd.
I used to use ALSA loopback to route audio on my Linux and it works like a charm with ffmpeg : I send the audio to hw:1,0,0 and get it on hw:1,1,0. And the sound sounds good (no glitch).
With Pd, it is not the same. First I need to send the sound on hw:1,1,0 (for instance with ffmpeg) and get it on the card Loopback (in Pd). The sound is noisy.
So, my three questions :
Why the sound is noisy using Pd and how to solve this ?
Adding latency solves this problem. ++
Jack
Why I need to send the sound to hw:1,1,0 (and not hw:1,0,0) to get it with Pd ? (not a problem actually) How can I get access to the other device of Loopback with Pd ?
It seems I miss something somewhere...
++
Jack
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Hello,
I have a problem to get all usable channels of the ALSA loopback in Pd.
Here the output of : $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: ALC3266 Analog [ALC3266 Analog] Subdevices: 0/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 7/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 7/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7
and of : $ arecord -l **** List of CAPTURE Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: ALC3266 Analog [ALC3266 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 7/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 7/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7
With Pd, if I select Loopback (hardware) with 8 in/out, i get in console : ALSA: set input channels to 2 ALSA: set output channels to 2
How can I recover the 8 channels of ALSA loopback to get all in/out ? Any help would be appreciated. ++
Jack
I don't understand how Pd or ALSA manage in/out. But I found a (weird or not ?) solution : I have to use several devices in Pd with 2 outputs each. So to get 6 inputs from ALSA loopback, I need 3 Loopback devices with 2 input channels in Pd (see small screen capture attached). Someone can confirm if this is the way to do things with Pd and ALSA loopback ?
However, if the quality of the sound thru the first stereo input is good, this is not the case with the second one (lot of glitch/noise). Sure I made something wrong here. So, if you have some recommandations, I will be happy to test them. ++
Jack
Le 12/04/2018 à 19:15, Jack a écrit :
Hello,
I have a problem to get all usable channels of the ALSA loopback in Pd.
Here the output of : $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: ALC3266 Analog [ALC3266 Analog] Subdevices: 0/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 7/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 7/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7
and of : $ arecord -l **** List of CAPTURE Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: ALC3266 Analog [ALC3266 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM] Subdevices: 7/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM] Subdevices: 7/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7
With Pd, if I select Loopback (hardware) with 8 in/out, i get in console : ALSA: set input channels to 2 ALSA: set output channels to 2
How can I recover the 8 channels of ALSA loopback to get all in/out ? Any help would be appreciated. ++
Jack
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list