简体   繁体   中英

Visual Studio disassembly: losing breakpoints

I'm working with Visual Studio 2010, using and .exe (without the original code so I can only see the assembler). The code it has been generated from is similar to this one (not exactly, it has unknown minor changes):

int main() {
    int points = 1000;
    int games = 0;

    srand ((unsigned int) time(NULL));  // random seed

    while(true) {
        games++;
        playGame(&points, games);
    keepPlaying();
    }
    return 0;
}

Plus the two called methods (really easy ones).

Now, when I try to debug the .exe, I open it, press F11 and everything goes nicely. I start to read the code, place some breakpoints, locate the main,...

But when I stop it and try to go to the first breakpoint pressing F5, I found that my program is loaded into a different place inside of the memory. Therefore, I can't find any of the breakpoints (which are pointing to unused memory).

Other times, I go line by line with F10/F11 until I find the breakpoints. There are sometimes that I found them (and they are enabled) but again I try execute until i reach them (F5) and it goes through them.

Anyone knows if I can, for example, force Visual Studio to place the assembler always into the same memory place? Or anything that let's me keep the breakpoints so I don't need to execute line by line each time.

Well, I kinda figured a roundabout... If someone else has this same problem, you could partially avoid it by creating and labeling breakpoints. One of them at the very first line.

For example you can place another at the call of the main method, or at the begining of it. Then, instead of stoping and relaunching the debug, just go to the first breakpoint and rigth click at the instruction > Stablish next instruction.

However this may cause problems with the data (and most surelly it will) so be carefull. It worked for me, but probably just because I used it for a very simple task.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM