Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a library that works along the executable file that I don't have its source.
when I use my library I get the segmentation fault error
I have used valgrind to understand reason of fault but I couldn't understand it
I think this happened because I can't make the executable by my self in debug mode
what do you suggest me for finding the segmentation fault reason?
Many thanks

What I have tried:

I ran the valgrind --track-origins ./myExecutable
the output is :
Conditional jump or move depends on uninitialised value(s)
at 0x400BF71: _dl_relocate_object (in /lib/ld-2.13.so)
by 0x4003054: dl_main (in /lib/ld-2.13.so)
by 0x4014E9D: _dl_sysdep_start (in /lib/ld-2.13.so)
by 0x4004AD8: _dl_start (in /lib/ld-2.13.so)
by 0x4000806: ??? (in /lib/ld-2.13.so)
Uninitialised value was created by a stack allocation
at 0x400B3A6: _dl_relocate_object (in /lib/ld-2.13.so)
Posted
Updated 6-Apr-23 21:45pm
Comments
Richard MacCutchan 8-Jan-20 8:32am    
Without the source code it will be extremely difficult to find the cause. If the fault occurs in your library then attaching the debugger may help.
Rick York 8-Jan-20 10:56am    
You description is not clear. Which thing do you not have the source of? It makes a big difference in how you approach debugging this problem.
saide_a 11-Jan-20 1:42am    
I don't have the executable source, I only have the library source file

The message already tells you pretty clearly the reason for this issue:
Quote:
Conditional jump or move depends on uninitialised value(s)

and
Quote:
Uninitialised value was created by a stack allocation

are quite hard not to understand.

As to the location of the code responsible for this allocation, this is something you will have to find out based on the symbols mentioned. It might be as simple as an attempt to copy data to an address specified by an uninitialized pointer.

Note that you can attach a debugger onto any running program, no matter how it's been built.

That said, what prevents you from running your own code in a debugger?
 
Share this answer
 
Quote:
Uninitialised value was created by a stack allocation

If I understand it correctly, you have the source code of a dynamic library ( shared libray) with the name ld-2.13.so. For this, someone has created an executable file, but the source code for it is not available. When using the library a "Segmentation Fault" occurs. Valgrind reports a place where an "uninitialized value was created by a stack assignment". So the error indicates that a local variable is used which is not initialized. Often it is a pointer.

1. I would assume that such an error is indicated in the source code of the library with the appropriate compiler flags or perhaps also with splint already with the production.

2.Even if the executable is neither in source code nor in debug mode the program can be started with a debugger. If you are lucky the debugger stops at the error location, otherwise you have to work your way to the error location. Without debug code it will probably be hard to work your way to the error location.

3. As Stefan_Lang already noted, you could write your own program to test the library. It would of course help to narrow down the error so that you don't have to test every function.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900