c++debuggingc++builderbreakpointsc++builder-2010

C++ breakpoints are ignored / missed


I'm trying to run some C++ code someone gave me. At first there was a broken link to an istream file, which I fixed by adding the include path:

C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\include\dinkumware

The code now compiles but it doesn't stop at any breakpoints, for example those in the formcreate:

// Initialise the form and read in the module and inverter names.
void __fastcall TMain::FormCreate(TObject *Sender)
{
    ifstream inits;
    ifstream inverters;
    ifstream modules;
    char line[1000];
    AnsiString FTO;
    inits.open("PVSM.ini", ios::in);
    if (inits.is_open())
    {
            inits.getline(line,1000);
            AnsiString parmm(line);
            ModDir = parmm.SubString(1,parmm.Pos(" ")-1);
            inits.getline(line,1000);
            AnsiString parmi(line);
            InvDir = parmi.SubString(1,parmi.Pos(" ")-1);
            inits.getline(line,1000);
            AnsiString parmt(line);
            MetDir = parmt.SubString(1,parmt.Pos(" ")-1);
            inits.getline(line,1000);
            AnsiString parms(line);
            ShdDir = parms.SubString(1,parms.Pos(" ")-1);
            inits.getline(line,1000);
            AnsiString parmx(line);
            ExpDir = parmx.SubString(1,parmx.Pos(" ")-1);
    }
    else    // Should never get here, but if ini file missing use defaults
    {
        ModDir = "C://";
        InvDir = "C://";
        MetDir = "C://";
        ShdDir = "C://";
    }
    inits.close();
    FTO = InvDir + "inverters.data";
    inverters.open(FTO.c_str(), ios::in);
    if (inverters.is_open())
    {
            while ( inverters.getline(line,1000) )
            {
               AnsiString inverter(line);
               IVBox->Items->Add(inverter);
            }
    }
    inverters.close();
    FTO = ModDir + "modules.data";
    modules.open(FTO.c_str(), ios::in);
    if (modules.is_open())
    {
            while ( modules.getline(line,1000) )
            {
               AnsiString module(line);
               ModBox->Items->Add(module);
            }
    }
    modules.close();
    CMod = 1;
    CStr = 1;
    CCell = 1;
    nStore = 0;
    grid = true;
    pasan = false;
    debug = false;
    calc = false;
    cell = false;
    module = false;
    array1 = false;
    inv = false;
    PV = true;
    Parray = false;
    Pcurve = false;
    LastType = 'X';
    CurrTp = -1;  //* Not currently set
    AllSame = true;
    LdMeteo = false;
    mpp = true;
}

It just opens the form as if it was run from the .exe file, except it shows

Compiling MyProject.cbproj (Release configuration).... Success

in the message bar

I've tried switching from release to debug mode, tried changing the output directories so it compiles new .obj files. No success.

I'm running Rad studio 2010, it was originally written in XE5, but I think this is an issue with folder structure rather than IDE version?

Any suggestions?


Solution

  • Some ideas (from various sources) that may or may not be useful to you:

    As a last resort you could try { _asm { int 3 } } to simulate a breakpoint.

    Also take a look at: