Segmentation fault during Transition of Control from C++ to Pro *C -


I have written in a small Pro * C / C ++ application [multi-threaded, daemon] where, * To get some DB records used and then call the C ++ function to generate the XML file, which is sent through the socket for the third party.

The problem is that, when called the c ++ function, this xml file is generating properly, but when it ends with SIG 11 error, from C ++ to Pro * C During the control of Here, I do not have any return parameters, as well, all the parameters of the C ++ function are static parameters.

The problem is coming in random after sensation, after creating two pairs of XML [which are generated from the same code]. The error is not stable in sensation, after generating 1 or 2 XML files, for the first time on run, during the second run in 5 seconds, and sometimes just 1 XML is generated.

So, not sure if this is related to any code problem, because it is generating XML files, properly, but a stack undining / stack corruption problem.

Any number in this field, will be very helpful.

In addition, working on HP Itanium with iam ap + compiler.

Here is the function declaration and how it is being called:

  / * ----------- - Pro * C: --- --- * / Generate XML (microgram_QUI_list, Providence_forms, iTride); / * Declaration: ----------- * / #ifdef __cplusplus extern "C" {void GenerateXML (constant Mic_Prov_List * Mic_Prov_Queue_List, constant Mic_Prov_Service_Params_info_x_t * Prov_Service_Params_Info, integer iThreadId); #ifdef __cplusplus  

Presented by Rupesh Magete

Chances are writing beyond the bounds of their GenerateXML function buffer and stack is being erased - Especially the return address. In this case, it seems that the XML output looks fine, but it crashes once you are not surprised at all at all.

I'm betting that there is a buffer or some sort of array between the first few variables declared in GenerateXML

Edit :

< p> (OP a four buffer declared size Jeneretaksmel think that is indicated in the comments)

Yes, you write more than 1000 bytes in the buffer that (if that position Write buffer [1000] or higher), you get corrupt things - in your case, you are getting corrupted in the function value

To address where your code is doing it is difficult You have a few options:

  • Inspect the code by hand And try to find the place where this is happening;
  • To debug scatter emphasis (n & lt; 1000) before each access [n] and use the debugger to determine what has happened;
  • Run it under the debugger, buffer [99 9] on Vocpoint set, then the trigger after seeing single phase after the clock factor when it access buffer [1000];
  • Run it under a code analysis tool such as valgrind or purify

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -