Re: [PATCH] Objective-C language support.

Michael Snyder
2002-10-08T23:51:51Z

Adam Fedor wrote:
>
> This patch adds Objective-C language support to gdb based upon a patch
> provided by Apple Computer Inc from their version of gdb. Note that the
> patch only contains changes to existing files. New files (objc-lang.h,
> objc-lang.c, objc-exp.y) and a gdb.objc testsuite directory are located at
>
> ftp://ftp.gnustep.org/pub/gnustep/contrib/gdb-objc-patch.tar.gz

This change is (remotely) related to symbol tables, which belong to
Jim Blandy and Elena Zannoni. Jim, do you have any objection to this
change? I think it's almost obvious, and recommend it for approval.

> * symtab.h: New objc_specific struct.
> (SYMBOL_INIT_LANGUAGE_SPECIFIC): Handle ObjC.
> (SYMBOL_DEMANGLED_NAME): Likewise.

> Index: gdb/symtab.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.h,v
> retrieving revision 1.39
> diff -u -p -r1.39 symtab.h
> --- gdb/symtab.h 12 Sep 2002 19:19:37 -0000 1.39
> +++ gdb/symtab.h 17 Sep 2002 19:31:07 -0000
> @@ -89,6 +89,11 @@ struct general_symbol_info
> char *demangled_name;
> }
> cplus_specific;
> + struct objc_specific
> + {
> + char *demangled_name;
> + }
> + objc_specific;
> #if 0
> /* OBSOLETE struct chill_specific *//* For Chill */
> /* OBSOLETE { */
> @@ -146,6 +151,10 @@ extern CORE_ADDR symbol_overlayed_addres
> { \
> SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
> } \
> + else if (SYMBOL_LANGUAGE (symbol) == language_objc) \
> + { \
> + SYMBOL_OBJC_DEMANGLED_NAME (symbol) = NULL; \
> + } \
> /* OBSOLETE else if (SYMBOL_LANGUAGE (symbol) == language_chill) */ \
> /* OBSOLETE { */ \
> /* OBSOLETE SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; */ \
> @@ -170,12 +179,17 @@ extern void symbol_init_demangled_name (
> (SYMBOL_LANGUAGE (symbol) == language_cplus \
> || SYMBOL_LANGUAGE (symbol) == language_java \
> ? SYMBOL_CPLUS_DEMANGLED_NAME (symbol) \
> + : (SYMBOL_LANGUAGE (symbol) == language_objc \
> + ? SYMBOL_OBJC_DEMANGLED_NAME (symbol) \
> : /* OBSOLETE (SYMBOL_LANGUAGE (symbol) == language_chill */ \
> /* OBSOLETE ? SYMBOL_CHILL_DEMANGLED_NAME (symbol) */ \
> - NULL)
> + NULL))
>
> /* OBSOLETE #define SYMBOL_CHILL_DEMANGLED_NAME(symbol) */
> /* OBSOLETE (symbol)->ginfo.language_specific.chill_specific.demangled_name */
> +
> +#define SYMBOL_OBJC_DEMANGLED_NAME(symbol) \
> + (symbol)->ginfo.language_specific.objc_specific.demangled_name
>
> /* Macro that returns the "natural source name" of a symbol. In C++ this is
> the "demangled" form of the name if demangle is on and the "mangled" form