Pelles C forum

Pelles C => Bug reports => Topic started by: czerny on March 23, 2012, 09:43:16 PM

Title: wrong line while debugging
Post by: czerny on March 23, 2012, 09:43:16 PM
Hallo!

Try the following two snippets!

The first one has a /* */ comment

Code: [Select]
#define UNICODE
#define _UNICODE

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

/*
int __cdecl WinMainCRTStartup(void)
*/

int main(int argc, char **argv)
{
int i;
for (i=1;i<5;i++)
printf("%d\n",i);
return 0;
}

the second a // comment

Code: [Select]
#define UNICODE
#define _UNICODE

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

//int __cdecl WinMainCRTStartup(void)

int main(int argc, char **argv)
{
int i;
for (i=1;i<5;i++)
printf("%d\n",i);
return 0;
}

while debugging the second example. The debugger is one line above the real position.
If I remove the line

Code: [Select]
#include <stdlib.h>


the problem is gone.

czerny
Title: Re: wrong line while debugging
Post by: czerny on March 24, 2012, 01:08:56 PM
Can this be confirmed from anyone with 6.5 RC 4 32Bit? czerny
Title: Re: wrong line while debugging
Post by: Bitbeisser on March 24, 2012, 05:31:59 PM
Can this be confirmed from anyone with 6.5 RC 4 32Bit? czerny
Could you post your project settings for that test program?

Ralf
Title: Re: wrong line while debugging
Post by: AlexN on March 24, 2012, 08:33:31 PM
Can this be confirmed from anyone with 6.5 RC 4 32Bit? czerny

I haven't the time now to test it, but in the past the debugger of Pelles C had this problem - so I assume that this is another reason for this problem.
So we must wait for the next version of Pelles C and use a workaround still there.
Title: Re: wrong line while debugging
Post by: czerny on March 24, 2012, 09:23:53 PM
Quote
Could you post your project settings for that test program?
Code: [Select]
-Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze
Title: Re: wrong line while debugging
Post by: TimoVJL on March 24, 2012, 09:36:47 PM
This have two lines offset
Code: [Select]
#define UNICODE
#define _UNICODE

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//int __cdecl WinMainCRTStartup(void)

int main(int argc, char **argv)
{
int i;
for (i=1;i<5;i++)
printf("%d\n",i);
return 0;
}
Title: Re: wrong line while debugging
Post by: JohnF on March 25, 2012, 09:15:21 AM
For now, one can get around this problem by adjusting the order of the includes.

Code: [Select]
#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv)
{
int i;
for (i=1;i<5;i++)
printf("%d\n",i);
return 0;
}

John
Title: Re: wrong line while debugging
Post by: TimoVJL on March 25, 2012, 10:52:03 AM
Smaller example:
Code: [Select]
#include "foo.h"
#include "foo.h"
int main(int argc, char **argv)
{
int i = 1;
int j = 2;
return i+j;
}
foo.h
Code: [Select]
#ifndef _FOO_H
#define _FOO_H
#pragma once // error if this line exist
#endif
Title: Re: wrong line while debugging
Post by: czerny on April 17, 2012, 09:05:28 AM
It seems, that this bug is not gone with 7.00.2 RC1.

czerny
Title: Re: wrong line while debugging
Post by: czerny on March 09, 2013, 02:10:30 PM
Version: 7.00.348 Release Candidate #4

Step into the attached project until you reach the pictured (error.gif) point.

czerny
Title: Re: wrong line while debugging
Post by: JohnF on March 09, 2013, 02:30:18 PM
The problem is with Optimizations which is a bug that has been reported several times.

John