Hi all,
I have a real pickle in trying to debug Pd. Namely, when I grep-ed every single instance of pdtk_canvas_getscroll and commented it out, it still gets invoked somehow and I am at a loss how. I know it occurs as many times as there are objects selected that have been moved (so it is definitely per-object)
The only thing I managed to isolate so far is the following code: g_editor.c
void gobj_displace(t_gobj *x, t_glist *glist, int dx, int dy) { if (x->g_pd->c_wb && x->g_pd->c_wb->w_displacefn) (*x->g_pd->c_wb->w_displacefn)(x, glist, dx, dy); }
I am however unable to decipher what function is exactly being called by (*x->g_pd->c_wb->w_displacefn). I only found in g_canvas.h definition of w_displacefn as part of _widgetbehavior struct but nowhere (except in iemgui objects) is it linked to anything I can actually understand. Where does this struct get initialized?
Any help on this one would be most appreciated as that will put a stop on me pulling my hairs out :-)
Best wishes,
Ico
Never mind... My brain finally decided to get out of bed and join me in my office... Apologies for spam...
On Thu, 2010-11-18 at 11:22 -0500, Ivica Ico Bukvic wrote:
Hi all,
I have a real pickle in trying to debug Pd. Namely, when I grep-ed every single instance of pdtk_canvas_getscroll and commented it out, it still gets invoked somehow and I am at a loss how. I know it occurs as many times as there are objects selected that have been moved (so it is definitely per-object)
The only thing I managed to isolate so far is the following code: g_editor.c
void gobj_displace(t_gobj *x, t_glist *glist, int dx, int dy) { if (x->g_pd->c_wb && x->g_pd->c_wb->w_displacefn) (*x->g_pd->c_wb->w_displacefn)(x, glist, dx, dy); }
I am however unable to decipher what function is exactly being called by (*x->g_pd->c_wb->w_displacefn). I only found in g_canvas.h definition of w_displacefn as part of _widgetbehavior struct but nowhere (except in iemgui objects) is it linked to anything I can actually understand. Where does this struct get initialized?
Any help on this one would be most appreciated as that will put a stop on me pulling my hairs out :-)
Best wishes,
Ico
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Thu, 18 Nov 2010, Ivica Ico Bukvic wrote:
I have a real pickle in trying to debug Pd. Namely, when I grep-ed every single instance of pdtk_canvas_getscroll and commented it out, it still gets invoked somehow and I am at a loss how. I know it occurs as many times as there are objects selected that have been moved (so it is definitely per-object)
Use <execinfo.h>'s backtrace() so that sys_vgui prints the name of the calling function just before each line is printed while in -d 1 mode.
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
On Nov 18, 2010, at 12:50 PM, Mathieu Bouchard wrote:
On Thu, 18 Nov 2010, Ivica Ico Bukvic wrote:
I have a real pickle in trying to debug Pd. Namely, when I grep-ed
every single instance of pdtk_canvas_getscroll and commented it
out, it still gets invoked somehow and I am at a loss how. I know
it occurs as many times as there are objects selected that have
been moved (so it is definitely per-object)Use <execinfo.h>'s backtrace() so that sys_vgui prints the name of
the calling function just before each line is printed while in -d 1
mode.
That sounds useful, do you have an example of how that you could share?
.hc
Programs should be written for people to read, and only incidentally
for machines to execute.
On Thu, 18 Nov 2010, Hans-Christoph Steiner wrote:
That sounds useful, do you have an example of how that you could share?
There's short_backtrace in gridflow/src/gridflow.cxx
And there's another similar thing in segfault.cxx
They also use <cxxabi.h> to decode C++ symbols (those that start with _Z)
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
Hi Mathieu,
This is a great advice! However, when adding blargh() function from the gridflow.c inside the sys_vgui (s_inter.c) so that when the debug is on it outptus a trace for each call, it appears it only manages to do one level which is obviously the sys_vgui call itself. Why is it not able to trace further back?
void blargh(void) { #ifdef MACOSX fprintf(stderr,"unhandled exception\n"); #else int i; void *array[25]; int nSize = backtrace(array, 25); char **symbols = backtrace_symbols(array, nSize); for (i=0; i<nSize; i++) fprintf(stderr,"%d: %s\n",i,symbols[i]); free(symbols); #endif }
void sys_vgui(char *fmt, ...) {
<snip>
if (sys_debuglevel & DEBUG_MESSUP) {
blargh();
fprintf(stderr, "%s", sys_guibuf + sys_guibufhead);
}
<snip>
}
Before you invest too much time in that, you should know that that
stuff has changed a lot in 0.43, so its likely anything you did in
0.42 would not apply to 0.43
.hc
On Nov 21, 2010, at 10:40 AM, Ivica Ico Bukvic wrote:
Hi Mathieu,
This is a great advice! However, when adding blargh() function from
the gridflow.c inside the sys_vgui (s_inter.c) so that when the debug is
on it outptus a trace for each call, it appears it only manages to do one level which is obviously the sys_vgui call itself. Why is it not
able to trace further back?void blargh(void) { #ifdef MACOSX fprintf(stderr,"unhandled exception\n"); #else int i; void *array[25]; int nSize = backtrace(array, 25); char **symbols = backtrace_symbols(array, nSize); for (i=0; i<nSize; i++) fprintf(stderr,"%d: %s\n",i,symbols[i]); free(symbols); #endif }
void sys_vgui(char *fmt, ...) {
<snip>
if (sys_debuglevel & DEBUG_MESSUP) { blargh(); fprintf(stderr, "%s", sys_guibuf + sys_guibufhead); }
<snip>
}
"A cellphone to me is just an opportunity to be irritated wherever you
are." - Linus Torvalds