GDB raises SIGSEGV error in String local variable changing
Original Reporter info from Mantis: rfsanet
-
Reporter name:
Original Reporter info from Mantis: rfsanet
- Reporter name:
Description:
When I try to modify a String local variable at runtime, Lazarus raises the SIGSEGV error. I think that the error occurs for function TGDBMIDebugger.GDBModify uses the folowing command:
Result := ExecuteCommand('-gdb-set var %s := %s', [AExpression, S], [cfIgnoreError, cfExternal], R) and (R.State <> dsError);
Testing in the GDB.EXE, I saw that the correct command should be call [strncpy(Text, "newValue", NewSize))] instead [set var Text := "newValue"].
The NewSize value will be the greater of initial value size and new value size.
Can anybody help me to fix the error?
Steps to reproduce:
Unzip the Project.7Z (folder: C:\TEST\Project)
Run cmd.exe
cd /d C:\TEST\Project
gdb.exe
file project1.exe
break 20
run
set var TextVar := "NewValue"
cont
Error:
Program received signal SIGSEGV, Segmentation fault.
0x0044a0f6 in LCLPROC_$$_CONVERTUTF8TOUTF16$crc2EBDF3EE ()
Alternative commands:
Unzip the Project.7Z (folder: C:\TEST\Project)
Run cmd.exe
cd /d C:\TEST\Project
gdb.exe
file project1.exe
break 20
run
call strncpy(TextVar, "NewValue", strlen("InitialValue"))
cont
Mantis conversion info:
- Mantis ID: 20286
- OS: Windows Vista
- OS Build: Home Basic
- Platform: WIN32
- Monitored by: » etrusco (Flávio Etrusco), » @martin_frb (Martin Friebe)