• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows Debugger not stopping at breakpoints in very specific case

quattj

Member
I have a program that parses a file for all sorts of content using a buffer. I am now experiencing a strange issue where I have a test file that I know doesn't parse correctly, and I am trying to debug why. However, when I load this particular file with my program, the debugger simply will NOT stop at ANY breakpoint, so it always errors out. If I comment out the tiny section of code where it lists the error when it stops working (line 552 in a parsing script, which reads bytes from the buffer), it will finish the (incomplete) parsing of the file, but still will not stop at any breakpoints. If I load a different file before or after this file, the breakpoints will activate for those other files, but not this one file. I can put 100 breakpoints before line 552 and it will not stop. I can put 100 breakpoints after line 552 (after commenting it out) and it will not stop.

If I put a breakpoint in my main object just before the file load dialog, it will break. Then I hit F10 to step and get the load dialog. As soon as it's loaded, again all breakpoints, stepping, anything debug just goes out the window.

What gives?
 
Last edited:

quattj

Member
The error is not relevant. It is in a piece of code that will never execute and it should never get to that point if the breakpoints activate. It also happens in an older version of my program from a couple of days ago that did not yet have that code in it, so never got an error, yet it still ignores all breakpoints with that particular test file.

It also still ignores the breakpoints in the current version if I comment out the code that gives the error. I just don't get an error.
 

quattj

Member
What does the test file contain? How are you loading the file? How are you trying to parse the file?
It is a standard midi file, called dmed.mid

I load it using

GML:
new_file = get_open_filename("MIDI file (*.mid, *.midi, *.kar)|*.mid; *.midi; *.kar|All files (*.*)|*.*", "");
if (new_file != "")
{
    if (buffer_exists(global.edit_buffer))
    {
        buffer_delete(global.edit_buffer);
        current_file_name = "";
        reset_editor();
    }
    current_file = new_file;
    global.edit_buffer = buffer_load(current_file);
    global.edit_buffer_size = buffer_get_size(global.edit_buffer);
    global.scan_file = 1;
    
    for (i = 1; i <= string_length(current_file); i ++)
    {
        next_char = string_char_at(current_file, i);
        if (next_char == "\\")
            j = i + 1;
    }
    for (i = j; i <= string_length(current_file); i ++)
        current_file_name += string_char_at(current_file, i);
}
set_load = 0;
global.in_menu = 0;
This same code is used for loading any file. With a breakpoint at the first line,
new_file = get_open_filename("MIDI file (*.mid, *.midi, *.kar)|*.mid; *.midi; *.kar|All files (*.*)|*.*", "");
it will break out in to the debugger. Literally as soon as I click the "Open" button on this file, and only this file, the debugger stops being a debugger and the programs runs as if run using F5/Run and not F6/debug.

The parsing of the file apparently is also not relevant, because even a breakpoint set at the line
if (new_file != "")
does absolutely nothing. The parsing does not happen until after this section of code finishes, then the variable global.scan_file is read by the calling object, and then it calls the parsing script. The lack of debugging happens instantly upon load.

Please see the screenshot. The first breakpoint works. Every other breakpoint you see does nothing, nor does stepping through, because it just goes in to a regular run state.
 

Attachments

quattj

Member
I just made a project that only contains the code from above. Same result. Something in this specific midi file is breaking the debugger. I am submitting it as a bug report.
 
Top