473,834 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

debugging question

I have a debugging question w.r.t core dumps with signal 4 Illegal
instruction messages.

I analyzed the core file through gdb. In simple english following is the
pattern observed:

I have an program with a piece of code -lets call it function1() that gets
called by different callers. This function is executed 1000 's of times as
while the binary is run and it works fine.

However, under some strange circumstances (which is not reproducable
consistently) if the call sequence happens to have a specific
function_root() in the stack, the binary crashed in function1() with a
signal 4 illegal argument exception. This never happens at the same place in
the code.

The crash stack looks as follows:
function1() {
...some code
......
.....
returncode = function2(..... ..); -------------------------> crashes on this
line
....
}

When I look at the code in function1 and beyond it looks all clean.

These are the following questions i have:

1) Is it posibble to identify from the core dump whether its a stack
corruption. what are the other posibbilities.
2) Is there any systematic process to be followed to identify the victim of
the corruption followed by the actual culprit

Please advice.
Nov 13 '05 #1
2 17552

"hpoliset" <hp******@sbcgl obal.net> wrote in message
news:V6******** *********@newss vr29.news.prodi gy.com...
I have a debugging question w.r.t core dumps with signal 4 Illegal
instruction messages. [snip] However, under some strange circumstances (which is not reproducable
consistently) if the call sequence happens to have a specific
function_root() in the stack, the binary crashed in function1() with a
signal 4 illegal argument exception.
Well, I do not get it. Illegal instruction or illegal argument???

Illegal instruction means in most cases:
1) The return address of the called function was corrupted (stack corruption),
and when executing a return instruction the program jumps anywhere, in this
case in a place that contained no instructions, probably into a data space, or
somewhere.
To trap this kind of problem, lcc-win32 offers you a g4 debug level, that injects instructions
before executing a return to save the frame pointer in a global variable, that is later interpreted
to output the name of the faulty function. Other compilers
may use different schemas.

2) A function pointer was used that wasn't initialized, or become invalid because the
code it is pointing to was unloaded (dynamic library unloading too early).

3) A function declared with _stdcall callig convention was called without prototype
or with a wrong prototype. Under windows this is catched by the linker but other
systems may be different.

Look for temporary buffer variables like:
char tmpbuf[28];

Are there any strcpy memcpy or similar functions called with those variables?

Look for any function pointer calls. Are those pointers valid?
This never happens at the same place in
the code.


This would be consistent with a buffer overflow that only happens in special
circumstances, not always.

Good luck

jacob
Nov 13 '05 #2

"hpoliset" <hp******@sbcgl obal.net> wrote in message

However, under some strange circumstances (which is not
reproducable consistently) if the call sequence happens to have a
specific function_root() in the stack, the binary crashed in function1()
with a signal 4 illegal argument exception. This never happens at the
same place in the code.
If the crash doesn't show up consistently, this makes it very hard to debug.
Try to create a situation where the bug is reproducible, maybe by commenting
out sections of code, or feeding the program the same data set.
1) Is it posibble to identify from the core dump whether its a stack
corruption. what are the other posibbilities.
If the error code is "illegal argument" that would imply that the arguments
to the function have been corrupted. Arguments are not necessarily passed on
the stack. It could be that the caller is loading bad data into a register.
2) Is there any systematic process to be followed to identify the victim > of the corruption followed by the actual culprit

Unfortunately you are unlikely to have a "stack integrity check" function
supplied. A debugger will tell you where the program crashed, so you know
that the arguments to that function are corrupt. This probably means that
the error is in the caller (you could try writing a stub version of the
function that crashed, that adds one to each of its arguments, and see if
the program still crashes in the same place. This would rule out the callee
as a source of the crash.)
However the calling function could be fine, but be itself called with
invalid data. There is no magic bullet. You just have to trace back the
program flow until you come to the problem.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2206
by: Steve Anderson | last post by:
Please excuse my ignorance as I'm fairly new to ASP. We have IIS running on Win2000 and serving out an ASP application. I installed the script debugger tonight. IE6 on the machine has Disable Script Debugging unchecked. I set the server side debugging for the www in question. I have a Stop statement in the VBScript code in a certain page, and yet the debugger does not stop on the page in question, it does nothing. If I open up the .asp...
5
15952
by: Bob Bamberg | last post by:
Hello All, I have been trying without luck to get some information on debugging the Runtime Error R6025 - Pure Virtual Function Call. I am working in C++ and have only one class that is derived from an Abstract class, I do not believe that this class object is causing me my problem. Below is that message I have posted before to other groups. Question:
0
3232
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs converted/developed with VB.NET. What I want from debugging is to be able to step into the methods in the DLLs called from ASP scripts using Visual Studio .NET. Background: For typical script debugging issues, you can read and follow the two documents on...
7
3165
by: Frank | last post by:
I'm running a mixed ASP / ASP.NET environment. I can use the debugger in for the ASP.NET code, no problems. But when I turn on ASP Debugging for the project, I get the error message: "Error while trying to run project. Unable to start debugging. ASP debugging is disabled because the ASP process is running as a user that does not have debug permissions. Click Help for more information." This is Windows 2003 Server, logged in as...
2
3278
by: Alex Clark | last post by:
Hi All, My system: WinXP Pro, VS.NET 2003, SQL Server Personal Edition. I'm having problems with my old favourite demon, SQL Debugging from within VS.NET. I have to say I've found this particular feature to be one of the most useful and (sadly) unreliable/fragile features in VS.NET, it seems the slightest thing will break it.
5
2960
by: Velvet | last post by:
Can someone tell me to what process I need to attach to be able to step through my classic ASP code in VS.net 2003. I'm working on an XP box with IIS installed. I also have VS.net 2005 (The final, never installed beta) installed on this box if it makes a difference (I did not install VS Development Web Server as I'm already using the XP web server). I've seen that I need to attach to the native IIS engine, but I don't know what it's...
0
1047
by: Günter Prossliner | last post by:
Hi everybody! The same question I have asked about one week ago in the german asp.net newsgroup, but no one was able to answer the question. Maybe someone is able to in this group! I currently developing a complex framework (based on ASP.Net 2.0), witch uses features like ExpressionBuilders and Controls with ITemplate Properties. By using this kind of functionality, I am able to control (a
8
2217
by: razael1 | last post by:
I am putting debugging messages into my program by putting blocks that look like this: #ifdef DEBUG errlog << "Here is some information"; #endif All these #ifdef blocks make the code bulky and harder to read, so I'd like to do something where I put: errMsg("Here is some information");
5
7804
by: phnimx | last post by:
Hi , We have developed a number of plug-in .NET Library Components that we typically deploy with our various applications by installing them into the GAC. Each of the applications contains an app.config file referencing arbitrary versions of the plug-in components they wish to consume. Here's the problem: Assuming I have installed any one of our application software,
0
1597
by: Peted | last post by:
I suspect there is a better forum for this question, but i couldnt find it. If someone could point me in the right direction or help me with this question it would be muchly appreciated I have setup a remote debugging session between my local PC with the source code in c# vs2008 and an XP image with the application running in a VMware image running, on another networked PC. My local pc is part of a domain, the server running the vmware...
0
9651
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10800
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7762
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5629
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5800
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3987
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3085
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.