The most important point is that you need to create an alias for your
variable with the 'as' command. Once you can list the alias ('al') as
showing the correct string value, then you can use it in a breakpoint.
I don't know what the comment marker is so take out the comments
before using.
Some examples.
For ASCII strings use /ma. For Unicode use /mu.
as /ma mychar_alias szMyChar // CHAR [] a simple local variable
as /ma mypointchar_alias poi(pszMyChar) // CHAR * a simple local
variable
as /ma myaddresschar_alias 1234567 // CHAR [] the address of a
variable anywhere
as /ma mypointaddresschar_alias poi(1234567) // CHAR * the
address of a variable anywhere
Then use 'al' to list the alias values:
0:007> al
Alias Value
------- -------
mychar_alias ABCDEF
Hint for getting variable addresses in structures - 'dt mystruct' -
will list the offsets of the members then just use mystruct+offset for
the address. e.g.
as /ma var 01c90000+03bc
Now you have an alias for your variable that shows the value of the
string, you can add it to a breakpoint.
Open your source code and set a breakpoint by pressing F9.
In the command window type bl to list the breakpoint.
copy the address info at the end. e.g. LANSA!CWINI_sCheckSysInit
+0x77f
Type: bu, paste the address in and append the script file name to get
this:.
bu LANSA!CWINI_sCheckSysInit+0x77f "$<c:\\script.txt"
Now put something like this in c:\script.txt
as /ma mychar_alias szMyChar
.echo ${mychar_alias}
.if ($scmp("${mychar_alias }","ABCDEF")==0 ) {} .else {gc}
This script shows the value of the string and then tests if it is
equal to ABCDEF. If it is it stops {}, otherwise execution continues
{gc}.
Similarly for $spat and $sicmp.
N.B. A defect in WinDbg: When re-running a debug session, the
breakpoint is remembered but the filename loses the backslash. You'll
need to re-enter the breakpoint.