[Gambas-devel] System error... (42)

Ron ron at ...572...
Sat Oct 8 12:35:45 CEST 2011


Why cant i print errno?

(gdb) f 2
(gdb) l gbx_watch.c:504
499 something_done = TRUE;
500 }
501 else if (ret < 0)
502 {
503 if (errno != EINTR)
504 THROW_SYSTEM(errno, NULL);
505 something_done = TRUE;
506 }
507
508 if (EVENT_check_post())
(gdb) print ret
$5 = -1
(gdb) print errno
Cannot find shared library `/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.13.so'
in dynamic linker's load module list


Regards,
Ron_2nd.
2011/10/8 Ron <ron at ...572...>

> (gdb) l gbx_watch.c:504
> 499 something_done = TRUE;
> 500 }
> 501 else if (ret < 0)
> 502 {
> 503 if (errno != EINTR)
> 504 THROW_SYSTEM(errno, NULL);
> 505 something_done = TRUE;
> 506 }
> 507
> 508 if (EVENT_check_post())
>
>
>
> 2011/10/8 Ron <ron at ...572...>
>
>> It took much longer than normal, but I got a hit...
>>
>> THROW system error from ?
>>
>> Program received signal SIGTRAP, Trace/breakpoint trap.
>> THROW (code=42) at gb_error.c:285
>> 285 va_start(args, code);
>> (gdb) bt
>> #0  THROW (code=42) at gb_error.c:285
>> #1  0x00000000004053af in THROW_SYSTEM (err=0, path=0x0) at gb_error.c:325
>> #2  0x000000000042b03e in do_loop (wait=0x0) at gbx_watch.c:504
>> #3  0x000000000042b0a0 in WATCH_loop () at gbx_watch.c:530
>> #4  0x000000000042ca1d in main (argc=1, argv=0x7fffffffe3b8) at gbx.c:352
>> (gdb)
>> (gdb) p DEBUG_get_position(EXEC_current.cp, EXEC_current.fp,
>> EXEC_current.pc)
>> $1 = 0x43e540 "?"
>>
>>
>> Anything else I can get from this?
>>
>> Regards,
>> Ron.
>>
>>
>>
>> 2011/10/5 Benoît Minisini <gambas at ...1...>
>>
>>> > Benoit,
>>> >
>>> > I got this just now after uncommenting the lines in gb_error.c:
>>> >
>>> > THROW system error from ?
>>> > ERROR: #42: System error. Success
>>> >
>>> > Program exited with code 01.
>>> > (gdb) bt
>>> > No stack.
>>> > (gdb)
>>> >
>>> > So clearly  DEBUG_get_current_position() returns only a ?
>>> > And no backtrace/stack.
>>> > What does this mean?
>>> > What can we get for other info?
>>> > Do we need to print debug info earlier in the code?
>>> >
>>> > It does this several times a day, so we should be able to get more info
>>> > this time...
>>> >
>>> > To be clear, it's  the latest Gambas2 code on 64 bit ubuntu natty,
>>> > DomotiGaServer is a command line project.
>>> > The GUI project DomotiGa (which also has most of the DomotiGaServer
>>> code in
>>> > it), doesn't have this problem...
>>> >
>>> > Any pointers are welcome...
>>> >
>>> > Regards,
>>> > Ron.
>>> >
>>>
>>> You have to compile the interpreter with no optimizations, and put that
>>> in the
>>> THROW function:
>>>
>>>        if (code == E_SYSTEM)
>>>        {
>>>     fprintf(stderr, "THROW system error from %s\n",
>>>            DEBUG_get_current_position());
>>>           BREAKPOINT();
>>>        }
>>>
>>> It's the same thing as the code you already uncommented, with the
>>> 'BREAKPOINT()' macro added.
>>>
>>> Then you must run your program into gdb, and wait for the BREAKPOINT()
>>> line to
>>> be reached. Then gdb will stop that, and the 'bt' will be useful (which
>>> is
>>> not, of course, when then program is terminated!)
>>>
>>> Regards,
>>>
>>> --
>>> Benoît Minisini
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20111008/2a897b78/attachment.html>


More information about the Devel mailing list