cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: building with MSVC

From: <codemstr_at_ptdprolog.net>
Date: Wed, 25 Feb 2004 03:04:23 -0000

*** Note: sorry for not using a subscribed email, I'm on my ISP's webchat and
they insist on having me use one address for POP3 and one for webmail :) I
just wanted to make sure I had my comments heard on this issue before anyone
starts making changes.

> 2. Just have one build -- the release build. This implies to me removing
> all trace of DEBUG_OBJS and RELEASE_OBJS and making a choice between CCR and
> CCD, LINKR and LINKD.
>
> I'm leaning towards #2. Does anyone care? Does anyone use the debug build?

I could not disagree more! I use the debug builds all the time.

Scenario:
Curl crashes under seemingly random circumstances.

Result if #2 is taken:
-----------------------
User:
Hi, my curl crashed. It just happens randomly, I don't know exactly what
causes it but every 3-4 times I run it, it seems to crash at least once.

Response:
Sorry, unless you can give us some more information on how it is crashing,
where it is crashing, or how to reproduce, there really isn't too much we can
do.

User replies:
Ok, I managed to get a stacktrace from MSVC:
Execution ended on line ?? of file ?? (address 0x12345678)
0. 0x12345678 ??() Line: ??
1. 0x12348342 ??() Line: ??
2. 0x12348493 ??() Line: ??

Response:
Sorry, that really doesn't provide any information that can help us.

-----------------------

That's what would be the result of your scenario.

With the current debug feature enabled:
-----------------------
Hi, my curl crashed. It just happens randomly, I don't know exactly what
causes it but every 3-4 times I run it, it seems to crash at least once.

Response:
Sorry, unless you can give us some more information on how it is crashing,
where it is crashing, or how to reproduce, there really isn't too much we can
do. Could you try compiling in debug mode and see if you can get any output?

User replies:
Ok, I managed to get a stacktrace from MSVC:
Execution ended on line 89 of file strtok.c (address 0x12345678):
static char *buf = string;
0. 0x12345678 strtok(string={address out of bounds},token=':') Line:
strtok.c:89
1. 0x12348342 do_something(url="http://www.blah.com") Line: file2.c:45
2. 0x12348493 main(argc=1,argv[] = {"http://www.blah.com"}) Line: file1.c:23

When I looked at file2.c line 45 I noticed this:

char *internal_url;

strtok(internal_url,':');

It seems like strtok() is being called with an uninitialized variable.

Resonse:
Ah, you're right. Thank you, this problem has now been fixed!

-----------------------
That is exactly why debug mode was created, and that's exactly why debug mode
exists. As someone who has made a bunch of patches to curl, this feature is
invaluable. Everytime I make a change to curl, what do I do? I don't just
say "yeah it works," I go and test it. And the thing I learned in my first
day of programming class, "use the debugger even when you don't have a
problem, it might help you discover one you don't even realize exists" comes
into play so I use that to search for problems. This is the procedure that
any good programmer should follow anytime they write code. By removing the
debug mode from curl you effectively prevent Windows programmers from
developing patches to curl in a safe manner. I know I for one would never
submit any of my patches because I'd know they were untested and potentially
will cause more problems than solutions.

In short, I think removing this feature would be a *HUGE* mistake. Anyone who
is a seasoned programmer, and is well aware of how hard some bugs can be to
find will agree with me that having the ability to use a debugger is an
invaluable tool.

Dominick Meglio
Received on 2004-02-25