Remote debugging with XE2 - string display

I am uninstalling large debugging of a large application between DElphi XE2 (update # 4) and the Windows XP target. PAServer works on purpose, and the application works fine and stops at breakpoints (you would not believe how difficult this achievement was - a hint - delete your DPROJ and start again if it went through any IDE before XE).

I noticed that the display of local variables and the clock shows my lines in a strange format compared to the usual display of the "some line" format, which can be seen during local debugging. I see:

enter image description here

Can someone tell me why the lines are displayed in this way? I also get quite a few {NULL} and garbage between {} on output variables that are not yet assigned. Thank.

. I see that this format points to wide strings. I tried a simple application in Windows 7 and got the following result. My application at breakpoint:

enter image description here

Displayed local string variables:

enter image description here

Note the truncated "Hello". It would seem that XE2 sometimes encounters the problem of deleted unicode strings. My PaServer - version 1.0.2. Can anyone verify that this is the last? 'Twas taken from Update # 4 ...

+57
string debugging delphi delphi-xe2 remote-debugging
Jul 24 2018-12-12T00:
source share
5 answers

I'm not quite sure why you have {} around string values ​​- I guess it should demonstrate that the values ​​come from remote execution - but I know that S being truncated due to optimization ...

 {$O-} // Disable Optimization var S: AnsiString; S2: UnicodeString; begin S := 'Hello'; S2 := 'Hello2'; ShowMessage(S2); end; {$O+} // Enable Optimization 

Now you will notice that the value "Hello" (variable S ) remains unchanged during debugging. Similarly, if you use the value assigned to S :

 var S: AnsiString; S2: UnicodeString; begin S := 'Hello'; S2 := 'Hello2'; ShowMessage(S + S2); end; 

Delphi optimization now determines that S used within the valid scope, and therefore the value is saved.

So, what you call a “bug” is actually a “compiler function” just like Borland / Inprise / Codegear / Embarcadero.

+4
Sep 28 '12 at 22:27
source share
— -

(I copy the code from @Dave)

 var S1: AnsiString; S2: UnicodeString; begin S1 := 'Foo'; S2 := 'Bar'; ShowMessage(Format('%s!', S2)); end; 

I assume that the local var S1 is optimized here because it is not used anywhere, so the value no longer exists.

Try running this on your local computer, can you see S1?

+3
Sep 25 '12 at 10:18
source share

I'm not sure if that matters, but I know System.AnsiStrings, which contains special commands such as Format, etc. Using something like the following, you can solve your problem:

 var S1: AnsiString; S2: UnicodeString; begin S1 := 'Foo'; S2 := 'Bar'; ShowMessage(Format('%s!', S2)); end; 

There are also some open errors to rule out any of them, what specific versions of os and tools do you use, that is, Win7 x64 Ultimate, etc.?

+1
Sep 23
source share

Project -> Options -> Delphi Compiler -> Linking -> Enable Remote Debugging Symbols = true

0
Aug 18 '15 at 10:36
source share

This is not a feature - I have the same error. This seems to get confused with Unicode strings. If you change them to ANSI, this will work, but it is not a solution. Do not delete my comment - this confirms that this is a problem with PAServer!

0
Mar 28 '19 at 13:19
source share



All Articles