This is the mail archive of the gdb-patches@sources.redhat.com 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] Cached function lookup


Klee,

I'll follow this up next week. There's a pretty cool idea in this one.

Andrew

> (This is basically the same patch I sent last week, just updated
> to the latest source base.)
> 
> This patch allows functions in the target used by GDB ("malloc",
> "scm_lookup_cstr", and later a ton of Objective-C functions) to have
> their values cached and re-used unless the symbol table has changed
> in-between calls.  This is a performance win overall, and a particular
> win when dispatching Objective-C method calls and looking up
> Objective-C type information from the runtime.
> 
> 2002-02-04  Klee Dienes <kdienes@apple.com>
> 
>         * breakpoint.c (breakpoint_re_set, breakpoint_re_set_all,
>         breakpoint_update): Instead of re-parsing all deferred breakpoints
>         every time breakpoint_re_set is called, increment a generation
>         number.  When breakpoints need to be up-to-date, call
>         breakpoint_update.  This prevents unnecessary re-parsing of
>         breakpoint information (and massive future-break spam) when
>         multiple shared libraries are loaded at the same time.
> 
>         * breakpoint.h: export symbol_generation, breakpoint_update.
> 
>         * gcore.c (default_derive_heap_segment): update to use
>         create_cached_function.
> 
>         * scm-lang.c (scm_lookup_name): update to use create_cached_function.
> 
>         * valops.c (create_cached_function, lookup_cached_function): add.
>         These functions create a new data type (a `cached_value'), whose
>         purpose is to store the lookup of commonly used symbols GDB needs
>         from the inferior.  For example, evaluating the expression 'print
>         "hello"' causes GDB to call `malloc' in the target.  Looking up
>         the symbol for `malloc' takes a non-trivial amount of time, and
>         has no need to be done if the symbols have not changed.
>         create/lookup_cached_function allow GDB to cache the results of
>         these lookups; re-looking them up only when the symbols have
>         changed.
>         (find_function_in_inferior): add a default type as second
>         argument.  This type will be used for the returned value if no
>         type information is available for the function (previously, the
>         type was assumed to be (char *) (*).
>         (value_allocate_space_in_inferior): use new cached_function
>         interface.
> 
>         * value.h (cached_value) add.
>         (create_cached_function) add.
>         (lookup_cached_function) add.
>         (find_function_in_inferior) update to new signature.



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