* [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5]
@ 2003-01-03 22:06 Adam Fedor
2003-02-19 19:02 ` Elena Zannoni
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Adam Fedor @ 2003-01-03 22:06 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 744 bytes --]
Now that I'm almost done, I finally understand the patch lingo (Thanks
Michael)! This is a repost of the first of five final patches for ObjC
suppport:
http://sources.redhat.com/ml/gdb-patches/2003-01/msg00049.html
The other two that I also need approval for are:
http://sources.redhat.com/ml/gdb-patches/2003-01/msg00050.html
http://sources.redhat.com/ml/gdb-patches/2003-01/msg00080.html
and two more (symtab.c, and linespec.c) will be coming soon.
---
A new year brings a final push to get Objective-C support in gdb. This
patch enables compilation and linking of the Objective-C files. I need
this now since the remaining patches require so many of the Objective-C
functions that it would be pointless to submit them otherwise.
[-- Attachment #2: objc18.patch --]
[-- Type: text/plain, Size: 4638 bytes --]
2003-01-02 Adam Fedor <fedor@gnu.org>
* Makefile.in (COMMON_OBS): Add objc-lang.o
(YYOBJ): Add objc-exp.tab.o
(maint.o, utils.o): Add $(objc_lang_h)
* maint.c (maintenance_demangle): Uncomment language_objc case.
* utils.c (fprintf_symbol_filtered): Likewise.
* parser-defs.h (start_msglist, add_msglist, end_msglist): Declare
Objective-C parsing functions (from objc-lang.c).
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.302
diff -u -p -r1.302 Makefile.in
--- Makefile.in 2 Jan 2003 20:29:15 -0000 1.302
+++ Makefile.in 3 Jan 2003 03:06:24 -0000
@@ -820,7 +820,7 @@ COMMON_OBS = version.o blockframe.o brea
exec.o bcache.o objfiles.o minsyms.o maint.o demangle.o \
dbxread.o coffread.o elfread.o \
dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \
- c-lang.o f-lang.o \
+ c-lang.o objc-lang.o f-lang.o \
ui-out.o cli-out.o \
varobj.o wrapper.o \
jv-lang.o jv-valprint.o jv-typeprint.o \
@@ -847,6 +847,7 @@ YYFILES = c-exp.tab.c \
jv-exp.tab.c \
f-exp.tab.c m2-exp.tab.c p-exp.tab.c
YYOBJ = c-exp.tab.o \
+ objc-exp.tab.o \
jv-exp.tab.o \
f-exp.tab.o m2-exp.tab.o p-exp.tab.o
@@ -1878,7 +1879,8 @@ main.o: main.c $(defs_h) $(top_h) $(targ
$(event_loop_h) $(ui_out_h) $(main_h)
maint.o: maint.c $(defs_h) $(command_h) $(gdbcmd_h) $(symtab_h) \
$(gdbtypes_h) $(demangle_h) $(gdbcore_h) $(expression_h) \
- $(language_h) $(symfile_h) $(objfiles_h) $(value_h) $(cli_decode_h)
+ $(language_h) $(symfile_h) $(objfiles_h) $(value_h) $(cli_decode_h) \
+ $(objc_lang_h)
mcore-rom.o: mcore-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(gdb_string_h) $(regcache_h) $(serial_h)
mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \
@@ -2240,7 +2242,8 @@ ui-out.o: ui-out.c $(defs_h) $(gdb_strin
utils.o: utils.c $(config_h) $(defs_h) $(gdb_assert_h) $(gdb_string_h) \
$(event_top_h) $(gdbcmd_h) $(serial_h) $(bfd_h) $(target_h) \
$(demangle_h) $(expression_h) $(language_h) $(annotate_h) \
- $(filenames_h) $(inferior_h) $(mmalloc_h) $(charset_h) $(readline_h)
+ $(filenames_h) $(inferior_h) $(mmalloc_h) $(charset_h) $(readline_h) \
+ $(objc_lang_h)
uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \
$(regcache_h) $(gregset_h)
v850-tdep.o: v850-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
Index: maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.30
diff -u -p -r1.30 maint.c
--- maint.c 24 Dec 2002 03:57:58 -0000 1.30
+++ maint.c 3 Jan 2003 03:06:25 -0000
@@ -35,6 +35,7 @@
#include "symfile.h"
#include "objfiles.h"
#include "value.h"
+#include "objc-lang.h"
#include "cli/cli-decode.h"
@@ -154,9 +155,8 @@ maintenance_demangle (char *args, int fr
switch (current_language->la_language)
{
case language_objc:
- /* Commented out until ObjC handling is enabled. */
- /* demangled = objc_demangle (args); */
- /* break; */
+ demangled = objc_demangle (args);
+ break;
case language_cplus:
default:
demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS);
Index: parser-defs.h
===================================================================
RCS file: /cvs/src/src/gdb/parser-defs.h,v
retrieving revision 1.15
diff -u -p -r1.15 parser-defs.h
--- parser-defs.h 19 Nov 2002 03:15:01 -0000 1.15
+++ parser-defs.h 3 Jan 2003 03:06:25 -0000
@@ -223,4 +223,9 @@ struct op_print
extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3);
+/* for parsing Objective C */
+extern void start_msglist (void);
+extern void add_msglist (struct stoken *str, int addcolon);
+extern int end_msglist (void);
+
#endif /* PARSER_DEFS_H */
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.88
diff -u -p -r1.88 utils.c
--- utils.c 2 Jan 2003 14:27:27 -0000 1.88
+++ utils.c 3 Jan 2003 03:06:35 -0000
@@ -46,6 +46,7 @@
#include "charset.h"
#include "annotate.h"
#include "filenames.h"
+#include "objc-lang.h"
#include "inferior.h" /* for signed_pointer_to_address */
@@ -2310,9 +2311,8 @@ fprintf_symbol_filtered (struct ui_file
demangled = cplus_demangle (name, arg_mode | DMGL_JAVA);
break;
case language_objc:
- /* Commented out until ObjC handling is enabled. */
- /*demangled = objc_demangle (name);*/
- /*break;*/
+ demangled = objc_demangle (name);
+ break;
default:
demangled = NULL;
break;
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-01-03 22:06 [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] Adam Fedor @ 2003-02-19 19:02 ` Elena Zannoni 2003-02-19 20:27 ` Adam Fedor 2003-03-20 21:27 ` Andrew Cagney 2003-03-20 21:35 ` Andrew Cagney 2 siblings, 1 reply; 23+ messages in thread From: Elena Zannoni @ 2003-02-19 19:02 UTC (permalink / raw) To: Adam Fedor; +Cc: GDB Patches Adam Fedor writes: > Now that I'm almost done, I finally understand the patch lingo (Thanks > Michael)! This is a repost of the first of five final patches for ObjC > suppport: > > http://sources.redhat.com/ml/gdb-patches/2003-01/msg00049.html > > The other two that I also need approval for are: > > http://sources.redhat.com/ml/gdb-patches/2003-01/msg00050.html > http://sources.redhat.com/ml/gdb-patches/2003-01/msg00080.html > > and two more (symtab.c, and linespec.c) will be coming soon. > > --- > > A new year brings a final push to get Objective-C support in gdb. This > patch enables compilation and linking of the Objective-C files. I need > this now since the remaining patches require so many of the Objective-C > functions that it would be pointless to submit them otherwise. > > 2003-01-02 Adam Fedor <fedor@gnu.org> > > * Makefile.in (COMMON_OBS): Add objc-lang.o > (YYOBJ): Add objc-exp.tab.o > (maint.o, utils.o): Add $(objc_lang_h) > * maint.c (maintenance_demangle): Uncomment language_objc case. > * utils.c (fprintf_symbol_filtered): Likewise. > * parser-defs.h (start_msglist, add_msglist, end_msglist): Declare > Objective-C parsing functions (from objc-lang.c). I think this is just 'obvious' in a sense given the code has been already approved, and it is just dormant. However, do we have testcases already? I think we should have a gdb.objc subdirectory. (sorry, i don't remember if you posted them). I would feel uncomfortable enabling objc w/o having tests, even very simple ones, it could bitrot fast. elena > > Index: Makefile.in > =================================================================== > RCS file: /cvs/src/src/gdb/Makefile.in,v > retrieving revision 1.302 > diff -u -p -r1.302 Makefile.in > --- Makefile.in 2 Jan 2003 20:29:15 -0000 1.302 > +++ Makefile.in 3 Jan 2003 03:06:24 -0000 > @@ -820,7 +820,7 @@ COMMON_OBS = version.o blockframe.o brea > exec.o bcache.o objfiles.o minsyms.o maint.o demangle.o \ > dbxread.o coffread.o elfread.o \ > dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \ > - c-lang.o f-lang.o \ > + c-lang.o objc-lang.o f-lang.o \ > ui-out.o cli-out.o \ > varobj.o wrapper.o \ > jv-lang.o jv-valprint.o jv-typeprint.o \ > @@ -847,6 +847,7 @@ YYFILES = c-exp.tab.c \ > jv-exp.tab.c \ > f-exp.tab.c m2-exp.tab.c p-exp.tab.c > YYOBJ = c-exp.tab.o \ > + objc-exp.tab.o \ > jv-exp.tab.o \ > f-exp.tab.o m2-exp.tab.o p-exp.tab.o > > @@ -1878,7 +1879,8 @@ main.o: main.c $(defs_h) $(top_h) $(targ > $(event_loop_h) $(ui_out_h) $(main_h) > maint.o: maint.c $(defs_h) $(command_h) $(gdbcmd_h) $(symtab_h) \ > $(gdbtypes_h) $(demangle_h) $(gdbcore_h) $(expression_h) \ > - $(language_h) $(symfile_h) $(objfiles_h) $(value_h) $(cli_decode_h) > + $(language_h) $(symfile_h) $(objfiles_h) $(value_h) $(cli_decode_h) \ > + $(objc_lang_h) > mcore-rom.o: mcore-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ > $(gdb_string_h) $(regcache_h) $(serial_h) > mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \ > @@ -2240,7 +2242,8 @@ ui-out.o: ui-out.c $(defs_h) $(gdb_strin > utils.o: utils.c $(config_h) $(defs_h) $(gdb_assert_h) $(gdb_string_h) \ > $(event_top_h) $(gdbcmd_h) $(serial_h) $(bfd_h) $(target_h) \ > $(demangle_h) $(expression_h) $(language_h) $(annotate_h) \ > - $(filenames_h) $(inferior_h) $(mmalloc_h) $(charset_h) $(readline_h) > + $(filenames_h) $(inferior_h) $(mmalloc_h) $(charset_h) $(readline_h) \ > + $(objc_lang_h) > uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \ > $(regcache_h) $(gregset_h) > v850-tdep.o: v850-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ > Index: maint.c > =================================================================== > RCS file: /cvs/src/src/gdb/maint.c,v > retrieving revision 1.30 > diff -u -p -r1.30 maint.c > --- maint.c 24 Dec 2002 03:57:58 -0000 1.30 > +++ maint.c 3 Jan 2003 03:06:25 -0000 > @@ -35,6 +35,7 @@ > #include "symfile.h" > #include "objfiles.h" > #include "value.h" > +#include "objc-lang.h" > > #include "cli/cli-decode.h" > > @@ -154,9 +155,8 @@ maintenance_demangle (char *args, int fr > switch (current_language->la_language) > { > case language_objc: > - /* Commented out until ObjC handling is enabled. */ > - /* demangled = objc_demangle (args); */ > - /* break; */ > + demangled = objc_demangle (args); > + break; > case language_cplus: > default: > demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS); > Index: parser-defs.h > =================================================================== > RCS file: /cvs/src/src/gdb/parser-defs.h,v > retrieving revision 1.15 > diff -u -p -r1.15 parser-defs.h > --- parser-defs.h 19 Nov 2002 03:15:01 -0000 1.15 > +++ parser-defs.h 3 Jan 2003 03:06:25 -0000 > @@ -223,4 +223,9 @@ struct op_print > > extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3); > > +/* for parsing Objective C */ > +extern void start_msglist (void); > +extern void add_msglist (struct stoken *str, int addcolon); > +extern int end_msglist (void); > + > #endif /* PARSER_DEFS_H */ > Index: utils.c > =================================================================== > RCS file: /cvs/src/src/gdb/utils.c,v > retrieving revision 1.88 > diff -u -p -r1.88 utils.c > --- utils.c 2 Jan 2003 14:27:27 -0000 1.88 > +++ utils.c 3 Jan 2003 03:06:35 -0000 > @@ -46,6 +46,7 @@ > #include "charset.h" > #include "annotate.h" > #include "filenames.h" > +#include "objc-lang.h" > > #include "inferior.h" /* for signed_pointer_to_address */ > > @@ -2310,9 +2311,8 @@ fprintf_symbol_filtered (struct ui_file > demangled = cplus_demangle (name, arg_mode | DMGL_JAVA); > break; > case language_objc: > - /* Commented out until ObjC handling is enabled. */ > - /*demangled = objc_demangle (name);*/ > - /*break;*/ > + demangled = objc_demangle (name); > + break; > default: > demangled = NULL; > break; ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-02-19 19:02 ` Elena Zannoni @ 2003-02-19 20:27 ` Adam Fedor 2003-02-19 21:11 ` Elena Zannoni 0 siblings, 1 reply; 23+ messages in thread From: Adam Fedor @ 2003-02-19 20:27 UTC (permalink / raw) To: Elena Zannoni; +Cc: GDB Patches On Wednesday, February 19, 2003, at 12:06 PM, Elena Zannoni wrote: > Adam Fedor writes: >> Now that I'm almost done, I finally understand the patch lingo (Thanks >> Michael)! This is a repost of the first of five final patches for ObjC >> suppport: >> >> http://sources.redhat.com/ml/gdb-patches/2003-01/msg00049.html >> >> The other two that I also need approval for are: >> >> http://sources.redhat.com/ml/gdb-patches/2003-01/msg00050.html >> http://sources.redhat.com/ml/gdb-patches/2003-01/msg00080.html >> >> and two more (symtab.c, and linespec.c) will be coming soon. >> >> --- >> >> A new year brings a final push to get Objective-C support in gdb. This >> patch enables compilation and linking of the Objective-C files. I need >> this now since the remaining patches require so many of the >> Objective-C >> functions that it would be pointless to submit them otherwise. >> >> 2003-01-02 Adam Fedor <fedor@gnu.org> >> >> * Makefile.in (COMMON_OBS): Add objc-lang.o >> (YYOBJ): Add objc-exp.tab.o >> (maint.o, utils.o): Add $(objc_lang_h) >> * maint.c (maintenance_demangle): Uncomment language_objc case. >> * utils.c (fprintf_symbol_filtered): Likewise. >> * parser-defs.h (start_msglist, add_msglist, end_msglist): Declare >> Objective-C parsing functions (from objc-lang.c). > > > I think this is just 'obvious' in a sense given the code has been > already approved, and it is just dormant. However, do we have > testcases already? I think we should have a gdb.objc > subdirectory. (sorry, i don't remember if you posted them). I would > feel uncomfortable enabling objc w/o having tests, even very simple > ones, it could bitrot fast. > > Yes I have one. I was going to wait till all the patches were in, since, AFAIK most of the tests won't pass until all my patches are in. How should I submit it? I suppose it would have to be a tar file. ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-02-19 20:27 ` Adam Fedor @ 2003-02-19 21:11 ` Elena Zannoni 0 siblings, 0 replies; 23+ messages in thread From: Elena Zannoni @ 2003-02-19 21:11 UTC (permalink / raw) To: Adam Fedor; +Cc: Elena Zannoni, GDB Patches Adam Fedor writes: > > > > > Yes I have one. I was going to wait till all the patches were in, > since, AFAIK most of the tests won't pass until all my patches are in. > > How should I submit it? I suppose it would have to be a tar file. Yes, that would be ok. bzip2'd possibly. elena ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-01-03 22:06 [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] Adam Fedor 2003-02-19 19:02 ` Elena Zannoni @ 2003-03-20 21:27 ` Andrew Cagney 2003-03-20 21:39 ` Daniel Jacobowitz 2003-03-20 21:35 ` Andrew Cagney 2 siblings, 1 reply; 23+ messages in thread From: Andrew Cagney @ 2003-03-20 21:27 UTC (permalink / raw) To: Adam Fedor, Daniel Jacobowitz; +Cc: GDB Patches Daniel, Would it be possible to make the cplus_demangle() method part of the language vector? That way code like the patch below could be reduced to: /* Return demangled language symbol, or NULL. */ language_demangle (current_language, arg); This would in turn allow Adam to just add an equivalent objc_demangle() method to the objc language vector, and hence eliminate the need to always link in objc-lang.c. Andrew > RCS file: /cvs/src/src/gdb/maint.c,v > retrieving revision 1.30 > diff -u -p -r1.30 maint.c > --- maint.c 24 Dec 2002 03:57:58 -0000 1.30 > +++ maint.c 3 Jan 2003 03:06:25 -0000 > @@ -35,6 +35,7 @@ > #include "symfile.h" > #include "objfiles.h" > #include "value.h" > +#include "objc-lang.h" > > #include "cli/cli-decode.h" > > @@ -154,9 +155,8 @@ maintenance_demangle (char *args, int fr > switch (current_language->la_language) > { > case language_objc: > - /* Commented out until ObjC handling is enabled. */ > - /* demangled = objc_demangle (args); */ > - /* break; */ > + demangled = objc_demangle (args); > + break; > case language_cplus: > default: > demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS); ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-20 21:27 ` Andrew Cagney @ 2003-03-20 21:39 ` Daniel Jacobowitz 2003-03-20 22:13 ` Andrew Cagney 2003-03-20 22:22 ` David Ayers 0 siblings, 2 replies; 23+ messages in thread From: Daniel Jacobowitz @ 2003-03-20 21:39 UTC (permalink / raw) To: Andrew Cagney; +Cc: Adam Fedor, GDB Patches Not without some substantial thought. We use cplus_demangle in a lot of places where we don't even know what the language is supposed to be - for minsyms, during lookups, et cetera. Certainly it needs to be thought about. At least objc's mangling is probably not entirely ambiguous with C++/Java's? I don't know. On Thu, Mar 20, 2003 at 04:27:02PM -0500, Andrew Cagney wrote: > Daniel, > > Would it be possible to make the cplus_demangle() method part of the > language vector? That way code like the patch below could be reduced to: > > /* Return demangled language symbol, or NULL. */ > language_demangle (current_language, arg); > > This would in turn allow Adam to just add an equivalent objc_demangle() > method to the objc language vector, and hence eliminate the need to > always link in objc-lang.c. > > Andrew > > >RCS file: /cvs/src/src/gdb/maint.c,v > >retrieving revision 1.30 > >diff -u -p -r1.30 maint.c > >--- maint.c 24 Dec 2002 03:57:58 -0000 1.30 > >+++ maint.c 3 Jan 2003 03:06:25 -0000 > >@@ -35,6 +35,7 @@ > > #include "symfile.h" > > #include "objfiles.h" > > #include "value.h" > >+#include "objc-lang.h" > > > > #include "cli/cli-decode.h" > > > >@@ -154,9 +155,8 @@ maintenance_demangle (char *args, int fr > > switch (current_language->la_language) > > { > > case language_objc: > >- /* Commented out until ObjC handling is enabled. */ > >- /* demangled = objc_demangle (args); */ > >- /* break; */ > >+ demangled = objc_demangle (args); > >+ break; > > case language_cplus: > > default: > > demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS); > > > -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-20 21:39 ` Daniel Jacobowitz @ 2003-03-20 22:13 ` Andrew Cagney 2003-03-20 22:19 ` Daniel Jacobowitz 2003-03-20 22:22 ` David Ayers 1 sibling, 1 reply; 23+ messages in thread From: Andrew Cagney @ 2003-03-20 22:13 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Adam Fedor, GDB Patches > Not without some substantial thought. We use cplus_demangle in a lot > of places where we don't even know what the language is supposed to be > - for minsyms, during lookups, et cetera. > > Certainly it needs to be thought about. At least objc's mangling is > probably not entirely ambiguous with C++/Java's? I don't know. > > On Thu, Mar 20, 2003 at 04:27:02PM -0500, Andrew Cagney wrote: > >> Daniel, >> >> Would it be possible to make the cplus_demangle() method part of the >> language vector? That way code like the patch below could be reduced to: >> >> /* Return demangled language symbol, or NULL. */ >> language_demangle (current_language, arg); >> >> This would in turn allow Adam to just add an equivalent objc_demangle() >> method to the objc language vector, and hence eliminate the need to >> always link in objc-lang.c. As well as then? The places where objc is adding calls to the demangler the language is known. Andrew ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-20 22:13 ` Andrew Cagney @ 2003-03-20 22:19 ` Daniel Jacobowitz 2003-03-31 2:23 ` Adam Fedor 0 siblings, 1 reply; 23+ messages in thread From: Daniel Jacobowitz @ 2003-03-20 22:19 UTC (permalink / raw) To: Andrew Cagney; +Cc: Adam Fedor, GDB Patches On Thu, Mar 20, 2003 at 05:13:40PM -0500, Andrew Cagney wrote: > >Not without some substantial thought. We use cplus_demangle in a lot > >of places where we don't even know what the language is supposed to be > >- for minsyms, during lookups, et cetera. > > > >Certainly it needs to be thought about. At least objc's mangling is > >probably not entirely ambiguous with C++/Java's? I don't know. > > > >On Thu, Mar 20, 2003 at 04:27:02PM -0500, Andrew Cagney wrote: > > > >>Daniel, > >> > >>Would it be possible to make the cplus_demangle() method part of the > >>language vector? That way code like the patch below could be reduced to: > >> > >> /* Return demangled language symbol, or NULL. */ > >> language_demangle (current_language, arg); > >> > >>This would in turn allow Adam to just add an equivalent objc_demangle() > >>method to the objc language vector, and hence eliminate the need to > >>always link in objc-lang.c. > > As well as then? The places where objc is adding calls to the demangler > the language is known. My gut reaction is that it's just clutter until we decide how to solve the problem of not knowing demanglings. But it'll do for now. I'd like a comment along the lines of: /* FIXME: sometimes the demangler is invoked when we don't know the language, so we can't use this everywhere. */ -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-20 22:19 ` Daniel Jacobowitz @ 2003-03-31 2:23 ` Adam Fedor 2003-03-31 22:39 ` Andrew Cagney 2003-03-31 22:53 ` David Carlton 0 siblings, 2 replies; 23+ messages in thread From: Adam Fedor @ 2003-03-31 2:23 UTC (permalink / raw) To: GDB Patches; +Cc: Daniel Jacobowitz, Andrew Cagney [-- Attachment #1: Type: text/plain, Size: 998 bytes --] Daniel Jacobowitz wrote: > On Thu, Mar 20, 2003 at 05:13:40PM -0500, Andrew Cagney wrote: > >>>> >>>>Would it be possible to make the cplus_demangle() method part of the >>>>language vector? That way code like the patch below could be reduced to: >>>> >>>> /* Return demangled language symbol, or NULL. */ >>>> language_demangle (current_language, arg); >>>> >>>>This would in turn allow Adam to just add an equivalent objc_demangle() >>>>method to the objc language vector, and hence eliminate the need to >>>>always link in objc-lang.c. >>> >>As well as then? The places where objc is adding calls to the demangler >>the language is known. > > > My gut reaction is that it's just clutter until we decide how to solve > the problem of not knowing demanglings. But it'll do for now. I'd > like a comment along the lines of: > > /* FIXME: sometimes the demangler is invoked when we don't know the > language, so we can't use this everywhere. */ > Here's my crack at doing this [-- Attachment #2: language_demangle.patch --] [-- Type: text/plain, Size: 15256 bytes --] 2003-03-30 Adam Fedor <fedor@gnu.org> * Makefile.in (c_lang.c, jv_lang.c): Add $(demangle_h). * language.h (struct language_defn): Add la_demangle. (language_demangle): Declare. * language.c (language_demangle): New function. (unk_lang_demangle): Likewise. (unknown_language_defn, auto_language_defn, local_language_defn): Add ukn_lang_demangle. * ada-lang.c (ada_language_defn): Add NULL for la_demangle element. * f-lang.c, m2-lang.c, p-lang.c, scm-lang.c: Likewise. * c-lang.c (c_language_defn, asm_language_defn): Likewise. (cplus_language_defn): Add cplus_demangle for la_demangle element. * jv-lang.c (kava_language_defn): Likewise. * objc-lang.c (objc_demangle): Add options argument (objc_language_defn): Use objc_demangle for la_demangle element. * maint.c (maintenance_demangle): Remove language_objc and language_cplus case. Use language_demangle in the default case. * utils.c (fprintf_symbol_filtered): Remove language_cplus case. Use langauge_demangle in the default case. Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.354 diff -u -p -r1.354 Makefile.in --- Makefile.in 30 Mar 2003 14:52:41 -0000 1.354 +++ Makefile.in 31 Mar 2003 00:22:40 -0000 @@ -1568,7 +1568,8 @@ builtin-regs.o: builtin-regs.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \ - $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) + $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) \ + $(demangle_h) c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \ $(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \ @@ -1847,7 +1848,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inf jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \ - $(jv_lang_h) $(gdbcore_h) $(block_h) + $(jv_lang_h) $(gdbcore_h) $(block_h) $(demangle_h) jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \ $(c_lang_h) $(cp_abi_h) Index: ada-lang.c =================================================================== RCS file: /cvs/src/src/gdb/ada-lang.c,v retrieving revision 1.22 diff -u -p -r1.22 ada-lang.c --- ada-lang.c 26 Mar 2003 03:39:43 -0000 1.22 +++ ada-lang.c 31 Mar 2003 00:22:45 -0000 @@ -8081,6 +8081,7 @@ const struct language_defn ada_language_ ada_val_print, /* Print a value using appropriate syntax */ ada_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ #if 0 {"8#%lo#", "8#", "o", "#"}, /* Octal format info */ Index: c-lang.c =================================================================== RCS file: /cvs/src/src/gdb/c-lang.c,v retrieving revision 1.17 diff -u -p -r1.17 c-lang.c --- c-lang.c 26 Mar 2003 03:39:43 -0000 1.17 +++ c-lang.c 31 Mar 2003 00:22:45 -0000 @@ -31,6 +31,7 @@ #include "gdb_assert.h" #include "charset.h" #include "gdb_string.h" +#include "demangle.h" extern void _initialize_c_language (void); static void c_emit_char (int c, struct ui_file * stream, int quoter); @@ -553,6 +554,7 @@ const struct language_defn c_language_de c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -606,6 +608,7 @@ const struct language_defn cplus_languag c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + cplus_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -636,6 +639,7 @@ const struct language_defn asm_language_ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: f-lang.c =================================================================== RCS file: /cvs/src/src/gdb/f-lang.c,v retrieving revision 1.12 diff -u -p -r1.12 f-lang.c --- f-lang.c 26 Mar 2003 03:39:43 -0000 1.12 +++ f-lang.c 31 Mar 2003 00:22:45 -0000 @@ -473,6 +473,7 @@ const struct language_defn f_language_de f_val_print, /* Print a value using appropriate syntax */ c_value_print, /* FIXME */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%o", "0", "o", ""}, /* Octal format info */ {"%d", "", "d", ""}, /* Decimal format info */ Index: jv-lang.c =================================================================== RCS file: /cvs/src/src/gdb/jv-lang.c,v retrieving revision 1.16 diff -u -p -r1.16 jv-lang.c --- jv-lang.c 26 Mar 2003 03:39:44 -0000 1.16 +++ jv-lang.c 31 Mar 2003 00:22:46 -0000 @@ -34,6 +34,7 @@ #include "jv-lang.h" #include "gdbcore.h" #include "block.h" +#include "demangle.h" #include <ctype.h> struct type *java_int_type; @@ -1055,6 +1056,7 @@ const struct language_defn java_language java_val_print, /* Print a value using appropriate syntax */ java_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + cplus_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: language.c =================================================================== RCS file: /cvs/src/src/gdb/language.c,v retrieving revision 1.32 diff -u -p -r1.32 language.c --- language.c 26 Mar 2003 03:39:44 -0000 1.32 +++ language.c 31 Mar 2003 00:22:47 -0000 @@ -1361,6 +1361,16 @@ skip_language_trampoline (CORE_ADDR pc) return 0; } +/* Return demangled language symbol, or NULL. */ +char * +language_demangle (const struct language_defn *current_language, + const char *mangled, int options) +{ + if (current_language != NULL && current_language->la_demangle) + return current_language->la_demangle (mangled, options); + return NULL; +} + /* Define the language that is no language. */ @@ -1428,6 +1438,12 @@ static CORE_ADDR unk_lang_trampoline (CO return 0; } +static char *unk_lang_demangle (const char *mangled, int options) +{ + return NULL; +} + + static struct type **const (unknown_builtin_types[]) = { 0 @@ -1456,6 +1472,7 @@ const struct language_defn unknown_langu unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -1487,6 +1504,7 @@ const struct language_defn auto_language unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -1517,6 +1535,7 @@ const struct language_defn local_languag unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: language.h =================================================================== RCS file: /cvs/src/src/gdb/language.h,v retrieving revision 1.17 diff -u -p -r1.17 language.h --- language.h 26 Mar 2003 03:39:44 -0000 1.17 +++ language.h 31 Mar 2003 00:22:47 -0000 @@ -209,6 +209,11 @@ struct language_defn if it isn't a language tramp for this language. */ CORE_ADDR (*skip_trampoline) (CORE_ADDR pc); + /* Return demangled language symbol, or NULL. + FIXME: sometimes the demangler is invoked when we don't know the + language, so we can't use this everywhere. */ + char *(*la_demangle) (const char *mangled, int options); + /* Base 2 (binary) formats. */ struct language_format_info la_binary_format; @@ -474,5 +479,9 @@ extern enum language get_frame_language /* Check for a language-specific trampoline. */ extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc); + +/* Return demangled language symbol, or NULL. */ +extern char *language_demangle (const struct language_defn *current_language, + const char *mangled, int options); #endif /* defined (LANGUAGE_H) */ Index: m2-lang.c =================================================================== RCS file: /cvs/src/src/gdb/m2-lang.c,v retrieving revision 1.8 diff -u -p -r1.8 m2-lang.c --- m2-lang.c 26 Mar 2003 03:39:44 -0000 1.8 +++ m2-lang.c 31 Mar 2003 00:22:47 -0000 @@ -427,6 +427,7 @@ const struct language_defn m2_language_d m2_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"%loB", "", "o", "B"}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: maint.c =================================================================== RCS file: /cvs/src/src/gdb/maint.c,v retrieving revision 1.35 diff -u -p -r1.35 maint.c --- maint.c 20 Feb 2003 17:17:24 -0000 1.35 +++ maint.c 31 Mar 2003 00:22:47 -0000 @@ -153,13 +153,9 @@ maintenance_demangle (char *args, int fr { switch (current_language->la_language) { - case language_objc: - /* Commented out until ObjC handling is enabled. */ - /* demangled = objc_demangle (args); */ - /* break; */ - case language_cplus: default: - demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS); + demangled = language_demangle (current_language, args, + DMGL_ANSI | DMGL_PARAMS); break; } if (demangled != NULL) Index: objc-lang.c =================================================================== RCS file: /cvs/src/src/gdb/objc-lang.c,v retrieving revision 1.14 diff -u -p -r1.14 objc-lang.c --- objc-lang.c 26 Mar 2003 03:39:44 -0000 1.14 +++ objc-lang.c 31 Mar 2003 00:22:48 -0000 @@ -237,7 +237,7 @@ value_nsstring (char *ptr, int len) /* Objective-C name demangling. */ char * -objc_demangle (const char *mangled) +objc_demangle (const char *mangled, int options) { char *demangled, *cp; @@ -700,6 +700,7 @@ const struct language_defn objc_language c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ objc_skip_trampoline, /* Language specific skip_trampoline */ + objc_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: objc-lang.h =================================================================== RCS file: /cvs/src/src/gdb/objc-lang.h,v retrieving revision 1.8 diff -u -p -r1.8 objc-lang.h --- objc-lang.h 25 Mar 2003 02:18:55 -0000 1.8 +++ objc-lang.h 31 Mar 2003 00:22:48 -0000 @@ -41,7 +41,7 @@ extern int c_value_print (struct value * extern CORE_ADDR lookup_objc_class (char *classname); extern int lookup_child_selector (char *methodname); -extern char *objc_demangle (const char *mangled); +extern char *objc_demangle (const char *mangled, int options); extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc); Index: p-lang.c =================================================================== RCS file: /cvs/src/src/gdb/p-lang.c,v retrieving revision 1.10 diff -u -p -r1.10 p-lang.c --- p-lang.c 26 Mar 2003 03:39:44 -0000 1.10 +++ p-lang.c 31 Mar 2003 00:22:49 -0000 @@ -462,6 +462,7 @@ const struct language_defn pascal_langua pascal_val_print, /* Print a value using appropriate syntax */ pascal_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "%", "b", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: scm-lang.c =================================================================== RCS file: /cvs/src/src/gdb/scm-lang.c,v retrieving revision 1.14 diff -u -p -r1.14 scm-lang.c --- scm-lang.c 26 Mar 2003 03:39:44 -0000 1.14 +++ scm-lang.c 31 Mar 2003 00:22:49 -0000 @@ -251,6 +251,7 @@ const struct language_defn scm_language_ scm_val_print, /* Print a value using appropriate syntax */ scm_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"#o%lo", "#o", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.98 diff -u -p -r1.98 utils.c --- utils.c 26 Feb 2003 14:35:19 -0000 1.98 +++ utils.c 31 Mar 2003 00:22:50 -0000 @@ -2300,18 +2300,12 @@ fprintf_symbol_filtered (struct ui_file { switch (lang) { - case language_cplus: - demangled = cplus_demangle (name, arg_mode); - break; case language_java: demangled = cplus_demangle (name, arg_mode | DMGL_JAVA); break; - case language_objc: - /* Commented out until ObjC handling is enabled. */ - /*demangled = objc_demangle (name); */ - /*break; */ default: - demangled = NULL; + demangled = language_demangle (language_def (lang), + name, arg_mode); break; } fputs_filtered (demangled ? demangled : name, stream); ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-31 2:23 ` Adam Fedor @ 2003-03-31 22:39 ` Andrew Cagney 2003-03-31 22:53 ` David Carlton 1 sibling, 0 replies; 23+ messages in thread From: Andrew Cagney @ 2003-03-31 22:39 UTC (permalink / raw) To: Adam Fedor, Daniel Jacobowitz; +Cc: GDB Patches > > > Daniel Jacobowitz wrote: > On Thu, Mar 20, 2003 at 05:13:40PM -0500, Andrew Cagney wrote: > > > Would it be possible to make the cplus_demangle() method part of the language vector? That way code like the patch below could be reduced to: > > /* Return demangled language symbol, or NULL. */ > language_demangle (current_language, arg); > > This would in turn allow Adam to just add an equivalent objc_demangle() method to the objc language vector, and hence eliminate the need to always link in objc-lang.c. > > As well as then? The places where objc is adding calls to the demangler the language is known. > > > My gut reaction is that it's just clutter until we decide how to solve > the problem of not knowing demanglings. But it'll do for now. I'd > like a comment along the lines of: > > /* FIXME: sometimes the demangler is invoked when we don't know the > language, so we can't use this everywhere. */ > > > Here's my crack at doing this Looks right to me. Daniel, see any C++ problems? > 2003-03-30 Adam Fedor <fedor@gnu.org> > > * Makefile.in (c_lang.c, jv_lang.c): Add $(demangle_h). I think you ment c-lang.o, jv-lang.o. Andrew ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-31 2:23 ` Adam Fedor 2003-03-31 22:39 ` Andrew Cagney @ 2003-03-31 22:53 ` David Carlton 2003-03-31 23:03 ` David Carlton 2003-03-31 23:15 ` Adam Fedor 1 sibling, 2 replies; 23+ messages in thread From: David Carlton @ 2003-03-31 22:53 UTC (permalink / raw) To: Adam Fedor; +Cc: GDB Patches, Daniel Jacobowitz, Andrew Cagney On Sun, 30 Mar 2003 19:23:08 -0700, Adam Fedor <fedor@doc.com> said: > Here's my crack at doing [language-specific demangling]. This patch bothers me: it doesn't handle Java cleanly, and I'm not sure about the 'options' argument to language_demangle. It seems to me that, at the very least, there should be a java_demangle function defined that takes the options passed in, applies '| DMGL_JAVA' to it, and calls cplus_demangle. But I also wanted to double-check: does 'options' really make sense for all language types? If I'm reading the patch correctly, it looks like Objective C just throws it away. If that's the case, then I don't think that 'options' should be part of the language vector: if C++ needs it for internal purposes, then C++ could have its own more flexible demangler with that option (which Java could also use), but the version in the language vector should be more restricted. David Carlton carlton@math.stanford.edu ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-31 22:53 ` David Carlton @ 2003-03-31 23:03 ` David Carlton 2003-03-31 23:15 ` Adam Fedor 1 sibling, 0 replies; 23+ messages in thread From: David Carlton @ 2003-03-31 23:03 UTC (permalink / raw) To: Adam Fedor; +Cc: GDB Patches, Daniel Jacobowitz, Andrew Cagney On 31 Mar 2003 14:53:21 -0800, David Carlton <carlton@math.stanford.edu> said: > On Sun, 30 Mar 2003 19:23:08 -0700, Adam Fedor <fedor@doc.com> said: >> Here's my crack at doing [language-specific demangling]. > This patch bothers me: it doesn't handle Java cleanly, and I'm not > sure about the 'options' argument to language_demangle. Also, I'm not convinced that it's best for the unknown language demangler to always return NULL. Probably Adam's patch isn't too bad in that regard: it will change the behavior of 'maint demangle', but we can work around that if it's important, and it won't change the behavior of fprintf_symbol_filtered; those are the only places where Adam's patch actually calls language_demangler. But, given that we don't always reliably know the current language (and could conceivably figure that out via demangling, modulo Java/C++ confusion), I'm not convinced that returning NULL is the right thing. (Or that it isn't the right thing.) David Carlton carlton@math.stanford.edu ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-31 22:53 ` David Carlton 2003-03-31 23:03 ` David Carlton @ 2003-03-31 23:15 ` Adam Fedor 2003-04-01 0:31 ` Andrew Cagney 1 sibling, 1 reply; 23+ messages in thread From: Adam Fedor @ 2003-03-31 23:15 UTC (permalink / raw) To: David Carlton; +Cc: GDB Patches, Daniel Jacobowitz, Andrew Cagney On Monday, March 31, 2003, at 03:53 PM, David Carlton wrote: > On Sun, 30 Mar 2003 19:23:08 -0700, Adam Fedor <fedor@doc.com> said: > >> Here's my crack at doing [language-specific demangling]. > > This patch bothers me: it doesn't handle Java cleanly, and I'm not > sure about the 'options' argument to language_demangle. It seems to > me that, at the very least, there should be a java_demangle function > defined that takes the options passed in, applies '| DMGL_JAVA' to it, > and calls cplus_demangle. > Sure. That makes sense. > But I also wanted to double-check: does 'options' really make sense > for all language types? If I'm reading the patch correctly, it looks > like Objective C just throws it away. If that's the case, then I > don't think that 'options' should be part of the language vector: if > C++ needs it for internal purposes, then C++ could have its own more > flexible demangler with that option (which Java could also use), but > the version in the language vector should be more restricted. > > Then I should go back to the case where if we know the language is cplus or java, then call cplus_demangle(/java_demangle), otherwise use language_demangle? ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-31 23:15 ` Adam Fedor @ 2003-04-01 0:31 ` Andrew Cagney 2003-04-01 0:45 ` David Carlton 2003-04-01 4:09 ` Adam Fedor 0 siblings, 2 replies; 23+ messages in thread From: Andrew Cagney @ 2003-04-01 0:31 UTC (permalink / raw) To: Adam Fedor; +Cc: David Carlton, GDB Patches, Daniel Jacobowitz > > On Monday, March 31, 2003, at 03:53 PM, David Carlton wrote: > > On Sun, 30 Mar 2003 19:23:08 -0700, Adam Fedor <fedor@doc.com> said: > > Here's my crack at doing [language-specific demangling]. > >> This patch bothers me: it doesn't handle Java cleanly, and I'm not >> sure about the 'options' argument to language_demangle. It seems to >> me that, at the very least, there should be a java_demangle function >> defined that takes the options passed in, applies '| DMGL_JAVA' to it, >> and calls cplus_demangle. > Sure. That makes sense. > >> But I also wanted to double-check: does 'options' really make sense >> for all language types? If I'm reading the patch correctly, it looks >> like Objective C just throws it away. If that's the case, then I >> don't think that 'options' should be part of the language vector: if >> C++ needs it for internal purposes, then C++ could have its own more >> flexible demangler with that option (which Java could also use), but >> the version in the language vector should be more restricted. > > > Then I should go back to the case where if we know the language is cplus or java, then call cplus_demangle(/java_demangle), otherwise use language_demangle? Either that, or add a FIXME comment explaining why the options shouldn't be there. The problem with trying to eliminate the parameter is that it also means eliminating it from things like fprintf_symbol_filtered(). While likely a good idea, it is getting beyond the scope of this immediate patch. >> Also, I'm not convinced that it's best for the unknown language >> demangler to always return NULL. Probably Adam's patch isn't too bad >> in that regard: it will change the behavior of 'maint demangle', but >> we can work around that if it's important, and it won't change the >> behavior of fprintf_symbol_filtered; those are the only places where >> Adam's patch actually calls language_demangler. But, given that we >> don't always reliably know the current language (and could conceivably >> figure that out via demangling, modulo Java/C++ confusion), I'm not >> convinced that returning NULL is the right thing. (Or that it isn't >> the right thing.) Hmm, good catch. Any reason for the unknown language demangler to not just do c++ demangling? Andrew ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-04-01 0:31 ` Andrew Cagney @ 2003-04-01 0:45 ` David Carlton 2003-04-01 4:09 ` Adam Fedor 1 sibling, 0 replies; 23+ messages in thread From: David Carlton @ 2003-04-01 0:45 UTC (permalink / raw) To: Andrew Cagney; +Cc: Adam Fedor, GDB Patches, Daniel Jacobowitz On Mon, 31 Mar 2003 19:31:12 -0500, Andrew Cagney <ac131313@redhat.com> said: > The problem with trying to eliminate the parameter is that it also > means eliminating it from things like fprintf_symbol_filtered(). > While likely a good idea, it is getting beyond the scope of this > immediate patch. Yeah, that's a good point: I'd been assuming that having the C++ language vector's member use DMGL_ANSI | DMGL_PARAMS would be good enough (since we could still allow explicit calls to cplus_demangle where we need full control over the demangling style), but looking through the various calls to cplus_demangle and fprintf_symbol_filtered, I guess that wouldn't be wise just yet. So probably, for now, we shouldn't get rid of that argument in the language vector member. David Carlton carlton@math.stanford.edu ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-04-01 0:31 ` Andrew Cagney 2003-04-01 0:45 ` David Carlton @ 2003-04-01 4:09 ` Adam Fedor 2003-04-01 21:31 ` David Carlton 2003-04-01 21:38 ` Daniel Jacobowitz 1 sibling, 2 replies; 23+ messages in thread From: Adam Fedor @ 2003-04-01 4:09 UTC (permalink / raw) To: Andrew Cagney; +Cc: David Carlton, GDB Patches, Daniel Jacobowitz [-- Attachment #1: Type: text/plain, Size: 215 bytes --] Andrew Cagney wrote: > > > Hmm, good catch. Any reason for the unknown language demangler to not > just do c++ demangling? > OK. Here I've add java_demangle and now ukn_lang_demangle uses cplus_demangle. [-- Attachment #2: language_demangle.patch --] [-- Type: text/plain, Size: 16652 bytes --] 2003-03-31 Adam Fedor <fedor@gnu.org> * Makefile.in (c_lang.o, jv_lang.o, language.o): Add $(demangle_h). * language.h (struct language_defn): Add la_demangle. (language_demangle): Declare. * language.c (language_demangle): New function. (unk_lang_demangle): Likewise. (unknown_language_defn, auto_language_defn, local_language_defn): Add ukn_lang_demangle. * ada-lang.c (ada_language_defn): Add NULL for la_demangle element. * f-lang.c, m2-lang.c, p-lang.c, scm-lang.c: Likewise. * c-lang.c (c_language_defn, asm_language_defn): Likewise. (cplus_language_defn): Add cplus_demangle for la_demangle element. * jv-lang.c (java_demangle): New function (java_language_defn): Use it for la_demangle element. * objc-lang.c (objc_demangle): Add options argument (objc_language_defn): Use objc_demangle for la_demangle element. * maint.c (maintenance_demangle): Remove language_objc and language_cplus case. Use language_demangle in the default case. * utils.c (fprintf_symbol_filtered): Remove language_cplus, language_java, and langauge_objc case. Use langauge_demangle in the default case. Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.354 diff -u -p -r1.354 Makefile.in --- Makefile.in 30 Mar 2003 14:52:41 -0000 1.354 +++ Makefile.in 1 Apr 2003 04:00:49 -0000 @@ -1568,7 +1568,8 @@ builtin-regs.o: builtin-regs.c $(defs_h) $(gdb_string_h) $(gdb_assert_h) c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \ - $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) + $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) \ + $(demangle_h) c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \ $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \ $(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \ @@ -1847,7 +1848,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inf jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \ $(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \ - $(jv_lang_h) $(gdbcore_h) $(block_h) + $(jv_lang_h) $(gdbcore_h) $(block_h) $(demangle_h) jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \ $(c_lang_h) $(cp_abi_h) @@ -1859,7 +1860,7 @@ kod.o: kod.c $(defs_h) $(command_h) $(gd $(kod_h) language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \ - $(parser_defs_h) $(jv_lang_h) + $(parser_defs_h) $(jv_lang_h) $(demangle_h) lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \ $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h) linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \ Index: ada-lang.c =================================================================== RCS file: /cvs/src/src/gdb/ada-lang.c,v retrieving revision 1.22 diff -u -p -r1.22 ada-lang.c --- ada-lang.c 26 Mar 2003 03:39:43 -0000 1.22 +++ ada-lang.c 1 Apr 2003 04:01:00 -0000 @@ -8081,6 +8081,7 @@ const struct language_defn ada_language_ ada_val_print, /* Print a value using appropriate syntax */ ada_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ #if 0 {"8#%lo#", "8#", "o", "#"}, /* Octal format info */ Index: c-lang.c =================================================================== RCS file: /cvs/src/src/gdb/c-lang.c,v retrieving revision 1.17 diff -u -p -r1.17 c-lang.c --- c-lang.c 26 Mar 2003 03:39:43 -0000 1.17 +++ c-lang.c 1 Apr 2003 04:01:00 -0000 @@ -31,6 +31,7 @@ #include "gdb_assert.h" #include "charset.h" #include "gdb_string.h" +#include "demangle.h" extern void _initialize_c_language (void); static void c_emit_char (int c, struct ui_file * stream, int quoter); @@ -553,6 +554,7 @@ const struct language_defn c_language_de c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -606,6 +608,7 @@ const struct language_defn cplus_languag c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + cplus_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -636,6 +639,7 @@ const struct language_defn asm_language_ c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: f-lang.c =================================================================== RCS file: /cvs/src/src/gdb/f-lang.c,v retrieving revision 1.12 diff -u -p -r1.12 f-lang.c --- f-lang.c 26 Mar 2003 03:39:43 -0000 1.12 +++ f-lang.c 1 Apr 2003 04:01:00 -0000 @@ -473,6 +473,7 @@ const struct language_defn f_language_de f_val_print, /* Print a value using appropriate syntax */ c_value_print, /* FIXME */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%o", "0", "o", ""}, /* Octal format info */ {"%d", "", "d", ""}, /* Decimal format info */ Index: jv-lang.c =================================================================== RCS file: /cvs/src/src/gdb/jv-lang.c,v retrieving revision 1.16 diff -u -p -r1.16 jv-lang.c --- jv-lang.c 26 Mar 2003 03:39:44 -0000 1.16 +++ jv-lang.c 1 Apr 2003 04:01:00 -0000 @@ -34,6 +34,7 @@ #include "jv-lang.h" #include "gdbcore.h" #include "block.h" +#include "demangle.h" #include <ctype.h> struct type *java_int_type; @@ -996,6 +997,12 @@ java_create_fundamental_type (struct obj return c_create_fundamental_type (objfile, typeid); } +static char *java_demangle (const char *mangled, int options) +{ + return cplus_demangle (mangled, options | DMGL_JAVA); +} + + /* Table mapping opcodes into strings for printing operators and precedences of the operators. */ @@ -1055,6 +1062,7 @@ const struct language_defn java_language java_val_print, /* Print a value using appropriate syntax */ java_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + java_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: language.c =================================================================== RCS file: /cvs/src/src/gdb/language.c,v retrieving revision 1.32 diff -u -p -r1.32 language.c --- language.c 26 Mar 2003 03:39:44 -0000 1.32 +++ language.c 1 Apr 2003 04:01:02 -0000 @@ -44,6 +44,7 @@ #include "target.h" #include "parser-defs.h" #include "jv-lang.h" +#include "demangle.h" extern void _initialize_language (void); @@ -1361,6 +1362,21 @@ skip_language_trampoline (CORE_ADDR pc) return 0; } +/* Return demangled language symbol, or NULL. + FIXME: Options are only useful for certain languages and ignored + by others, so it would be better to remove them here and have a + more flexible demangler for the languages that need it. + FIXME: Sometimes the demangler is invoked when we don't know the + language, so we can't use this everywhere. */ +char * +language_demangle (const struct language_defn *current_language, + const char *mangled, int options) +{ + if (current_language != NULL && current_language->la_demangle) + return current_language->la_demangle (mangled, options); + return NULL; +} + /* Define the language that is no language. */ @@ -1428,6 +1444,13 @@ static CORE_ADDR unk_lang_trampoline (CO return 0; } +/* Unknown languages just use the cplus demangler. */ +static char *unk_lang_demangle (const char *mangled, int options) +{ + return cplus_demangle (mangled, options); +} + + static struct type **const (unknown_builtin_types[]) = { 0 @@ -1456,6 +1479,7 @@ const struct language_defn unknown_langu unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -1487,6 +1511,7 @@ const struct language_defn auto_language unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ @@ -1517,6 +1542,7 @@ const struct language_defn local_languag unk_lang_val_print, /* Print a value using appropriate syntax */ unk_lang_value_print, /* Print a top-level value */ unk_lang_trampoline, /* Language specific skip_trampoline */ + unk_lang_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: language.h =================================================================== RCS file: /cvs/src/src/gdb/language.h,v retrieving revision 1.17 diff -u -p -r1.17 language.h --- language.h 26 Mar 2003 03:39:44 -0000 1.17 +++ language.h 1 Apr 2003 04:01:05 -0000 @@ -209,6 +209,9 @@ struct language_defn if it isn't a language tramp for this language. */ CORE_ADDR (*skip_trampoline) (CORE_ADDR pc); + /* Return demangled language symbol, or NULL. */ + char *(*la_demangle) (const char *mangled, int options); + /* Base 2 (binary) formats. */ struct language_format_info la_binary_format; @@ -474,5 +477,9 @@ extern enum language get_frame_language /* Check for a language-specific trampoline. */ extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc); + +/* Return demangled language symbol, or NULL. */ +extern char *language_demangle (const struct language_defn *current_language, + const char *mangled, int options); #endif /* defined (LANGUAGE_H) */ Index: m2-lang.c =================================================================== RCS file: /cvs/src/src/gdb/m2-lang.c,v retrieving revision 1.8 diff -u -p -r1.8 m2-lang.c --- m2-lang.c 26 Mar 2003 03:39:44 -0000 1.8 +++ m2-lang.c 1 Apr 2003 04:01:05 -0000 @@ -427,6 +427,7 @@ const struct language_defn m2_language_d m2_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"%loB", "", "o", "B"}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: maint.c =================================================================== RCS file: /cvs/src/src/gdb/maint.c,v retrieving revision 1.35 diff -u -p -r1.35 maint.c --- maint.c 20 Feb 2003 17:17:24 -0000 1.35 +++ maint.c 1 Apr 2003 04:01:12 -0000 @@ -153,13 +153,9 @@ maintenance_demangle (char *args, int fr { switch (current_language->la_language) { - case language_objc: - /* Commented out until ObjC handling is enabled. */ - /* demangled = objc_demangle (args); */ - /* break; */ - case language_cplus: default: - demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS); + demangled = language_demangle (current_language, args, + DMGL_ANSI | DMGL_PARAMS); break; } if (demangled != NULL) Index: objc-lang.c =================================================================== RCS file: /cvs/src/src/gdb/objc-lang.c,v retrieving revision 1.14 diff -u -p -r1.14 objc-lang.c --- objc-lang.c 26 Mar 2003 03:39:44 -0000 1.14 +++ objc-lang.c 1 Apr 2003 04:01:17 -0000 @@ -237,7 +237,7 @@ value_nsstring (char *ptr, int len) /* Objective-C name demangling. */ char * -objc_demangle (const char *mangled) +objc_demangle (const char *mangled, int options) { char *demangled, *cp; @@ -700,6 +700,7 @@ const struct language_defn objc_language c_val_print, /* Print a value using appropriate syntax */ c_value_print, /* Print a top-level value */ objc_skip_trampoline, /* Language specific skip_trampoline */ + objc_demangle, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: objc-lang.h =================================================================== RCS file: /cvs/src/src/gdb/objc-lang.h,v retrieving revision 1.8 diff -u -p -r1.8 objc-lang.h --- objc-lang.h 25 Mar 2003 02:18:55 -0000 1.8 +++ objc-lang.h 1 Apr 2003 04:01:17 -0000 @@ -41,7 +41,7 @@ extern int c_value_print (struct value * extern CORE_ADDR lookup_objc_class (char *classname); extern int lookup_child_selector (char *methodname); -extern char *objc_demangle (const char *mangled); +extern char *objc_demangle (const char *mangled, int options); extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc); Index: p-lang.c =================================================================== RCS file: /cvs/src/src/gdb/p-lang.c,v retrieving revision 1.10 diff -u -p -r1.10 p-lang.c --- p-lang.c 26 Mar 2003 03:39:44 -0000 1.10 +++ p-lang.c 1 Apr 2003 04:01:19 -0000 @@ -462,6 +462,7 @@ const struct language_defn pascal_langua pascal_val_print, /* Print a value using appropriate syntax */ pascal_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "%", "b", ""}, /* Binary format info */ {"0%lo", "0", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: scm-lang.c =================================================================== RCS file: /cvs/src/src/gdb/scm-lang.c,v retrieving revision 1.14 diff -u -p -r1.14 scm-lang.c --- scm-lang.c 26 Mar 2003 03:39:44 -0000 1.14 +++ scm-lang.c 1 Apr 2003 04:01:19 -0000 @@ -251,6 +251,7 @@ const struct language_defn scm_language_ scm_val_print, /* Print a value using appropriate syntax */ scm_value_print, /* Print a top-level value */ NULL, /* Language specific skip_trampoline */ + NULL, /* Language specific symbol demangler */ {"", "", "", ""}, /* Binary format info */ {"#o%lo", "#o", "o", ""}, /* Octal format info */ {"%ld", "", "d", ""}, /* Decimal format info */ Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.98 diff -u -p -r1.98 utils.c --- utils.c 26 Feb 2003 14:35:19 -0000 1.98 +++ utils.c 1 Apr 2003 04:01:30 -0000 @@ -2300,18 +2300,9 @@ fprintf_symbol_filtered (struct ui_file { switch (lang) { - case language_cplus: - demangled = cplus_demangle (name, arg_mode); - break; - case language_java: - demangled = cplus_demangle (name, arg_mode | DMGL_JAVA); - break; - case language_objc: - /* Commented out until ObjC handling is enabled. */ - /*demangled = objc_demangle (name); */ - /*break; */ default: - demangled = NULL; + demangled = language_demangle (language_def (lang), + name, arg_mode); break; } fputs_filtered (demangled ? demangled : name, stream); ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-04-01 4:09 ` Adam Fedor @ 2003-04-01 21:31 ` David Carlton 2003-04-01 21:38 ` Daniel Jacobowitz 1 sibling, 0 replies; 23+ messages in thread From: David Carlton @ 2003-04-01 21:31 UTC (permalink / raw) To: Adam Fedor; +Cc: Andrew Cagney, GDB Patches, Daniel Jacobowitz On Mon, 31 Mar 2003 21:09:25 -0700, Adam Fedor <fedor@doc.com> said: > OK. Here I've add java_demangle and now ukn_lang_demangle uses > cplus_demangle. Looks reasonable to me, as long as Daniel says it's okay. David Carlton carlton@math.stanford.edu ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-04-01 4:09 ` Adam Fedor 2003-04-01 21:31 ` David Carlton @ 2003-04-01 21:38 ` Daniel Jacobowitz 1 sibling, 0 replies; 23+ messages in thread From: Daniel Jacobowitz @ 2003-04-01 21:38 UTC (permalink / raw) To: Adam Fedor; +Cc: Andrew Cagney, David Carlton, GDB Patches On Mon, Mar 31, 2003 at 09:09:25PM -0700, Adam Fedor wrote: > > > Andrew Cagney wrote: > > > > > >Hmm, good catch. Any reason for the unknown language demangler to not > >just do c++ demangling? > > > > OK. Here I've add java_demangle and now ukn_lang_demangle uses > cplus_demangle. I think you've satisfied all my concerns. Since Andrew and David both liked this patch, it's OK to check in now. Please fix one thing for me: there are two switch statements below from which you remove all cases except for default. Please remove the switches entirely. > @@ -153,13 +153,9 @@ maintenance_demangle (char *args, int fr > { > switch (current_language->la_language) > { > - case language_objc: > - /* Commented out until ObjC handling is enabled. */ > - /* demangled = objc_demangle (args); */ > - /* break; */ > - case language_cplus: > default: > - demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS); > + demangled = language_demangle (current_language, args, > + DMGL_ANSI | DMGL_PARAMS); > break; > } > if (demangled != NULL) > Index: utils.c > =================================================================== > RCS file: /cvs/src/src/gdb/utils.c,v > retrieving revision 1.98 > diff -u -p -r1.98 utils.c > --- utils.c 26 Feb 2003 14:35:19 -0000 1.98 > +++ utils.c 1 Apr 2003 04:01:30 -0000 > @@ -2300,18 +2300,9 @@ fprintf_symbol_filtered (struct ui_file > { > switch (lang) > { > - case language_cplus: > - demangled = cplus_demangle (name, arg_mode); > - break; > - case language_java: > - demangled = cplus_demangle (name, arg_mode | DMGL_JAVA); > - break; > - case language_objc: > - /* Commented out until ObjC handling is enabled. */ > - /*demangled = objc_demangle (name); */ > - /*break; */ > default: > - demangled = NULL; > + demangled = language_demangle (language_def (lang), > + name, arg_mode); > break; > } > fputs_filtered (demangled ? demangled : name, stream); -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-20 21:39 ` Daniel Jacobowitz 2003-03-20 22:13 ` Andrew Cagney @ 2003-03-20 22:22 ` David Ayers 1 sibling, 0 replies; 23+ messages in thread From: David Ayers @ 2003-03-20 22:22 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Andrew Cagney, Adam Fedor, GDB Patches Hello, Please also keep in mind, that hopefully one day (now that the parser issue is being tackled in gcc) gcc will hopefully support ObjC++ code. (i.e. ObjC and C++ code in one file / member function / method.) I'm not sure how this would play into the mechanics of language specific demangeling functions and how these mechanics would decided which function to use, but I just wanted to make sure everyone is aware of this when thinking about it. Cheers, David Ayers Daniel Jacobowitz wrote: >Not without some substantial thought. We use cplus_demangle in a lot >of places where we don't even know what the language is supposed to be >- for minsyms, during lookups, et cetera. > >Certainly it needs to be thought about. At least objc's mangling is >probably not entirely ambiguous with C++/Java's? I don't know. > >On Thu, Mar 20, 2003 at 04:27:02PM -0500, Andrew Cagney wrote: > > >>Daniel, >> >>Would it be possible to make the cplus_demangle() method part of the >>language vector? That way code like the patch below could be reduced to: >> >> /* Return demangled language symbol, or NULL. */ >> language_demangle (current_language, arg); >> >>This would in turn allow Adam to just add an equivalent objc_demangle() >>method to the objc language vector, and hence eliminate the need to >>always link in objc-lang.c. >> >>Andrew >> >> >> ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-01-03 22:06 [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] Adam Fedor 2003-02-19 19:02 ` Elena Zannoni 2003-03-20 21:27 ` Andrew Cagney @ 2003-03-20 21:35 ` Andrew Cagney 2003-03-24 17:46 ` Adam Fedor 2 siblings, 1 reply; 23+ messages in thread From: Andrew Cagney @ 2003-03-20 21:35 UTC (permalink / raw) To: Adam Fedor; +Cc: GDB Patches > Index: parser-defs.h > =================================================================== > RCS file: /cvs/src/src/gdb/parser-defs.h,v > retrieving revision 1.15 > diff -u -p -r1.15 parser-defs.h > --- parser-defs.h 19 Nov 2002 03:15:01 -0000 1.15 > +++ parser-defs.h 3 Jan 2003 03:06:25 -0000 > @@ -223,4 +223,9 @@ struct op_print > > extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3); > > +/* for parsing Objective C */ > +extern void start_msglist (void); > +extern void add_msglist (struct stoken *str, int addcolon); > +extern int end_msglist (void); > + > #endif /* PARSER_DEFS_H */ Adam, I think the above declarations belong in "objc-lang.h" (since the corresponding definitions are in "objc-lang.c"). With that tweak, are you able to build a GDB that only links in objc-exp.[yo]? Andrew ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-20 21:35 ` Andrew Cagney @ 2003-03-24 17:46 ` Adam Fedor 2003-03-24 18:25 ` Andrew Cagney 0 siblings, 1 reply; 23+ messages in thread From: Adam Fedor @ 2003-03-24 17:46 UTC (permalink / raw) To: Andrew Cagney; +Cc: GDB Patches [-- Attachment #1: Type: text/plain, Size: 931 bytes --] Andrew Cagney wrote: >> Index: parser-defs.h >> =================================================================== >> RCS file: /cvs/src/src/gdb/parser-defs.h,v >> retrieving revision 1.15 >> diff -u -p -r1.15 parser-defs.h >> --- parser-defs.h 19 Nov 2002 03:15:01 -0000 1.15 >> +++ parser-defs.h 3 Jan 2003 03:06:25 -0000 >> @@ -223,4 +223,9 @@ struct op_print >> >> extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT >> (printf, 2 ,3); >> >> +/* for parsing Objective C */ >> +extern void start_msglist (void); >> +extern void add_msglist (struct stoken *str, int addcolon); >> +extern int end_msglist (void); >> + >> #endif /* PARSER_DEFS_H */ > > > Adam, > > I think the above declarations belong in "objc-lang.h" (since the > corresponding definitions are in "objc-lang.c"). With that tweak, are > you able to build a GDB that only links in objc-exp.[yo]? > Yes this does work... [-- Attachment #2: enable-objc-exp.patch --] [-- Type: text/plain, Size: 1845 bytes --] 2003-03-24 Adam Fedor <fedor@gnu.org> * Makefile.in (objc_lang_h): Add $(paser_defs_h) (YYOBJ): Add objc-exp.tab.o * objc-lang.h: Add multiple inclusion protection. (start_msglist, add_msglist, end_msglist): Additional declarations. Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.349 diff -u -p -r1.349 Makefile.in --- Makefile.in 22 Mar 2003 14:54:58 -0000 1.349 +++ Makefile.in 24 Mar 2003 17:38:59 -0000 @@ -686,7 +686,7 @@ mipsnbsd_tdep_h = mipsnbsd-tdep.h monitor_h = monitor.h nbsd_tdep_h = nbsd-tdep.h ns32k_tdep_h = ns32k-tdep.h -objc_lang_h = objc-lang.h +objc_lang_h = objc-lang.h $(parser_defs_h) objfiles_h = objfiles.h $(gdb_obstack_h) $(symfile_h) observer_h = observer.h ocd_h = ocd.h @@ -874,6 +874,7 @@ YYFILES = c-exp.tab.c \ jv-exp.tab.c \ f-exp.tab.c m2-exp.tab.c p-exp.tab.c YYOBJ = c-exp.tab.o \ + objc-exp.tab.o \ jv-exp.tab.o \ f-exp.tab.o m2-exp.tab.o p-exp.tab.o Index: objc-lang.h =================================================================== RCS file: /cvs/src/src/gdb/objc-lang.h,v retrieving revision 1.7 diff -u -p -r1.7 objc-lang.h --- objc-lang.h 21 Feb 2003 02:45:50 -0000 1.7 +++ objc-lang.h 24 Mar 2003 17:39:11 -0000 @@ -19,6 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#if !defined(OBJC_LANG_H) +#define OBJC_LANG_H + +#include "parser-defs.h" + struct value; struct block; @@ -51,3 +56,10 @@ extern char *find_imps (struct symtab *s unsigned int *nsym, unsigned int *ndebug); extern struct value *value_nsstring (char *ptr, int len); + +/* for parsing Objective C */ +extern void start_msglist (void); +extern void add_msglist (struct stoken *str, int addcolon); +extern int end_msglist (void); + +#endif ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-24 17:46 ` Adam Fedor @ 2003-03-24 18:25 ` Andrew Cagney 2003-03-25 2:23 ` Adam Fedor 0 siblings, 1 reply; 23+ messages in thread From: Andrew Cagney @ 2003-03-24 18:25 UTC (permalink / raw) To: Adam Fedor; +Cc: GDB Patches > Yes this does work... > +#if !defined(OBJC_LANG_H) > +#define OBJC_LANG_H Yes, good. > +#include "parser-defs.h" I think just: struct stoken; is sufficient? > struct value; > struct block; > > @@ -51,3 +56,10 @@ extern char *find_imps (struct symtab *s > unsigned int *nsym, unsigned int *ndebug); > > extern struct value *value_nsstring (char *ptr, int len); > + > +/* for parsing Objective C */ > +extern void start_msglist (void); > +extern void add_msglist (struct stoken *str, int addcolon); > +extern int end_msglist (void); > + > +#endif Either way, approved. Andrew ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] 2003-03-24 18:25 ` Andrew Cagney @ 2003-03-25 2:23 ` Adam Fedor 0 siblings, 0 replies; 23+ messages in thread From: Adam Fedor @ 2003-03-25 2:23 UTC (permalink / raw) To: Andrew Cagney; +Cc: GDB Patches Andrew Cagney wrote: > >> Yes this does work... > > >> +#if !defined(OBJC_LANG_H) >> +#define OBJC_LANG_H > > > Yes, good. > >> +#include "parser-defs.h" > > > I think just: > > struct stoken; > > is sufficient? > Yes, thanks. I commited this. ^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2003-04-01 21:38 UTC | newest] Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-01-03 22:06 [RFA] Compile objc-lang.c, objc-exp.tab.c [1/5] Adam Fedor 2003-02-19 19:02 ` Elena Zannoni 2003-02-19 20:27 ` Adam Fedor 2003-02-19 21:11 ` Elena Zannoni 2003-03-20 21:27 ` Andrew Cagney 2003-03-20 21:39 ` Daniel Jacobowitz 2003-03-20 22:13 ` Andrew Cagney 2003-03-20 22:19 ` Daniel Jacobowitz 2003-03-31 2:23 ` Adam Fedor 2003-03-31 22:39 ` Andrew Cagney 2003-03-31 22:53 ` David Carlton 2003-03-31 23:03 ` David Carlton 2003-03-31 23:15 ` Adam Fedor 2003-04-01 0:31 ` Andrew Cagney 2003-04-01 0:45 ` David Carlton 2003-04-01 4:09 ` Adam Fedor 2003-04-01 21:31 ` David Carlton 2003-04-01 21:38 ` Daniel Jacobowitz 2003-03-20 22:22 ` David Ayers 2003-03-20 21:35 ` Andrew Cagney 2003-03-24 17:46 ` Adam Fedor 2003-03-24 18:25 ` Andrew Cagney 2003-03-25 2:23 ` Adam Fedor
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox