During the implementation of ".png" files with transparency in an OpenGL program I somewhat inadvertently introduced a SIGSEGV by inappropriately defining the scale of a malloc(size) structure which defines by bytes and I was creating a table of void*, and in a strange way, I was purposely introducing a fault by ignoring my certain assumption that allocating too small a space would lead to an error.
So an error occurred and the only output was a single frivolous error message:
printf("Apoptosis is likely on SIGSEGV!\n");
As a result, I started to debug the fault code to see why it was not working and displaying what I expected. It seems that I had removed the register display and so I uncommented that which gave me some information, but no address information. I added the "-g" option to gcc to include symbols and expected :
sprintf(someString,"addr2line %p -f -e ElfExec",bt[i])to work.
system(someString)
I had limited references to those in the range 0x400000-0x420000, which had worked in the past.Oddly, when I did "objdump -d ElfExec" it showed that it was now 0x8040000 and above. I have no answer to why the address ranges are changed, but it must be a Linux kernel change that I was not aware of.
I had recompiled with "-g" and still I got no symbols and file name + line came out as ??:0, which implies it could not find the symbols. So the problem was that part of the object files were already up to date and not recompiled, so I used "touch *.c" then "make" and symbols were found.
So I went to the offending line and made malloc(size*8) for the list and it stopped faulting. Then I had to add the following to the texture display to create the appearance of transparency.
glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
0 comments:
Post a Comment