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] Make a function for block->objfile lookups


>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> 2009-04-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan> 	* block.c (block_objfile): New function.
Jan> 	* block.h (block_objfile): New prototype.
Jan> 	* objfiles.c (matching_objfiles): New function.
Jan> 	* objfiles.h (matching_objfiles): New prototype.
Jan> 	* printcmd.c: Remove include solib.h.
Jan> 	(display_uses_solib_p): Rename to ...
Jan> 	(display_uses_objfile): ... a new function name.  Change the SOLIB
Jan> 	parameter to OBJFILE parameter.  Use now a matching_objfiles call.
Jan> 	(clear_dangling_display_expressions): Update the caller.

Jan> +struct objfile *block_objfile (const struct block *block)

Newline after the "*".

Jan> +  struct symbol *func;
Jan> +
Jan> +  if (block == NULL)
Jan> +    return NULL;
Jan> +
Jan> +  func = block_linkage_function (block);
Jan> +  if (func == NULL)
Jan> +    return NULL;

Just to be sure I understand... in the loop in display_uses_solib_p,
there are two checks:

	  if (block != NULL
	      && solib_contains_address_p (solib, block->startaddr))
	    return 1;

	  if (section && section->objfile == solib->objfile)
	    return 1;

So I gather from this change that the first check is checking for
functions and the second one will handle variables coming from the
solib?  And that is why it is ok to replace the first change with
block_objfile?  My concern here is that the patch not affect the
semantics of the existing check; and I don't really know the block
stuff very well.

Jan> --- gdb/objfiles.h	15 Jan 2009 16:35:22 -0000	1.59
Jan> +++ gdb/objfiles.h	22 Apr 2009 18:15:45 -0000
Jan> @@ -508,6 +508,7 @@ extern void set_objfile_data (struct obj
Jan>  			      const struct objfile_data *data, void *value);
Jan>  extern void *objfile_data (struct objfile *objfile,
Jan>  			   const struct objfile_data *data);
Jan> +extern int matching_objfiles (struct objfile *a, struct objfile *b);

I think this declaration should not be in this section, which is all
related to the objfile_data stuff.  Instead just move it above the
comment introducing objfile_data.

Assuming my understanding of the semantics is correct, then this is ok
with the above fixlets.  Thanks.

Tom


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