[lug] good assert library

D. Stimits stimits at attbi.com
Thu Sep 19 01:17:09 MDT 2002


Chan Kar Heng wrote:
> :)
> thanks.. it's cool...
> 
> i tried this... gcc -rdynamic -g -O0 a.c
> 
> and i get a lot of hex addresses instead of function names...
> is this the expected output?

I haven't used this code in about a year, I recall having only hex 
addresses until the right option combination was used. You might 
experiment with leaving out any -O#; but once it is found, it will give 
you not hex, but plain English function names. You might also find it 
varies with the version of glibc and gcc/g++ that you use, but I am not 
positive. If you can't find the right arguments to get symbolic output, 
I can experiment with some of my old code and find out. I doubt it 
matters, but one detail of the last project I used this on compiled and 
linked in separate Makefile stages, where the -rdynamic was only in the 
linker stage; the -g was only in the intermediate object compile stage. 
Separation of stages without going directly from .c to executeable could 
allow a finer-grained testing of compile switches.

> 
> 
> anyway, would you know what gets sent across network in
> the case where machine A runs an X opengl program that
> resides on machine B? (remote X)...

I believe there is an OpenGL intercept/proxy library that can be used to 
catch OpenGL calls and log them, sort of like ltrace or strace for 
normal library or system calls. What I don't know is if any of these are 
available under Linux, I know there are several under Win32. Some names 
for Win32 side, which might or might not have a Linux version:
  Chromium, glTrace, HijackGL, GPT, ZapDB

(and even if they do have Linux versions, they might not be what you 
want, and they might fail under remote X11)

You might be more interested in using a network sniffing tool on the X11 
port. There is a possibility that if compression is being used over the 
network, you could find the right arguments to make X11 *not* compress, 
to aid debugging.

> 
> either arguments of opengl function calls get sent or the
> rendered images on the window get compressed and sent.
> i'm wondering which... or maybe it works another way?

I couldn't answer that, you are at the driver level there, for both 
OpenGL and X11. X11 tends to have a surrogate copy of state on both 
machines, and what it actually sends depends on what calls are made; 
some information seeking requests will cause flushing of buffers and 
lower performance, whereas otherwise it can be allowed to throw out some 
values from unused events, if a series of events do not require the 
intermediate events. I doubt it matters that OpenGL is involved, except 
that there might be an X extension involved. Mostly I would say it is up 
to X protocols.

Knowing more about what you want to accomplish could help. The most 
common failure I've seen from just playing with it is that sometimes 
people try to use the X Shared Memory mechanism, and do not offer a way 
to turn it off...there is an underlying assumption in such code that the 
app is always running and displaying on the same machine (not a bad 
assumption if it is Win32 or Mac code that got ported to Linux/X11).

D. Stimits, stimits AT attbi.com

> 
> 
> thanks in advance again.. :)
> 
> rgds,
> 
> kh
> 
> At 2002/09/16 11:46, you wrote:
> 
>>Chan Kar Heng wrote:
>>
>>>hi!
>>>would anyone know of a good assert library??
>>>i'm particularly looking for one that dumps the function call stack...
>>>ansi assert merely reports the function that broke down.. but not
>>>the caller.. :(
>>>thanks in advance
>>>rgds,
>>>kh
>>>_______________________________________________
>>>Web Page:  http://lug.boulder.co.us
>>>Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>>>Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>>
>>I use this in some of my testing code (don't forget the -rdynamic):
>>
>>#include <execinfo.h>
>>#include <iostream>
>>
>>#ifdef _EXECINFO_H
>>void show_stackframe()
>>{
>>       void* trace[ 64 ];
>>       char** messages = NULL;
>>       int trace_size = 0;
>>       
>>       cerr << "Begin Stack Frame Dump" << endl;
>>       cerr << "(if useful symbols are not found, try recompiling "
>>               << "with -rdynamic during link, and -g without -O#)"
>>               << endl;
>>       trace_size = backtrace( trace, 64 );
>>       messages = backtrace_symbols( trace, trace_size );
>>       for( int i = 0; i < trace_size; ++i ) {
>>               cerr << "Traced: " << messages[i] << endl;
>>       }
>>       cerr << "End Stack Frame Dump" << endl;
>>}
>>#endif // _EXECINFO_H
> 
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
> 






More information about the LUG mailing list