| Anonymous | Login | Signup for a new account | 2013-06-19 20:03 CEST | ![]() |
| All Projects | FPC | Lazarus: Packages, Patches | Lazarus CCR | Mantis | fpGUI | fpcprojects: fpprofiler |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
| 0020286 | Lazarus | IDE | public | 2011-09-18 17:32 | 2011-09-18 23:40 | ||||||||
| Reporter | rfsanet | ||||||||||||
| Assigned To | |||||||||||||
| Priority | normal | Severity | major | Reproducibility | have not tried | ||||||||
| Status | acknowledged | Resolution | open | ||||||||||
| Platform | WIN32 | OS | Windows Vista | OS Version | Home Basic | ||||||||
| Product Version | Product Build | ||||||||||||
| Target Version | Fixed in Version | ||||||||||||
| Summary | 0020286: GDB raises SIGSEGV error in String local variable changing | ||||||||||||
| 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 | ||||||||||||
| Tags | No tags attached. | ||||||||||||
| Fixed in Revision | |||||||||||||
| LazTarget | post 1.2 | ||||||||||||
| Widgetset | |||||||||||||
| Attached Files | |||||||||||||
Relationships |
|||||||||||||
|
|||||||||||||
Notes |
|
|
(0051987) Jonas Maebe (manager) 2011-09-18 17:43 |
strncpy is definitely not correct either. I don't think this can be easily solved in either Lazarus or GDB at this time, because there is no publicly documented (and hence guaranteed stable) function in the FPC RTL for assigning new string values to variables. The proper way to deal with this in Lazarus at this time would probably be to give an error message when someone attempts to change the value of a string. |
|
(0051989) Martin Friebe (manager) 2011-09-18 18:48 |
At current all handling of string, pchar, array of char is limited to do limits in gdb, or the stabs/dwarf debug info. A proper implementation is currently not possible, therefore target post 1.2 (It may be changed to earlier, if development within fpc, gdb and/or lazarus make this possible) The implementation of a safety check to prevent the attempt of setting a value to a string or similar type will be reviewed at an earlier stage. Thanks for reporting. |
|
(0051999) rfsanet (reporter) 2011-09-18 22:14 |
Thanks for reply! Despite the instability, I think valid to be enabled the option to modify String local variables even with warning of risks. What about we proceed? |
|
(0052003) Martin Friebe (manager) 2011-09-18 23:40 |
Yes, there will probably be an option, so it will be a warning, and the user can force the current behaviour. There are currently other issues, that are being worked on. This issue will be proceeded, when time becomes available (sorry it may be a while before anything will be done). Please also note, that even a warning, is by far more complex than it may sound. To detect if the variable which is about to be assigned to, is a string or similar type, may depend on the version of gdb, version of fpc, and type of debug info. This means it will be necessary to run a huge amount of tests. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2011-09-18 17:32 | rfsanet | New Issue | |
| 2011-09-18 17:32 | rfsanet | File Added: Project.7z | |
| 2011-09-18 17:43 | Jonas Maebe | Note Added: 0051987 | |
| 2011-09-18 17:43 | Jonas Maebe | Project | FPC => Lazarus |
| 2011-09-18 18:38 | Jonas Maebe | Relationship added | has duplicate 0020287 |
| 2011-09-18 18:48 | Martin Friebe | LazTarget | => post 1.2 |
| 2011-09-18 18:48 | Martin Friebe | Note Added: 0051989 | |
| 2011-09-18 18:48 | Martin Friebe | Status | new => acknowledged |
| 2011-09-18 18:49 | Martin Friebe | Relationship added | related to 0017619 |
| 2011-09-18 22:14 | rfsanet | Note Added: 0051999 | |
| 2011-09-18 23:40 | Martin Friebe | Note Added: 0052003 | |
| Main | My View | View Issues | Change Log | Roadmap |



