Bug 16501 - std::wstring and std::vector are shown with wrong information when debugging a constructor
Summary: std::wstring and std::vector are shown with wrong information when debugging ...
Status: RESOLVED MOVED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.6
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-23 10:07 UTC by utro
Modified: 2024-01-01 23:09 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
example c++ file (357 bytes, text/plain)
2014-01-23 10:07 UTC, utro
Details
example c++ header file (236 bytes, text/plain)
2014-01-23 10:08 UTC, utro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description utro 2014-01-23 10:07:44 UTC
Created attachment 7369 [details]
example c++ file

when debugging a constructor values passed as parameters are shown with wrong values.
The problem exist in "GNU gdb (GDB) 7.6" as part of "Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit windows" (x64-4.8.1-release-posix-seh-rev5.7z)
and in "GNU gdb (Gentoo 7.5.1 p2) 7.5.1".

e.g.:
Breakpoint 1, Foo::Bar::Bar (this=0x22fd80,
    senderId=L"\x2788e\000\000j\000\147\022\000\x2b20\341\166\000\000\001\000\000\000\b\000\000\000\245\023@\000\000\001\000\000\000\x26f0e", '\000' <repeats 86 times>, "\330\024@", '\000' <repeats 22 times>, "\055\145\340\166", '\000' <repeats 22 times>,
"\101\305\363\166", '\000' <repeats 58 times>...<Address 0x234000 out of bounds>, axes=std::vector of length -572142, capacity 1083994 = {...}, typeId=4711) at ..\..\..\Neo\DumperIssue\DumperIssue.cpp:15
15            int dummy {};
(gdb)

axes is the name of the parameter passed, _axes is the member initialized by axes:
senderId is a std::wstring which is wrong too.

(gdb) p axes
$3 = std::vector of length -572142, capacity 1083994 = {6637664, 0, 6637672, 0, 6637672, 0, 4201033, 0, 6629256, 0, 106, 4711, 1994468128, 0, 1, 0, 8, 0, 6...}
(gdb) p _axes
$4 = std::vector of length 2, capacity 2 = {909, 9090}
(gdb)
Comment 1 utro 2014-01-23 10:08:56 UTC
Created attachment 7370 [details]
example c++ header file
Comment 2 Hannes Domani 2024-01-01 23:09:43 UTC
Seems to have been a debug info problem on gcc side, since I can reproduce the issue with older gcc versions, but not if compiled with gcc-8 or newer:
```
Breakpoint 1, Foo::Bar::Bar (this=0x22fd10, senderId=L"{1234-5678-9012}", axes=std::vector of length 2, capacity 2 = {...}, typeId=4711) at gdb-16501.cpp:30
30          , _typeId(typeId)
(gdb) p axes
$1 = std::vector of length 2, capacity 2 = {909, 9090}
```