Bug 12605 - JIT registration protocol: memory usage
Summary: JIT registration protocol: memory usage
Status: RESOLVED INVALID
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: archer
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-26 00:14 UTC by Steve Fink
Modified: 2011-03-28 17:45 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Fink 2011-03-26 00:14:52 UTC
The JIT code registration protocol makes it possible to register while gdb is not attached to an inferior, and then when gdb attaches, it will crawl through the backlog of registration requests. However, there is no notification to the inferior that something has been successfully registered. As a result, those registration entries cannot be freed, nor can the ELF objects they point to. The registration entries are small enough to not worry about, but it bothers me to have to hang onto thousands of ELF objects after the relevant information has already been copied over and is in gdb's data structures. Perhaps it's verboten to write into the inferior's memory, but if gdb set a flag on an entry to say that it had been registered (or something like that), then I could free the memory. (As far as I can tell, gdb only uses the address where the object was to identify it for unregistration. It never needs to access it after registration.)
Comment 1 Pedro Alves 2011-03-28 10:31:39 UTC
The first GDB can detach (either intentionally, or due to a crash), and another GDB can reattach.  IIUC, your suggestion would make the second GDB not be able to find the JIT elf files.
Comment 2 Steve Fink 2011-03-28 17:45:54 UTC
Doh! You're right.

I suppose there could be an option to point to a file rather than an in-memory blob, but I don't know if I would want to use that or not.