Author Topic: Problem with debugger & cannot run  (Read 7407 times)

Offline Nelivas

  • Single posting newcomer
  • *
  • Posts: 2
Problem with debugger & cannot run
« on: October 24, 2013, 04:03:20 pm »
Hello Code::Blocks users,

I'm currently busy with making a C project as of homework but suddenly I can't debug or Build and run to Debug myself.

Everytime when I try to debug I get this error:
Quote
[debug]> run
[debug]Starting program: C:\Users\Daan\Desktop\practicum\vergelijking\bin\Debug\vergelijking.exe

Child process PID: 8716

[debug][New Thread 8716.0xea0]
[debug]Program received signal SIGSEGV, Segmentation fault.
[debug]0x75ddcdbf in ungetwc () from C:\Windows\syswow64\msvcrt.dll
[debug]>>>>>>cb_gdb:

Program received signal SIGSEGV, Segmentation fault.
In ungetwc () (C:\Windows\syswow64\msvcrt.dll)

[debug]> bt 30
[debug]#0  0x75ddcdbf in ungetwc () from C:\Windows\syswow64\msvcrt.dll
[debug]#1  0x0000006f in ?? ()
[debug]#2  0x00000000 in ?? ()
[debug]>>>>>>cb_gdb:

I think it's part of this part of code since I didn't have it before this part of code, but when I comment or delete it all it still won't debug anymore
Code
                  locatiegetall2 = check_posistie(links, lang, locatiegetall);  
&
Code
int check_posistie(char nummer[], int length, int start)
{
    int pos2 = 0;
    start++;
    while(pos2 == 0 && start <= length)
    {
        if(isdigit(nummer[start]))
        {
            pos2 = start;
        }
        else
        {
            start++;
        }
    }
    if(start <= length)
    {
        pos2 = pos2;
    }
    else
    {
        pos2 = -1;
    }
    return pos2;
}

I have to make a program that can solve an equation and I tried that to divide the equation in blocks to calculate with the blocks instead of a random Struct. With this part I'm trying to read out the position of a second number in the equation.
I tried to search for my problem but couldnt find anything, even tried to reinstall the .dll file.
Thusfar nothing worked so please if anyone knows how to solve this, help would be appreciated.
Running on Win7 64 bit, and C::B 12.11

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Problem with debugger & cannot run
« Reply #1 on: October 24, 2013, 04:35:45 pm »
So, you program crashed, right?
Try to step though your program. (from the main() function), then post the debug log here.
I guess it is your code's fault.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Nelivas

  • Single posting newcomer
  • *
  • Posts: 2
Re: Problem with debugger & cannot run
« Reply #2 on: October 24, 2013, 10:29:18 pm »
I kinda found the problem, but have no clue why it Crashes because of this, maybe because the printf() function is too long   :-\
Code
printf("  var: %d, ding: %d, getal: %d en %d, locatie: %d  en %d \n", locatievarl, locatiedingl, invoerl, getal2, locatiegetall, locatiegetall2);
I deleted that part out, and the debugger started working again