Web lists-archives.com

Re: Cygwin debugger crashes every time on following a unique_ptr




Raj Kumar wrote:
[...]
Adding a watch is equivalent to when in the gdb window I try and do
this: myCar.get()->currentPassengers. This crashes the GDB every time.
So the issue occurs when I try to follow the object pointed to by a
unique_ptr and try to get its attributes/variables.

I can confirm this issue. The fault is reported by Cygwin's memcpy(). I'm having a heck of a time trying to get a gdb backtrace to show what in gdb itself is likely calling memcpy() with a bad arg.

To reproduce with OP's supplied source files in an otherwise clean directory:
g++ -g -o raj *.cpp
gdb raj
[...]
(gdb) b main
(gdb) run
(gdb) n
(gdb) n

At this point you'll be on line 14.  Issue the OP's triggering command:
(gdb) p myCar.get()->currentPassengers
Segmentation fault (core dumped)

..mark

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple