From: SourceForge.net <no...@so...> - 2007-10-15 13:11:34
|
Bugs item #1813398, was opened at 2007-10-15 06:51 Message generated for change (Comment added) made by infidel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1813398&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: gdb Group: MinGW Web Site >Status: Pending >Resolution: Invalid Priority: 5 Private: No Submitted By: hola (minguser) Assigned to: Nobody/Anonymous (nobody) Summary: gdb running problem 0xfeeefeee Initial Comment: Working on my project I notice that the program run fine in general but if I try to run it on gdb I get a SIGSEGV. I'm working on Xp platform using MinGW (MinGW gdb) and I've heard that Windows marks mem you freed with 0xfeeefeee and this is my problem with gdb. gdb marks a pointer with 0xfeeefeee and the programs crash (running in gdb). When I print the value running the pogram simply on "cmd" the value printed is different (like it should be). I made some test e notice that I really free a pointer Y but gdb seems to mark with 0xfeeefeee not just Y but either a pointer X that have an address bigger than Y. The memory for X is allocated immediately after the memory allocated for Y. More simply: I do this thing in my code. ___________________________________________ struct Lst { struct Lst *next; .... }; struct Lst *list, *Y, **X, list = calloc(1, sizeof(struct Lst)); Y = list; list->next = calloc(1, sizeof(struct Lst)); X = &(list->next); ... free(Y); return *X; // value of *X changes in gdb after free(Y)!!! _____________________________________________ OS version: XP gcc version: 3.2.3 ld version: GNU ld version 2.13.90 20030111 mingw version: MinGW-3.0.0-1.exe build environment: cmd I make a small test file too... ---------------------------------------------------------------------- >Comment By: Luke Dunstan (infidel) Date: 2007-10-15 21:11 Message: Logged In: YES user_id=30442 Originator: NO Your code is incorrect. X is pointing to memory that has been freed by "free(Y)", so you cannot access this memory. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1813398&group_id=2435 |