Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* compile: objfiles lifetime UI
@ 2015-04-29 13:57 Jan Kratochvil
  2015-04-30 10:31 ` Phil Muldoon
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2015-04-29 13:57 UTC (permalink / raw)
  To: gdb; +Cc: Phil Muldoon

Hi,

posting first for an approval CLI UI for managing objfiles currently in
inferior for the 'compile' command.

With each injected code is associated:
 * infcall dummy frame - deleted when the code returns or when user interrupts
   the code and 'return's from it in CLI.
 * objfile - deleted when the dummy frame is deleted
 * inferior mmap()ped memory - currently leaked in inferior forever
   - prepared in a local patchset: deleted when the objfile is deleted
 * inferior malloc()ed memory - only from the posted 'compile print' command
   - in the posted 'compile print' command: deleted when the objfile is deleted

The mmap leak was intentional so that one can do for example:
inferior:
	char *str = "foo";
GDB:
	(gdb) compile code str = "bar";

Now there should be a way to delete everything by default (so that a loop with
'compile print' command will not run the inferior out of memory) but to have
a way to keep the memory alive (so that for example strings can be set) or
even to keep the objfile alive (so that for example a callback function can be
set which may crash so that we want to keep DWARF loaded for the callback
function).

What CLI should be there for it?

(gdB) info compile-files
Num Address Range                           Frame Name
1   0x00007ffff7ff3000 - 0x00007ffff7ff5000 -     file test.c
2   0x00007ffff7ff9000 - 0x00007ffff7ffb000 #0    code puts("hello wor...
(gdb) delete compile-file 1
(gdb) delete compile-file 2
compile-file #2 dummy frame is still valid, use 'return' command to delete it.
(gdb) bt
#0  0x00007ffff7ff9021 in _gdb_expr (__regs=0x7ffff7ff7000) at gdb command line:1
#1  <function called from gdb>
#2  main () at ./gdb.compile/compile-print.c:31
(gdB) info compile-files
Num Address Range                           Frame Name
2   0x0000003834603da0 - 0x0000003834603dc0 #0    code puts("hello wor...


Jan


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-07 17:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 13:57 compile: objfiles lifetime UI Jan Kratochvil
2015-04-30 10:31 ` Phil Muldoon
2015-04-30 10:53   ` Jan Kratochvil
2015-05-06 12:26     ` Jan Kratochvil
2015-05-07  2:53       ` Alexandre Oliva
2015-05-07 17:06         ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox