NO

Author Topic: wrong line while debugging  (Read 4809 times)

czerny

  • Guest
wrong line while debugging
« 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

czerny

  • Guest
Re: wrong line while debugging
« Reply #1 on: March 24, 2012, 01:08:56 PM »
Can this be confirmed from anyone with 6.5 RC 4 32Bit? czerny

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: wrong line while debugging
« Reply #2 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

Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: wrong line while debugging
« Reply #3 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.
best regards
 Alex ;)

czerny

  • Guest
Re: wrong line while debugging
« Reply #4 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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: wrong line while debugging
« Reply #5 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;
}
May the source be with you

JohnF

  • Guest
Re: wrong line while debugging
« Reply #6 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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: wrong line while debugging
« Reply #7 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
May the source be with you

czerny

  • Guest
Re: wrong line while debugging
« Reply #8 on: April 17, 2012, 09:05:28 AM »
It seems, that this bug is not gone with 7.00.2 RC1.

czerny

czerny

  • Guest
Re: wrong line while debugging
« Reply #9 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

JohnF

  • Guest
Re: wrong line while debugging
« Reply #10 on: March 09, 2013, 02:30:18 PM »
The problem is with Optimizations which is a bug that has been reported several times.

John