This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] Cached function lookup
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Klee Dienes <kdienes at apple dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 28 Feb 2002 10:22:41 -0500
- Subject: Re: [RFA] Cached function lookup
- References: <8A9ABA76-1A1B-11D6-BA6D-0030653FA4C6@apple.com>
I'll follow this up next week. There's a pretty cool idea in this one.
> (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 <email@example.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
> * 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
> (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
> * value.h (cached_value) add.
> (create_cached_function) add.
> (lookup_cached_function) add.
> (find_function_in_inferior) update to new signature.