Hi All,
I am facing a strange problem..
I am calling a function func2 from func1. Before calling func2 all
the local variables in func1 looks fine and has their respective
values. When function returns back from func2 to func1 all the local
variables in func1 has values 0xfdfdfd.
Can somebody please explain me what is happening and what is the
solution for this?
Thanks
Trupti 8 1941 Sa***********@g mail.com wrote:
I am facing a strange problem..
I am calling a function func2 from func1. Before calling func2 all
the local variables in func1 looks fine and has their respective
values. When function returns back from func2 to func1 all the local
variables in func1 has values 0xfdfdfd.
Can somebody please explain me what is happening and what is the
solution for this?
That sounds very much like stack corruption or deletion of something
that was allocated outside of the free store (both are instances of
undefined behaviour). Without seeing what 'func2' does it is impossible
to give you a specific recommendation, but see if it tries to call
delete on a pointer to some 'func1's local data.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Hi All,
>
* I am facing a strange problem..
I am calling a function func2 from func1. *Before calling func2 all
the local variables in func1 looks fine and has their respective
values. *When function returns back from func2 to func1 all the local
variables in func1 has values 0xfdfdfd.
*Can somebody please explain me what is happening and what is the
solution for this?
Post some code so we can take a look at it.
On Mon, 16 Jun 2008 06:41:18 -0700, Sa***********@g mail.com wrote:
Hi All,
I am facing a strange problem..
I am calling a function func2 from func1. Before calling func2 all the
local variables in func1 looks fine and has their respective values.
When function returns back from func2 to func1 all the local variables
in func1 has values 0xfdfdfd.
Can somebody please explain me what is happening and what is the
solution for this?
Post code. http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
--
Lionel B
"Sa***********@ gmail.com" <Sa***********@ gmail.comwrites :
Hi All,
I am facing a strange problem..
I am calling a function func2 from func1. Before calling func2 all
the local variables in func1 looks fine and has their respective
values. When function returns back from func2 to func1 all the local
variables in func1 has values 0xfdfdfd.
Can somebody please explain me what is happening and what is the
solution for this?
There's probably a "buffer overflow" or some other kind of overrun in
the local variables of func2. In the usual processors, the stack
grows downward, and the local variables are allocated on the stack.
So the local variables of func2 are stored before the the local
variables of func1, and if you write beyond the bounds of the local
variables of func2, you can erase the frame pointers, the return
addresses and the local variables of the calling procedures.
The solution would be to debug func2.
--
__Pascal Bourguignon__
On Jun 16, 7:34*pm, p...@informatim ago.com (Pascal J. Bourguignon)
wrote:
"Samant.Tru...@ gmail.com" <Samant.Tru...@ gmail.comwrites :
Hi All,
* I am facing a strange problem..
I am calling a function func2 from func1. *Before calling func2 all
the local variables in func1 looks fine and has their respective
values. *When function returns back from func2 to func1 all the local
variables in func1 has values 0xfdfdfd.
*Can somebody please explain me what is happening and what is the
solution for this?
There's probably a "buffer overflow" or some other kind of overrun in
the local variables of func2. *In the usual processors, the stack
grows downward, and the local variables are allocated on the stack.
So the local variables of func2 are stored before the the local
variables of func1, and if you write beyond the bounds of the local
variables of func2, you can erase the frame pointers, the return
addresses and the local variables of the calling procedures.
The solution would be to debug func2.
--
__Pascal Bourguignon__
Thank you for quick reply for my query. It is not possible for me to
post code. It is a big application and lots of variables.
I will try to debug it according your suggestions. Please post me
some more suggestions if any.
Trupti Sa***********@g mail.com wrote:
On Jun 16, 7:34 pm, p...@informatim ago.com (Pascal J. Bourguignon)
wrote:
>"Samant.Tru... @gmail.com" <Samant.Tru...@ gmail.comwrites :
>>Hi All, I am facing a strange problem.. I am calling a function func2 from func1. Before calling func2 all the local variables in func1 looks fine and has their respective values. When function returns back from func2 to func1 all the local variables in func1 has values 0xfdfdfd. Can somebody please explain me what is happening and what is the solution for this?
There's probably a "buffer overflow" or some other kind of overrun in the local variables of func2. In the usual processors, the stack grows downward, and the local variables are allocated on the stack. So the local variables of func2 are stored before the the local variables of func1, and if you write beyond the bounds of the local variables of func2, you can erase the frame pointers, the return addresses and the local variables of the calling procedures.
The solution would be to debug func2.
-- __Pascal Bourguignon__
Thank you for quick reply for my query. It is not possible for me to
post code. It is a big application and lots of variables.
I will try to debug it according your suggestions. Please post me
some more suggestions if any.
Make sure that your debugger allows you to watch a memory location.
Once you choose change in what variable you want to watch for, point
your memory location to the address of that variable and step through
the 'func2' while watching what happens to the memory. Find what action
makes the memory contents go from what they were to 0xfd. Look at the
action and understand it.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
"Sa***********@ gmail.com" <Sa***********@ gmail.comwrites :
Thank you for quick reply for my query. It is not possible for me to
post code. It is a big application and lots of variables.
I will try to debug it according your suggestions. Please post me
some more suggestions if any.
Well, given this kind of behavior (of your program), it might be very
useful for you to run it under valgrind. You will probably find a
lot of bugs with valgrind. http://valgrind.org/
--
__Pascal Bourguignon__ pj*@informatima go.com (Pascal J. Bourguignon) kirjutas:
"Sa***********@ gmail.com" <Sa***********@ gmail.comwrites :
>Thank you for quick reply for my query. It is not possible for me to post code. It is a big application and lots of variables. I will try to debug it according your suggestions. Please post me some more suggestions if any.
Well, given this kind of behavior (of your program), it might be very
useful for you to run it under valgrind. You will probably find a
lot of bugs with valgrind.
http://valgrind.org/
Valgrind only runs on Linux (according to the info they give on the
page). I don't know what OP uses, but the value 0xfdfdfdfd looks like it
might be produced by Microsoft VC++ Debug build. If this is the case,
0xfd is used for no-mans land safety buffers before and after a user-
allocated object. If you are seeing this value in your data objects, you
have somehow corrupted your heap or accessing objects whose lifetime has
already ended earlier and have been overwritten by some other objects.
However, VC++ has a quite fine debugger, you can place a data breakpoint
to monitor a specific memory location as suggested already by somebody
else, and find out when and why it changes.
HTH
Paavo This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rigs |
last post by:
Hi,
Does anyone happen to have a debug script that will display the variable
name and value for all of the local variables on an .asp page? (not session
nor application, as I already have scripts those.) I'm looking for
something that can be included in an .asp to write out values for debugging.
Does anyone know what scope those variables reside in?
Please help if you can.
|
by: pertheli |
last post by:
I am in a situation where only "goto" seems to be the answer for my
program logic where I have to retry calling some repeated functions.
Can anybody help in the usage of goto and its effect in local
variables, as shown in the stripped code below
void MyClass:Process(){
int iMaxRetry = 100;
|
by: Einar |
last post by:
Hi,
I wonder if there is a nice bit twiddling hack to compare a large
number of variables?
If you first store them in an array, you can do:
for (i = 0; i < n; i++) {
if (array != value) {
/* array differs from value, do something*/
|
by: pauldepstein |
last post by:
Sorry in advance if this message sounds imprecise but it's difficult to
be precise when you don't really understand what's going on.
I have a class called Parameters. The default constructor
Parameter:Parameter() contains various values such as interest = 0.05;
My intent is for the user to be able to override these defaults so I
have a function
void Parameter::set(void) . This is supposed to give the user a chance
|
by: Sandra-24 |
last post by:
Is there a way in python to add the items of a dictionary to the local
function scope? i.e. var_foo = dict. I don't know how many
items are in this dictionary, or what they are until runtime.
exec statements are difficult for debuggers to deal with, so as a
workaround I built my code into a function and saved it in a .py file.
The I load the .py file as a module and call the function instead. This
works great, and it has the added...
| |
by: Michal Kwiatkowski |
last post by:
Hi!
I'm building a class that most of methods have similar intro, something
like this:
def method(self):
var_one = self.attr_one
var_two = self.attr_two.another_attr
empty_list =
|
by: bvdet |
last post by:
I provide shop drawings to structural steel fabricators with SDS/2 software (http://sds2.com) by Design Data (DD). I am not a programmer by education or trade and started writing scripts about 5 years ago. DD has a script interface with Python in the 3D model which is very useful in production. Part of the Python interface includes a dialog box class: dlg1 = Dialog('Dialog Box Title')Method dlg1.done() returns a dictionary. I am exporting the...
|
by: Zytan |
last post by:
I see that static is more restricted in C# than in C++. It appears
usable only on classes and methods, and data members, but cannot be
created within a method itself. Surely this is possible in C# in some
way? Or maybe no, because it is similar to a global variable (with its
scope restricted) which C# is dead against?
Zytan
|
by: ali |
last post by:
Hi,
When I pass a pointer as an argument of a method, is it safe if I
change the data pointed by the argument and return it upon
completion ?
For example:
Object* someFunction(Object* ob)
{
|
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...
|
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...
| |
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |