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: [RFA] symtab.c: Set "first" to zero.


On Fri, Jul 13, 2012 at 7:57 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> Any preference?
>
> Not really, I guess.
>
> I didn't realize this way would have to have that weirdness in
> output_source_filename.
>
> What do you think of this?
> It just makes the cache explicitly managed, and so avoids the confusion
> in output_source_filename about what 'first' means.
>
> Tom
>
> 2012-07-13  Tom Tromey  <tromey@redhat.com>
>
>         * symtab.c (filename_seen_tab, filename_seen_tab_alloc_size)
>         (filename_seen_tab_cur_size): New globals.
>         (reset_filename_seen_cache): New function.
>         (filename_seen): Remove 'first' parameter.  Update.
>         (output_source_filename): Update.
>         (sources_info): Call reset_filename_seen_cache.
>         (struct add_partial_filename_data) <first>: Remove field.
>         (maybe_add_partial_symtab_filename): Update.
>         (make_source_files_completion_list): Call
>         reset_filename_seen_cache.  Update.

In that case I'd rather "go whole hog" with this.

2012-07-13  Doug Evans  <dje@google.com>

        * symtab.c (output_source_filename): Delete unnecessary forward decl.
        (filename_seen_cache): New struct.
        (INITIAL_FILENAME_SEEN_CACHE_SIZE): New macro.
        (create_filename_seen_cache): New function.
        (clear_filename_seen_cache, delete_filename_seen_cache): New functions.
        (filename_seen): Delete arg "first".  New arg "cache".  All callers
        updated.
        (output_source_filename_data): New struct.
        (output_source_filename): Delete arg "first".  New arg "data".
        All callers updated.
        (sources_info): Delete local "first".  New locals "data", "cleanups".
        Rewrite to use filename_seen_cache.
        (add_partial_filename_data): Delete member "first".  New member
        "filename_seen_cache".  All uses updated.
        (make_source_files_completion_list): Rewrite to use
        filename_seen_cache.


> @@ -3209,6 +3216,7 @@ sources_info (char *ignore, int from_tty)
>
>    printf_filtered ("Source files for which symbols have been read in:\n\n");
>
> +  reset_filename_seen_cache ();
>    first = 1;
>    ALL_SYMTABS (objfile, s)
>    {

Another call to reset_filename_cache would be needed here:

   printf_filtered ("Source files for which symbols "
                    "will be read in on demand:\n\n");

+  reset_filename_seen_cache ();

[assuming the intent wasn't to change the output of course]

Attachment: gdb-120713-filename-seen-cache-1.patch.txt
Description: Text document


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