Jump to content

Martin Prikryl

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm using C++ Builder myself since about 2000 too. Hence my question. From my experience, I need to debug VCL regularly. Both to solve bugs and to understand inner details of the library. And I'm not able to do that in 11/12. So far no one here mentioned if it is indeed broken, or if it is just me. Does no one need to debug VCL? Thanks.
  2. Thanks. So is there any combination/setup of compilers/linkers/libraries with which the debugging work in the current version of C++ Builder?
  3. Thanks. Though as I've mentioned in my post, I've tried all. Classic/Modern, 32/64, none work. I really wonder, how people use VCL in C++ Builder 11/12 without being able to debug it. It seems useless to me for any advanced programming.
  4. When developing a GUI project in C++ Builder VCL (WinSCP SFTP/FTP client), I often need to debug VCL itself to understand why things do not work the way I expect. Now I'm upgrading my project to C++ Builder 11 and I've found that debugging VCL is broken. When stepping into some Pascal code from C++ project, the variables/parameters show incorrect values in debugger. (And my upgraded project fails deep in VCL, so I need to debug it.) I've encountered the problem with my licensed C++ Builder 11 Version 28.0.46141.0937. But I was able to reproduce the problem with a trial version of latest 12.1 too. In the screenshot below, you can see a callstack from a default unmodified Windows VCL Application project. In the callstack the this/Self "parameter" should have the same value in all top three levels. Yet it differs between C++ (this in TForm5::TForm5 and TForm::TForm) and Pascal (Self in TCustomForm::Create). Similarly, the top four levels should feature a pointer to the same Application object (Self in TApplication::CreateForm, AOwner in TCustomForm::Create – but also in TForm and TForm5 constructors, which shown strange __ctor_flag instead of expected AOwner). The screenshot is for the default (clang?) compiler. The same problem occurs however with the "classic" (bcc?) compiler – except the __ctor_flag problem does not occur. With 64-bit compiler, I'm not able to debug VCL at all (the debugger does not step into it). Correct are the values in C++ calls (I've verified that they point to the actual object data). The Pascal values are just rubbish. They even change as I step through the Pascal code (within the same method). Also the problem does not occur for all Pascal methods. But I wasn't able to identify, if there's any pattern so far (though virtual method might be a factor here). Note that this is not about the Self pointer only. The value of Self affects debugging all class fields. So once in the affected Pascal code, all fields values show garbage only. The code (though that's just the default project template, I haven't modified anything): Project?.cpp: //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include <tchar.h> //--------------------------------------------------------------------------- USEFORM("Unit5.cpp", Form5); //--------------------------------------------------------------------------- int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int) { try { Application->Initialize(); Application->MainFormOnTaskBar = true; Application->CreateForm(__classid(TForm5), &Form5); Application->Run(); } catch (Exception &exception) { Application->ShowException(&exception); } catch (...) { try { throw Exception(""); } catch (Exception &exception) { Application->ShowException(&exception); } } return 0; } //--------------------------------------------------------------------------- Unit5.cpp: //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit5.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm5 *Form5; //--------------------------------------------------------------------------- __fastcall TForm5::TForm5(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- The screenshot and code is from 11.2. But I've tried 12 trial too and the same problem occurs. The following screenshot shows the expected and correct callstack from old C++ Builder XE6 for its own default VCL Forms Application project. Reproduction steps: I've created fresh Windows VM on AWS EC2 (Windows Server 2022 Base, c5.2xlarge) – Though the problem happens on any machine I've tried it on (VM or not) No modification in Windows Downloaded https://altd.embarcadero.com/download/radstudio/11.0/RADStudio_11_2_10937a.iso (11.2) or https://altd.embarcadero.com/download/radstudio/12.0/RADStudio_12_1_esd_61_7529b.exe (12.1) Executed installation Checked C++ Builder, unchecked Delphi, no other change Executed C++ Builder File > New > Windows VCL Application No modification to source code Turned off Link with Dynamic RTL and Link with Runtime Packages (to enable VCL debugging, as per for example C++ Builder XE2 - is it possible to debug vcl data library?) I've also tried turning on Delphi Compiler > Compiling > Use debug dcus (without any noticeable effect) Stepped into: _tWinMain Application->CreateForm(__classid(TForm5), &Form5); Instance.Create(Self); TForm(Owner) TCustomForm(AOwner) Resulting Call Stack window attached Is debugging VCL in C++ Builder 11/12 really broken? Can it be fixed with some settings? Or am I doing something wrong? I did submit RSS-903 on Embarcadero Quality Portal weeks ago. No response. But I cannot imagine that it really does not work at all. I wonder how others use C++ Builder 11/12. To me, it's useless without ability to debug VCL. I've also already asked this on Stack Overflow, unfortunately with little response (Except for Remy Lebeau, who seem to be an active member here too). C++ Builder does not seem to be a busy topic on Stack Overflow. I'm new here, with hope to find more active C++ Builder users 🙂 Thanks in advance for any help or experience with C++ Builder 12/13 debugging.
×