Re: g_debug as bug fixer?



Hi, Michael!

Nothing strange -- g_debug calls changed stack layout in your
functions, and crash disappeared. Try using [f]printf instead
of g_debug, and, very likely, you'll get same effect. I've seen
that thousand times.

In your case, it is better to use debugger, like gdb, to see
backtrace at crash. Unfortunatelly, debugger may produce same
strange effect :)


-- 
Artur

21.12.09, 17:53, "Michael Libby" <michael c libby gmail com>:

I am the strangest thing with some C code I'm writing that uses glib.
I was having some issues with seg faults and/or corruption, so I
decided to try and track where it was happening by throwing a couple
of quick g_debug statements into my code.
But this had the effect of causing the error to go away. Not knowing
what I'd done that was fixing my code, but figuring I'd done
*something* I removed the g_debug's.
Back came the crashing program. So back to the g_debugs. Problem
solved. And so on. Whenever the g_debugs are there it runs, when they
are not, it fails.
Any ideas? If I can't resolve and no one has any ideas, I'll see if I
can isolate some code that replicates the issue, but what I can say
is: it's happening inside a glib unit test that uses a fixture and
seems to be happening when calling a function that allocates memory to
some struct members.
-Michael



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]