This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix leak of bp_jit_event breakpoints


On Thu, Jan 27, 2011 at 2:59 PM, Pedro Alves <pedro@codesourcery.com> wrote:

> On Thursday 27 January 2011 21:50:35, Paul Pluzhnikov wrote:
>> -/* This is the address of the JIT descriptor in the inferior. ?*/
>> -
>> -static CORE_ADDR jit_descriptor_addr = 0;
>
> ...
>
>> +struct jit_inferior_data
>> +{
>> + ?CORE_ADDR breakpoint_addr;
>> + ?CORE_ADDR descriptor_addr;
>> +};
>
> You've lost the comment above. ?It'd be nice to
> have this structure and its fields documented..

Done.

>> I think this is covered now -- after "file", if we attach or run,
>> inferior_create_observer will delete the old breakpoint.
>
> The other way around isn't. ?If e.g., you attach to a process,
> and notice that the exec is wrongly set --- and then use "file"
> command to fix it. ?We'd set a new jit breakpoint before, but
> we don't now --- I think we should reset the jit state in that
> case, at least like jit_inferior_created_observer is
> doing, and that's what I was thinking could be done
> from the executable_changed observer.

Done.

gdb.base/jit.exp passes with both gdb and native gdbserver.

I'll wait a couple more days, then submit attached patch if there are no
further comments.

Thanks,
-- 
Paul Pluzhnikov

2011-01-28  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* breakpoint.h (remove_jit_event_breakpoints): New prototype.
	* breakpoint.c (remove_jit_event_breakpoints): New function.
	* jit.c (jit_descriptor_addr): Delete.
	(registering_code): Delete.
	(clear_int): Delete.
	(jit_inferior_data): New variable.
	(struct jit_inferior_data): New type.
	(get_jit_inferior_data): New function.
	(jit_inferior_data_cleanup): New function.
	(jit_read_descriptor): Adjust.
	(jit_register_code): Adjust.
	(jit_breakpoint_re_set_internal): New function; move code here ...
	(jit_inferior_init): ... from here.
	(jit_breakpoint_re_set): Adjust.
	(jit_reset_inferior_data_and_breakpoints): New function.
	(jit_inferior_created_observer): Adjust.
	(jit_inferior_exit_hook): Adjust.
	(jit_executable_changed_observer): New function.
	(jit_event_handler): Adjust.
	(_initialize_jit): Adjust.

Attachment: gdb-jit-leak-20110128.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]