Bug 10050 - Support for 'new' and `delete'
Summary: Support for 'new' and `delete'
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P2 normal
Target Milestone: 6.8
Assignee: Tom Tromey
URL:
Keywords:
Depends on: 14160
Blocks: 16106
  Show dependency treegraph
 
Reported: 2009-04-09 00:24 UTC by Jonathan Watt
Modified: 2013-10-31 19:25 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2013-03-01 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Watt 2009-04-09 00:24:44 UTC
This is a bug request to add support for using 'new' with convenience variables.

It seems that gdb has support for using 'malloc' with convenience variables
(thanks tromey for pointing that out!), so while debugging a program written in
C I can get the value of out parameters by doing something like this at the gdb
command line:

 > set $mystr = malloc(1000 * sizeof(char))
 > get_some_str($mystr)
 > p $mystr

It seems that gdb does not yet support using 'new' with convenience variables
though, so it's not possible to do the same thing for code written in C++ where
the out parameter is some class type.

The code I have to deal with involves digging down through a horrible mess of an
object graph and into nasty hash table code to get to the data I typically want,
so support for 'new' would certainly be a great help. :-)
Comment 1 drow@false.org 2011-07-01 19:14:35 UTC
I thought there were a lot of similar bug reports, but I can't find them...

I second this.  The fact that you can't create a new std::string, for instance, is really limiting!
Comment 2 Tom Tromey 2012-05-25 20:06:14 UTC
I have a partial patch for 'new'.
I plan to also implement 'delete'.
Comment 3 Tom Tromey 2012-07-13 15:43:35 UTC
'delete' relies on this being fixed:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37237