[PD-dev] Double precision externals extensions.

Christof Ressi christof.ressi at gmx.at
Wed Dec 11 00:53:19 CET 2019


We must find out where exactly the segfault happens. You can either look up how to set breakpoints and step through the code, or use good 'ol printf debugging :-)

> Gesendet: Mittwoch, 11. Dezember 2019 um 00:31 Uhr
> Von: "Lucas Cordiviola" <lucarda27 at hotmail.com>
> An: "pd-dev at lists.iem.at" <pd-dev at lists.iem.at>, "Christof Ressi" <christof.ressi at gmx.at>
> Betreff: Re: [PD-dev] Double precision externals extensions.
>
> This is the backtrace with Msys2:
> 
> ~~~~~~~~~~~~~~~~~~
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x000000006eb469f5 in pddplink_setup ()
>     from /d/00-lucarda-external-dep/out64single-new-cyc/lucdep/liblucdep.dll
> (gdb) bt
> #0  0x000000006eb469f5 in pddplink_setup ()
>     from /d/00-lucarda-external-dep/out64single-new-cyc/lucdep/liblucdep.dll
> #1  0x000000006eb41467 in liblucdep_setup ()
>     from /d/00-lucarda-external-dep/out64single-new-cyc/lucdep/liblucdep.dll
> #2  0x00000000673e8c85 in sys_trylock ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #3  0x00000000673e9304 in sys_loadlib_iter ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #4  0x0000000067374ed5 in pd!canvas_declare ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #5  0x00000000673e95e8 in sys_load_lib ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #6  0x00000000673747d8 in pd!glist_menu_open ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #7  0x0000000067374c7d in pd!canvas_declare ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #8  0x00000000673d68db in pd!binbuf_eval ()
> --Type <RET> for more, q to quit, c to continue without paging--
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #9  0x00000000673d73f6 in pd!binbuf_evalfile ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #10 0x0000000067379977 in pd!glob_evalfile ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #11 0x00000000673e9789 in sys_run_scheduler ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #12 0x00000000673ea6ec in pd!glob_initfromgui ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #13 0x00000000673d68db in pd!binbuf_eval ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #14 0x00000000673e75bd in socketreceiver_read ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #15 0x00000000673e6906 in sys_oktoloadfiles ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> --Type <RET> for more, q to quit, c to continue without paging--
> #16 0x00000000673e825b in sys_pollgui ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #17 0x00000000673dfdda in pd!m_mainloop ()
>     from 
> /c/Users/Lucarda/Downloads/pure-data-double-precision/build4/pd-0.50.2-double/bin/pd.dll
> #18 0x00000000004013b4 in ?? ()
> #19 0x00000000004014db in ?? ()
> #20 0x00007fffdec01611 in KERNEL32!BaseThreadInitThunk ()
>     from /c/Windows/system32/KERNEL32.DLL
> #21 0x00007fffdfb764ad in ntdll!RtlUserThreadStart ()
>     from /c/Windows/SYSTEM32/ntdll.dll
> #22 0x0000000000000000 in ?? ()
> Backtrace stopped: previous frame inner to this frame (corrupt stack?)
> (gdb)
> 
> ~~~~~~~~~~~~~
> 
> Mensaje telepatico asistido por maquinas.
> 
> On 12/10/2019 8:07 PM, Lucas Cordiviola wrote:
> > Thx
> >
> > :)
> >
> > Mensaje telepatico asistido por maquinas.
> >
> > On 12/10/19 7:59 PM, Christof Ressi wrote:
> >>> How do I install gdb in msys2?
> >> pacman -S gdb
> >>
> >> Execute in MinGW32 shell and MINGW64 shell accordingly
> >>
> >>> How do I use it?
> >> gdb --args pd [arguments]
> >>> run // actually run the program
> >> ... wait for crash ...
> >>> bt // get the backtrace
> >> press Enter repeatedly to see more lines
> >>
> >> Christof
> >>
> >>> Gesendet: Dienstag, 10. Dezember 2019 um 22:59 Uhr
> >>> Von: "Lucas Cordiviola" <lucarda27 at hotmail.com>
> >>> An: "pd-dev at lists.iem.at" <pd-dev at lists.iem.at>, "Christof Ressi" <christof.ressi at gmx.at>
> >>> Betreff: Re: [PD-dev] Double precision externals extensions.
> >>>
> >>> @christof
> >>>
> >>> How do I build Pd with debug symbols?
> >>>
> >>> How do I install gdb in msys2?
> >>>
> >>> How do I use it?
> >>>
> >>> or can I send you the .dll lib and test patch do you get the backtrace?
> >>>
> >>>
> >>> --
> >>>
> >>> Mensaje telepatico asistido por maquinas.
> >>>
> >>> On 12/10/19 6:48 PM, Christof Ressi wrote:
> >>>>>> # pkgs including both single- and double-precision externals
> >>>>>> a single external binary (say: "foo.dll") can hold both single-precision
> >>>>>> and double-precision variants of the [foo] object.
> >>>> I'm also interested in how this works. The following solution popped up in my head: compile the object twice, one time with -DPD_FLOATSIZE=32 and another time with -DPD_FLOATSIZE=64, with different setup functions based on -DPD_FLOATSIZE, then link it with a third file which exports the "real" setup function (which calls the other two private setup functions).
> >>>>
> >>>> Is there an easier way?
> >>>>
> >>>> If not, then a new extension could be handy, so people can throw both versions into the same folder.
> >>>>
> >>>> Christof
> >>>>
> >>>>> Gesendet: Dienstag, 10. Dezember 2019 um 21:45 Uhr
> >>>>> Von: "Lucas Cordiviola" <lucarda27 at hotmail.com>
> >>>>> An: "pd-dev at lists.iem.at" <pd-dev at lists.iem.at>
> >>>>> Betreff: Re: [PD-dev] Double precision externals extensions.
> >>>>>
> >>>>> On 12/10/2019 4:54 PM, IOhannes m zmölnig wrote:
> >>>>>> # avoiding crashes
> >>>>>> an external that has been compiled with single-precision will not
> >>>>>> register objectclasses in a double-precision Pd - so the doubl-precision
> >>>>>> Pd will not know about those new objects and not crash while using them.
> >>>>>> same goes for the other way round.
> >>>>> I see with normal externals itt refuses to load and thats fine.
> >>>>>
> >>>>> But I'm creating a single binary external with a collection of authors
> >>>>> [zexy] [cyclone] [ggee] [pddplink] ...
> >>>>>
> >>>>> I create a setup for the lib and is working *OK* in Pd-w64-32 but it
> >>>>> crashed the double precision.
> >>>>>
> >>>>> this is my wrapper setup:
> >>>>>
> >>>>> ~~~~~~~~~~~~~~~~~~
> >>>>>
> >>>>> #include "m_pd.h"
> >>>>>
> >>>>> #include <stdio.h>
> >>>>> #include <stdarg.h>
> >>>>>
> >>>>>
> >>>>> #ifdef __WIN32__
> >>>>> # define vsnprintf _vsnprintf
> >>>>> #endif
> >>>>>
> >>>>>
> >>>>>
> >>>>> typedef struct liblucdep {
> >>>>>       t_object t_ob;
> >>>>> } t_liblucdep;
> >>>>>
> >>>>> t_class *liblucdep_class=NULL;
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> static void *liblucdep_new(void)
> >>>>> {
> >>>>>       t_liblucdep *x = (t_liblucdep *)pd_new(liblucdep_class);
> >>>>>       return (x);
> >>>>> }
> >>>>>
> >>>>> void liblucdep_setup(void)
> >>>>> {
> >>>>>
> >>>>>       post("*******************");
> >>>>>       post("liblucdep loaded.");
> >>>>>       post("*******************");
> >>>>>
> >>>>>       liblucdep_class = class_new(gensym("liblucdep"), liblucdep_new, 0,
> >>>>> sizeof(t_liblucdep), 0, 0);
> >>>>>
> >>>>>
> >>>>>       /* ************************************** */
> >>>>>       coll_setup();
> >>>>>       comment_setup();
> >>>>>       freeverb_tilde_setup();
> >>>>>       glue_setup();
> >>>>>       helplink_setup();
> >>>>>       image_setup();
> >>>>>       pddplink_setup();
> >>>>>       pink_tilde_setup();
> >>>>>       reson_tilde_setup();
> >>>>>       tabminmax_setup();
> >>>>>       time_setup();
> >>>>>       z_tilde_setup();
> >>>>> }
> >>>>>
> >>>>>
> >>>>> ~~~~~~~~~~~~~~~~~
> >>>>>
> >>>>>
> >>>>>> # pkgs including both single- and double-precision externals
> >>>>>> a single external binary (say: "foo.dll") can hold both single-precision
> >>>>>> and double-precision variants of the [foo] object.
> >>>>> How is that?
> >>>>>
> >>>>> As I am willing to contribute to the w32/64-double Deken.
> >>>>>
> >>>>>
> >>>>> :)
> >>>>>
> >>>>> Mensaje telepatico asistido por maquinas.
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> Pd-dev mailing list
> >>>>> Pd-dev at lists.iem.at
> >>>>> https://lists.puredata.info/listinfo/pd-dev
> >>>>>
> >>>> _______________________________________________
> >>>> Pd-dev mailing list
> >>>> Pd-dev at lists.iem.at
> >>>> https://lists.puredata.info/listinfo/pd-dev
> >>
> >> _______________________________________________
> >> Pd-dev mailing list
> >> Pd-dev at lists.iem.at
> >> https://lists.puredata.info/listinfo/pd-dev
> > _______________________________________________
> > Pd-dev mailing list
> > Pd-dev at lists.iem.at
> > https://lists.puredata.info/listinfo/pd-dev
>





More information about the Pd-dev mailing list