473,803 Members | 3,619 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 17550

"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
2201
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
15949
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
3277
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
2958
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
7802
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
1595
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
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9566
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
10555
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...
0
10317
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10300
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5503
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
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.