Here is my problem whihc is very strange for me;
(VC++ 2003)
i am developping a multi-threaded DLL and using STL of VC++,
(especially "list")...

So far i always compiled my code in debug mode... ok...
Here it is;
When i run my application with double click on it, it throws a run-time
error; i search and i found that it gives error on a "delete xStruct;"
statement,
i commented it and it again gave an error when trying to run push_back
of STL list.

Here is the strange thing;
Without changing "anything" instead of double clicking&running the app.
when
i start it via "Start" button (again in debug mode) in VS 2003 it works
perfect...

How can u explain it???

Re: Run in debug mode with VS and Without. Difference? by Oleg

Oleg
Wed Sep 20 06:40:29 CDT 2006


> Here is my problem whihc is very strange for me;
> (VC++ 2003)
> i am developping a multi-threaded DLL and using STL of VC++,
> (especially "list")...
>
> So far i always compiled my code in debug mode... ok...
> Here it is;
> When i run my application with double click on it, it throws a run-time
> error; i search and i found that it gives error on a "delete xStruct;"
> statement,
> i commented it and it again gave an error when trying to run push_back
> of STL list.
>
> Here is the strange thing;
> Without changing "anything" instead of double clicking&running the app.
> when
> i start it via "Start" button (again in debug mode) in VS 2003 it works
> perfect...
>
> How can u explain it???
>

There is a number of differences between running under debugger and without it
that can affect the application's behavior:
- different heap layouts (can reveal some heap-related bugs and hide some others)
- unexpected synchronization of threads when running under debugger
(can hide some synchronization-related bugs)
- different working directories
- some others (different environment variables, etc.)

From your description I would first check for working directory issues (if the application
depends on it), then for heap corruption, and if no corruption found, check also for
synchronization problems.

Here is how to detect heap corruptions:
http://www.debuginfo.com/tips/userbpntdll.html

--
Oleg
[VC++ MVP http://www.debuginfo.com/]








Re: Run in debug mode with VS and Without. Difference? by xenonysf

xenonysf
Wed Sep 20 08:41:13 CDT 2006

- unexpected synchronization of threads when running under debugger
(can hide some synchronization-related bugs)

especially this one is which am suspicious at most... because it is not

related to any directories... but heap problem has also high
possibility...

link is great... tnx


Re: Run in debug mode with VS and Without. Difference? by xenonysf

xenonysf
Wed Sep 20 09:19:15 CDT 2006


xenonysf wrote:
> - unexpected synchronization of threads when running under debugger
> (can hide some synchronization-related bugs)
>
> especially this one is which am suspicious at most... because it is not
>
> related to any directories... but heap problem has also high
> possibility...
>
> link is great... tnx

And;
What is the best way to see how threads are scheduled for a specific
run?

? - putting many printf s and see the sequence?
? - is there a debug tool for this?


Re: Run in debug mode with VS and Without. Difference? by Oleg

Oleg
Thu Sep 21 02:22:23 CDT 2006

> What is the best way to see how threads are scheduled for a specific
> run?
>
> ? - putting many printf s and see the sequence?

Yes, some kind of tracing usually helps (printf or more advanced ones).

> ? - is there a debug tool for this?
>

May be this one:
http://www.softwareverify.com/cpp/flow_tracer/index.html

Oleg