473,659 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VC++ behaves differently when using BreakPoint

Hi all,
I have a serious problem that I am not sure whether its a bug in the
Microsoft Visual C++ or something that I am doing wrong. The problem
is (as noted in the Subject) is that my program behaves differently
when I insert a break point in a certain function (or I step into it)
I get different results. Its the same input and the same code!!
I do not think that adding a source code here will help since its
fairly a long program, but I can say that it includes a bitstream and
I have a function that reads bits from the bitstream and when I add
break points the return value of that function changes!

I will be gratful for any suggestions.
Thanks in advance
Faith

p.s I have tried adding a hard coded breakpoint instread and it still
gave the same results.
Jul 22 '05 #1
3 1966
Faith wrote:
Hi all,
I have a serious problem that I am not sure whether its a bug in the
Microsoft Visual C++ or something that I am doing wrong. The problem
is (as noted in the Subject) is that my program behaves differently
when I insert a break point in a certain function (or I step into it)
I get different results. Its the same input and the same code!!
I do not think that adding a source code here will help since its
fairly a long program, but I can say that it includes a bitstream and
I have a function that reads bits from the bitstream and when I add
break points the return value of that function changes!

I will be gratful for any suggestions.
Thanks in advance
Faith

p.s I have tried adding a hard coded breakpoint instread and it still
gave the same results.


What is this function that you are trying to step through? Perhaps you are
invoking undefined behavior...

- Pete
Jul 22 '05 #2
Faith wrote:
I have a serious problem that I am not sure whether its a bug in the
Microsoft Visual C++ or something that I am doing wrong. The problem
is (as noted in the Subject) is that my program behaves differently
when I insert a break point in a certain function (or I step into it)
I get different results. Its the same input and the same code!!
I do not think that adding a source code here will help since its
fairly a long program, but I can say that it includes a bitstream and
I have a function that reads bits from the bitstream and when I add
break points the return value of that function changes!
It seems that your code may be dependent on how fast it's executing.
That's fairly uncommon, but not unheard of. Unfortunately, C++ language
cannot help you here. The C++ virtual machine executes the same program
with the same (and predictable) side effects every time. I recommend
you to post your question to microsoft.publi c.vc.language and ask there.

Try examining the code your compiler produces. VC++ used to be shakier
than it's now (and you didn't say what version you're using), the code
generator has improved over the years. Sometimes it helps to just add
'volatile' to a variable to force it store the values instead of caching
it in registers (which VC++ v6 seems to get wrong every so rarely).
p.s I have tried adding a hard coded breakpoint instread and it still
gave the same results.


I can't say I understand which results would those be. Perhaps when
you are posting your question to the microsoft newsgroup, you will
revise that statement.

V
Jul 22 '05 #3
Victor Bazarov wrote:
Faith wrote:
I have a serious problem that I am not sure whether its a bug in the
Microsoft Visual C++ or something that I am doing wrong. The problem
is (as noted in the Subject) is that my program behaves differently
when I insert a break point in a certain function (or I step into it)
I get different results. Its the same input and the same code!!
I do not think that adding a source code here will help since its
fairly a long program, but I can say that it includes a bitstream and
I have a function that reads bits from the bitstream and when I add
break points the return value of that function changes!
It seems that your code may be dependent on how fast it's executing.
That's fairly uncommon, but not unheard of. Unfortunately, C++
language cannot help you here. The C++ virtual machine executes the
same program with the same (and predictable) side effects every time.
I recommend you to post your question to microsoft.publi c.vc.language
and ask there.


It may not be a VC++ specific problem; it could be the result of UB. It's
happened to me a few times when I had UB...

- Pete

Try examining the code your compiler produces. VC++ used to be
shakier than it's now (and you didn't say what version you're using),
the code generator has improved over the years. Sometimes it helps
to just add 'volatile' to a variable to force it store the values
instead of caching it in registers (which VC++ v6 seems to get wrong
every so rarely).
p.s I have tried adding a hard coded breakpoint instread and it still
gave the same results.


I can't say I understand which results would those be. Perhaps when
you are posting your question to the microsoft newsgroup, you will
revise that statement.

V


Jul 22 '05 #4

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

Similar topics

5
4099
by: Scott Matthews | last post by:
I've recently come upon an odd Javascript (and/or browser) behavior, and after hunting around the Web I still can't seem to find an answer. Specifically, I have noticed that the Javascript encode() function behaves differently if a codepage has been set. For example: <script> document.write(escape('Ôèëìè')); (note: that should be five accented characters)
5
1251
by: weixiang | last post by:
Hi, I wrote a progam, which pop up a form that with OnPaint() overrided. It works great in XP but bad in 2K. In 2K, most of the form content will not be displayed until I drag the form a little. And I set a breakpoint to the OnPaint... The breakpoint was hit when the form popuped... But if I shrink the VS.NET to make it can't overlap with the popup form, the form content is still not displayed after the OnPaint() returned. If I...
8
1812
by: The unProfessional | last post by:
To the VC .Net'ers out there... I noticed alot of strange behavior in the way VC .Net apps behave in the IDE. It's a bit odd, so maybe people have workarounds. I'm worried to devote my project to the managed/unmanaged heuristic because these early issues make me feel VC .net just isn't mainstream (or complete) enough yet to depend on. Anyway, one of the things is the code formatting. When adding event handlers and such, the code is...
2
2281
by: um | last post by:
When the POSIX pthreads library for w32 release 2-2-0 (http://sources.redhat.com/pthreads-win32/) is compiled with VC++6 then it compiles and passes all the benchmark tests in the subdirectory "tests". Also, VC++ 2005 beta 1 compiles the tests fine, but here the following tests fail in execution: # semaphore1.pass \ # condvar2.pass \ # condvar2_1.pass \ # mutex8.pass \
10
2584
by: Adriano Coser | last post by:
Hello. I'm moving an application VC 2003 to VC 2005 Beta2. I need to set STA ApartmentState model so the drag & drop registration can work. I used to do System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA; as the first statment of _tWinMain and also in the DllMain of my mixed mode assemblies.
15
2450
by: Joe Weinstein | last post by:
Hi. Below is a simple JDBC program to insert and extract a numerical value. When ResultSet.getDouble() is called, the same program produces different output on solaris than it does on Linux. I would be grateful for any discussion of this! thanks, Joe Weinstein at BEA Systems Results on Linux Box -----------------------------------------------------------------------
1
1562
by: rchen8080 | last post by:
I found that the php script behaves differently when it run in command line rather than runing over web server. Program includes the code like <?php function send_email($from_address, $to_address, $bcc_address, $subject, $msg, $attachments,$reminder_id) { $headers = ...;
17
2666
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/this-alert.html http://www.frostjedi.com/terra/scripts/demo/this-alert2.html Why, when you click in the black box, do the alert boxes say different things? Shouldn't they say the same thing?
0
1022
by: souvickm | last post by:
I have developed an exe to cut image files from a dumped folder and paste them in some other folder(categorized into subfolders) on a different machine. I have also coded to generate a text file at the end of the operation to provide a kind of report. The exe also reports the error no. & procedure name through the same text file (when it encounters any error/exception) Now, the exe performs all the reqd tasks properly when run but when I try to...
0
8427
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
8332
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
8851
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
8627
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
7356
agi2029
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...
1
6179
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
4175
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...
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
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.