Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Unability to debug
Re: Unability to debug [message #41861 is a reply to message #41537] |
Fri, 31 January 2014 14:44 |
Shire
Messages: 41 Registered: September 2006 Location: Russia, Yamal peninsula
|
Member |
|
|
GDB_MI2 crashes when debugging by TheIDE built with MSC compiler.
(Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86, for me).
Debugger crashes at this harmless place:
uppsrc/ide/Builders/Gdb_MI2.cpp
MIValue Gdb_MI2::MICmd(const char *cmdLine)
{ // ...
return ReadGdb();
}
Return by value operation destructs MIValue instance. Let's see at MIValue class:
uppsrc/ide/Builders/MIValue.h
MIValue &operator=(pick_ MIValue &v);
MIValue &operator=(String const &s);
MIValue(MIValue pick_ &v);
MIValue(String const &s);
operator String&() { return Get(); }
operator const String &() const { return Get(); }
After some debugging I found fundamental difference
uppsrc/Core/Defs.h
#ifdef COMPILER_MSC
#define pick_
#else
#define pick_ const
#endif
Smart Microsoft compiler, when it can not find copy constructor of MIValue (because _pick is not const), copies instance via const String& conversion:
return MIValue((const String&)ReadGdb());
May be, this method was preferred by compiler because constantness of returning operator. Solution is make String& constuctor explicit and replace operator= with Set(String&) method. Patch is attached.
Such compiler behavior causes floating bugs. I mean this cause must be at "Pick behavior explained" article.
-
Attachment: gdb_fix.diff
(Size: 1.91KB, Downloaded 250 times)
[Updated on: Fri, 31 January 2014 14:45] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Jun 09 17:43:22 CEST 2024
Total time taken to generate the page: 0.01904 seconds
|