This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: compile: objfiles lifetime UI
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>
- Cc: gdb at sourceware dot org, Alexandre Oliva <aoliva at redhat dot com>
- Date: Wed, 6 May 2015 14:26:37 +0200
- Subject: Re: compile: objfiles lifetime UI
- Authentication-results: sourceware.org; auth=none
- References: <20150429135735 dot GA16974 at host1 dot jankratochvil dot net> <55420463 dot 10400 at redhat dot com> <20150430105349 dot GA6260 at host1 dot jankratochvil dot net>
On Thu, 30 Apr 2015 12:53:49 +0200, Jan Kratochvil wrote:
> What about that 2nd case example of:
> (gdb) compile code str = "bar";
> That can be also typed as the 1st case:
> (gdb) compile print str = "bar"
> Obviously "bar" remains the GDB-mmap()ed memory.
Maybe it would be best if GCC can report whether the compiled code exposes
address to its internal object outside - such as by such an assignment or by
passing such a pointer to some external function. I expect some scan of the
IR (intermediate representation - RTL/GIMPLE?) would be sufficient.
IMO for 99% of such compiled code it will not happen and therefore GDB can
quietly and safely discard such injected objfile from the inferior.
It is questionable how many false positives would such a scan-for-address-of
make.
Jan