From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Snyder To: Daniel Berlin Cc: Michael Eager , Stan Shebs , gdb-patches@sources.redhat.com Subject: Re: Forgot to note Date: Wed, 11 Oct 2000 13:00:00 -0000 Message-id: <39E4C6F3.5A2F@redhat.com> References: <39E4AEE2.2213F615@apple.com> <39E4B09A.D096436F@eagercon.com> X-SW-Source: 2000-10/msg00073.html Daniel Berlin wrote: > > Michael Eager writes: > > > Stan Shebs wrote: > > > > > > Even under an optimistic dwarf2 adoption scenario (dwarf2 still > > > hasn't been standardized for one thing, although it's getting > > > close), the stabs format is going to be with us for at least another > > > five years, so you should plan your hacking so that you can live with > > > the stabs reader for that long. > > > > FYI, the current plan is to consider all of the proposals for > > changes to Dwarf 2 by the end of this year and release a version > > of the revised standard for public review early in 2001. > > > > My experience is the same as Stan's. Old formats don't disappear, > > and they certainly don't disappear because someone says that they > > should. Plan for a long End-Of-Life status. > > Then, as i said, i'm really going to need some help doing this. Hey, we all know the feeling. ;-) >From eliz@delorie.com Thu Oct 12 00:54:00 2000 From: Eli Zaretskii To: dberlin@redhat.com Cc: dj@delorie.com, meissner@cygnus.com, gdb-patches@sources.redhat.com Subject: Re: Forgot to note Date: Thu, 12 Oct 2000 00:54:00 -0000 Message-id: <200010120754.DAA07133@indy.delorie.com> References: <20001010211904.49719@cse.cygnus.com> <200010111652.MAA12141@envy.delorie.com> X-SW-Source: 2000-10/msg00074.html Content-length: 678 > > > It's arguably a *lot* simpler to change those platforms to dwarf2, > > > then to support new-abi/stabs *and* old-abi/stabs at the same time. > > > > OK, I'll let you change DJGPP's built-in crash analyzer program, which > > only understands stabs, and the mini-debuggers (edebug32, fsdb) and > > IDE (rhide), which also only understand stabs. No, they don't use > > BFD. > > Do they have the cruft necessary to properly debug C++ stabs programs? Yes. > Does C++ debugging with GDB work on djgpp Yes. > (I've never seen test results for the C++ tests)? The GDB test suite doesn't work for DJGPP, for reasons that have nothing to do with GDB or C++ support per se. >From taylor@cygnus.com Thu Oct 12 07:07:00 2000 From: David Taylor To: gdb-patches@sourceware.cygnus.com Subject: [RFA] addresses/pointers vs numbers and expression evaluation Date: Thu, 12 Oct 2000 07:07:00 -0000 Message-id: <200010121406.KAA21106@texas.cygnus.com> X-SW-Source: 2000-10/msg00075.html Content-length: 12482 The following patch concerns bugs brought to light during a port of gdb to a target with separate instruction and data. The bugs will potentially impact any port which defines POINTER_TO_ADDRESS to have any value other than the default value. There are undoubtably additional bugs still lurking in the expression evaluation code. Several places in gdb it calls parse_and_eval_address when the expression is *NOT* an address, but rather is just a number! For example, it calls parse_and_eval_address when you type: set height 24 For this processor, treating 24 as a pointer resulted in an address of 0x01000018 -- 16 meg plus 24! Similarly, it does this for the count given to the continue and step commands as well as a few other places. To fix this, I have create a new function called parse_and_eval_long and changed 17 of the calls to parse_and_eval_address. I have tested this on solaris native and on solaris x d10v (using the simulator). There were no regressions. Here's the ChangeLog entry and the patch: * parse.c (parse_and_eval_long): New function. (value.h): Declare it. * breakpoint.c (breakpoints_info, maintenance_info_breakpoints): Call parse_and_eval_long, not parse_and_eval_address. * command.c (do_setshow_command): Ditto. * infcmd.c (step_1, signal_command, continue_command): Ditto. * infrun.c (signals_info): Ditto. * stack.c (set_backtrace_limit_command, backtrace_command_1, up_silently_base, down_silently_base): Ditto. * tracepoints.c (tracepoints_info, trace_find_command, trace_find_tracepoint_command): Ditto. * valprint.c (set_radix): Ditto. * values (show_values): Ditto. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.17 diff -c -r1.17 breakpoint.c *** breakpoint.c 2000/08/30 00:58:58 1.17 --- breakpoint.c 2000/10/12 13:57:06 *************** *** 3638,3644 **** int bnum = -1; if (bnum_exp) ! bnum = parse_and_eval_address (bnum_exp); breakpoint_1 (bnum, 0); } --- 3638,3644 ---- int bnum = -1; if (bnum_exp) ! bnum = parse_and_eval_long (bnum_exp); breakpoint_1 (bnum, 0); } *************** *** 3650,3656 **** int bnum = -1; if (bnum_exp) ! bnum = parse_and_eval_address (bnum_exp); breakpoint_1 (bnum, 1); } --- 3650,3656 ---- int bnum = -1; if (bnum_exp) ! bnum = parse_and_eval_long (bnum_exp); breakpoint_1 (bnum, 1); } Index: command.c =================================================================== RCS file: /cvs/src/src/gdb/command.c,v retrieving revision 1.17 diff -c -r1.17 command.c *** command.c 2000/08/08 00:17:39 1.17 --- command.c 2000/10/12 13:57:08 *************** *** 1622,1628 **** case var_uinteger: if (arg == NULL) error_no_arg ("integer to set it to."); ! *(unsigned int *) c->var = parse_and_eval_address (arg); if (*(unsigned int *) c->var == 0) *(unsigned int *) c->var = UINT_MAX; break; --- 1622,1628 ---- case var_uinteger: if (arg == NULL) error_no_arg ("integer to set it to."); ! *(unsigned int *) c->var = parse_and_eval_long (arg); if (*(unsigned int *) c->var == 0) *(unsigned int *) c->var = UINT_MAX; break; *************** *** 1631,1637 **** unsigned int val; if (arg == NULL) error_no_arg ("integer to set it to."); ! val = parse_and_eval_address (arg); if (val == 0) *(int *) c->var = INT_MAX; else if (val >= INT_MAX) --- 1631,1637 ---- unsigned int val; if (arg == NULL) error_no_arg ("integer to set it to."); ! val = parse_and_eval_long (arg); if (val == 0) *(int *) c->var = INT_MAX; else if (val >= INT_MAX) *************** *** 1643,1649 **** case var_zinteger: if (arg == NULL) error_no_arg ("integer to set it to."); ! *(int *) c->var = parse_and_eval_address (arg); break; case var_enum: { --- 1643,1649 ---- case var_zinteger: if (arg == NULL) error_no_arg ("integer to set it to."); ! *(int *) c->var = parse_and_eval_long (arg); break; case var_enum: { Index: eval.c =================================================================== RCS file: /cvs/src/src/gdb/eval.c,v retrieving revision 1.8 diff -c -r1.8 eval.c *** eval.c 2000/09/01 23:50:17 1.8 --- eval.c 2000/10/12 13:57:09 *************** *** 103,108 **** --- 103,123 ---- return addr; } + /* Like parse_and_eval_address, but treats the value of the expression + as an integer, not an address, returns a LONGEST, not a CORE_ADDR */ + LONGEST + parse_and_eval_long (char *exp) + { + struct expression *expr = parse_expression (exp); + register LONGEST retval; + register struct cleanup *old_chain = + make_cleanup (free_current_contents, &expr); + + retval = value_as_long (evaluate_expression (expr)); + do_cleanups (old_chain); + return (retval); + } + value_ptr parse_and_eval (char *exp) { Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.11 diff -c -r1.11 infcmd.c *** infcmd.c 2000/09/02 00:07:13 1.11 --- infcmd.c 2000/10/12 13:57:11 *************** *** 381,387 **** while (num != 0) { set_ignore_count (num, ! parse_and_eval_address (proc_count_exp) - 1, from_tty); /* set_ignore_count prints a message ending with a period. So print two spaces before "Continuing.". */ --- 381,387 ---- while (num != 0) { set_ignore_count (num, ! parse_and_eval_long (proc_count_exp) - 1, from_tty); /* set_ignore_count prints a message ending with a period. So print two spaces before "Continuing.". */ *************** *** 465,471 **** async_disable_stdin (); } ! count = count_string ? parse_and_eval_address (count_string) : 1; if (!single_inst || skip_subroutines) /* leave si command alone */ { --- 465,471 ---- async_disable_stdin (); } ! count = count_string ? parse_and_eval_long (count_string) : 1; if (!single_inst || skip_subroutines) /* leave si command alone */ { *************** *** 777,783 **** if (oursig == TARGET_SIGNAL_UNKNOWN) { /* No, try numeric. */ ! int num = parse_and_eval_address (signum_exp); if (num == 0) oursig = TARGET_SIGNAL_0; --- 777,783 ---- if (oursig == TARGET_SIGNAL_UNKNOWN) { /* No, try numeric. */ ! int num = parse_and_eval_long (signum_exp); if (num == 0) oursig = TARGET_SIGNAL_0; Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.18 diff -c -r1.18 infrun.c *** infrun.c 2000/09/02 00:08:05 1.18 --- infrun.c 2000/10/12 13:57:15 *************** *** 3899,3905 **** { /* No, try numeric. */ oursig = ! target_signal_from_command (parse_and_eval_address (signum_exp)); } sig_print_info (oursig); return; --- 3899,3905 ---- { /* No, try numeric. */ oursig = ! target_signal_from_command (parse_and_eval_long (signum_exp)); } sig_print_info (oursig); return; Index: stack.c =================================================================== RCS file: /cvs/src/src/gdb/stack.c,v retrieving revision 1.7 diff -c -r1.7 stack.c *** stack.c 2000/07/30 01:48:27 1.7 --- stack.c 2000/10/12 13:57:17 *************** *** 1038,1044 **** static void set_backtrace_limit_command (char *count_exp, int from_tty) { ! int count = parse_and_eval_address (count_exp); if (count < 0) error ("Negative argument not meaningful as backtrace limit."); --- 1038,1044 ---- static void set_backtrace_limit_command (char *count_exp, int from_tty) { ! int count = parse_and_eval_long (count_exp); if (count < 0) error ("Negative argument not meaningful as backtrace limit."); *************** *** 1086,1092 **** trailing_level = 0; if (count_exp) { ! count = parse_and_eval_address (count_exp); if (count < 0) { struct frame_info *current; --- 1086,1092 ---- trailing_level = 0; if (count_exp) { ! count = parse_and_eval_long (count_exp); if (count < 0) { struct frame_info *current; *************** *** 1740,1746 **** register struct frame_info *fi; int count = 1, count1; if (count_exp) ! count = parse_and_eval_address (count_exp); count1 = count; if (target_has_stack == 0 || selected_frame == 0) --- 1740,1746 ---- register struct frame_info *fi; int count = 1, count1; if (count_exp) ! count = parse_and_eval_long (count_exp); count1 = count; if (target_has_stack == 0 || selected_frame == 0) *************** *** 1777,1783 **** register struct frame_info *frame; int count = -1, count1; if (count_exp) ! count = -parse_and_eval_address (count_exp); count1 = count; if (target_has_stack == 0 || selected_frame == 0) --- 1777,1783 ---- register struct frame_info *frame; int count = -1, count1; if (count_exp) ! count = -parse_and_eval_long (count_exp); count1 = count; if (target_has_stack == 0 || selected_frame == 0) Index: tracepoint.c =================================================================== RCS file: /cvs/src/src/gdb/tracepoint.c,v retrieving revision 1.10 diff -c -r1.10 tracepoint.c *** tracepoint.c 2000/09/01 00:12:10 1.10 --- tracepoint.c 2000/10/12 13:57:19 *************** *** 465,471 **** int tpnum = -1; if (tpnum_exp) ! tpnum = parse_and_eval_address (tpnum_exp); ALL_TRACEPOINTS (t) if (tpnum == -1 || tpnum == t->number) --- 465,471 ---- int tpnum = -1; if (tpnum_exp) ! tpnum = parse_and_eval_long (tpnum_exp); ALL_TRACEPOINTS (t) if (tpnum == -1 || tpnum == t->number) *************** *** 1986,1992 **** frameno = traceframe_number - 1; } else ! frameno = parse_and_eval_address (args); if (frameno < -1) error ("invalid input (%d is less than zero)", frameno); --- 1986,1992 ---- frameno = traceframe_number - 1; } else ! frameno = parse_and_eval_long (args); if (frameno < -1) error ("invalid input (%d is less than zero)", frameno); Index: valprint.c =================================================================== RCS file: /cvs/src/src/gdb/valprint.c,v retrieving revision 1.6 diff -c -r1.6 valprint.c *** valprint.c 2000/07/30 01:48:27 1.6 --- valprint.c 2000/10/12 13:57:20 *************** *** 1416,1422 **** { unsigned radix; ! radix = (arg == NULL) ? 10 : parse_and_eval_address (arg); set_output_radix_1 (0, radix); set_input_radix_1 (0, radix); if (from_tty) --- 1416,1422 ---- { unsigned radix; ! radix = (arg == NULL) ? 10 : parse_and_eval_long (arg); set_output_radix_1 (0, radix); set_input_radix_1 (0, radix); if (from_tty) Index: value.h =================================================================== RCS file: /cvs/src/src/gdb/value.h,v retrieving revision 1.10 diff -c -r1.10 value.h *** value.h 2000/09/04 08:29:25 1.10 --- value.h 2000/10/12 13:57:21 *************** *** 410,415 **** --- 410,417 ---- extern CORE_ADDR parse_and_eval_address_1 (char **expptr); + extern LONGEST parse_and_eval_long (char *exp); + extern value_ptr access_value_history (int num); extern value_ptr value_of_internalvar (struct internalvar *var); Index: values.c =================================================================== RCS file: /cvs/src/src/gdb/values.c,v retrieving revision 1.9 diff -c -r1.9 values.c *** values.c 2000/07/30 01:48:27 1.9 --- values.c 2000/10/12 13:57:22 *************** *** 351,357 **** /* "info history +" should print from the stored position. "info history " should print around value number . */ if (num_exp[0] != '+' || num_exp[1] != '\0') ! num = parse_and_eval_address (num_exp) - 5; } else { --- 351,357 ---- /* "info history +" should print from the stored position. "info history " should print around value number . */ if (num_exp[0] != '+' || num_exp[1] != '\0') ! num = parse_and_eval_long (num_exp) - 5; } else { >From ezannoni@cygnus.com Thu Oct 12 09:53:00 2000 From: Elena Zannoni To: Daniel Berlin Cc: gdb-patches@sources.redhat.com, Elena Zannoni Subject: Re: [RFA]: Remove linear search for C++ Date: Thu, 12 Oct 2000 09:53:00 -0000 Message-id: <14821.60528.681193.751884@kwikemart.cygnus.com> References: X-SW-Source: 2000-10/msg00076.html Content-length: 15780 OK, I committed the following: 2000-10-12 Elena Zannoni From Daniel Berlin : * symtab.c (lookup_symbol_aux): New function. Renamed from lookup_symbol. Move code to do demangling/case sensitivity to lookup_symbol(). (lookup_symbol): Now wrapper for lookup_symbol_aux, so we can perform case sensitivity/demangling without leaking memory. Move code to do demangling/case sensitivity from old_lookup_symbol to here. (lookup_partial_symbol): Use SYMBOL_SOURCE_NAME instead of SYMBOL_NAME. (lookup_block_symbol): Use SYMBOL_SOURCE_NAME instead of SYMBOL_NAME. Don't do linear search in case of C++. * symfile.c (compare_symbols): Use SYMBOL_SOURCE_NAME instead of SYMBOL_NAME. (compare_psymbols): Same here. Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.18 diff -c -u -p -r1.18 symfile.c --- symfile.c 2000/09/02 00:09:06 1.18 +++ symfile.c 2000/10/12 16:37:15 @@ -212,8 +212,7 @@ compare_symbols (const PTR s1p, const PT s1 = (struct symbol **) s1p; s2 = (struct symbol **) s2p; - - return (STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2))); + return (STRCMP (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2))); } /* @@ -241,8 +240,14 @@ compare_symbols (const PTR s1p, const PT static int compare_psymbols (const PTR s1p, const PTR s2p) { - register char *st1 = SYMBOL_NAME (*(struct partial_symbol **) s1p); - register char *st2 = SYMBOL_NAME (*(struct partial_symbol **) s2p); + register struct partial_symbol **s1, **s2; + register char *st1, *st2; + + s1 = (struct partial_symbol **) s1p; + s2 = (struct partial_symbol **) s2p; + st1 = SYMBOL_SOURCE_NAME (*s1); + st2 = SYMBOL_SOURCE_NAME (*s2); + if ((st1[0] - st2[0]) || !st1[0]) { Index: symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.15 diff -c -u -p -r1.15 symtab.c --- symtab.c 2000/09/04 08:29:25 1.15 +++ symtab.c 2000/10/12 16:37:16 @@ -83,6 +83,13 @@ static struct partial_symbol *lookup_par static struct symtab *lookup_symtab_1 (char *); +static struct symbol *lookup_symbol_aux (const char *name, const + struct block *block, const + namespace_enum namespace, int + *is_a_field_of_this, struct + symtab **symtab); + + static void cplusplus_hint (char *); static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr); @@ -572,17 +579,14 @@ fixup_psymbol_section (struct partial_sy can probably assume it will never hit the C++ code). */ struct symbol * -lookup_symbol (const char *name, register const struct block *block, +lookup_symbol (const char *name, const struct block *block, const namespace_enum namespace, int *is_a_field_of_this, struct symtab **symtab) { - register struct symbol *sym; - register struct symtab *s = NULL; - register struct partial_symtab *ps; - struct blockvector *bv; - register struct objfile *objfile = NULL; - register struct block *b; - register struct minimal_symbol *msymbol; + char *modified_name = NULL; + char *modified_name2 = NULL; + int needtofreename = 0; + struct symbol *returnval; if (case_sensitivity == case_sensitive_off) { @@ -594,9 +598,45 @@ lookup_symbol (const char *name, registe for (i= 0; i < len; i++) copy[i] = tolower (name[i]); copy[len] = 0; - name = copy; + modified_name = copy; } + else + modified_name = (char *) name; + + /* If we are using C++ language, demangle the name before doing a lookup, so + we can always binary search. */ + if (current_language->la_language == language_cplus) + { + modified_name2 = cplus_demangle (modified_name, DMGL_ANSI | DMGL_PARAMS); + if (modified_name2) + { + modified_name = modified_name2; + needtofreename = 1; + } + } + + returnval = lookup_symbol_aux (modified_name, block, namespace, + is_a_field_of_this, symtab); + if (needtofreename) + free (modified_name2); + + return returnval; +} + +static struct symbol * +lookup_symbol_aux (const char *name, const struct block *block, + const namespace_enum namespace, int *is_a_field_of_this, + struct symtab **symtab) +{ + register struct symbol *sym; + register struct symtab *s = NULL; + register struct partial_symtab *ps; + register struct blockvector *bv; + register struct objfile *objfile = NULL; + register struct block *b; + register struct minimal_symbol *msymbol; + /* Search specified block and its superiors. */ while (block != 0) @@ -987,7 +1027,7 @@ lookup_partial_symbol (struct partial_sy { do_linear_search = 1; } - if (STRCMP (SYMBOL_NAME (*center), name) >= 0) + if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0) { top = center; } @@ -1190,9 +1230,7 @@ lookup_block_symbol (register const stru { /* Reset the linear search flag so if the binary search fails, we won't do the linear search once unless we find some reason to - do so, such as finding a C++ symbol during the binary search. - Note that for C++ modules, ALL the symbols in a block should - end up marked as C++ symbols. */ + do so */ do_linear_search = 0; top = BLOCK_NSYMS (block); @@ -1210,22 +1248,19 @@ lookup_block_symbol (register const stru } inc = (inc >> 1) + bot; sym = BLOCK_SYM (block, inc); - if (!do_linear_search - && (SYMBOL_LANGUAGE (sym) == language_cplus - || SYMBOL_LANGUAGE (sym) == language_java - )) + if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java)) { do_linear_search = 1; } - if (SYMBOL_NAME (sym)[0] < name[0]) + if (SYMBOL_SOURCE_NAME (sym)[0] < name[0]) { bot = inc; } - else if (SYMBOL_NAME (sym)[0] > name[0]) + else if (SYMBOL_SOURCE_NAME (sym)[0] > name[0]) { top = inc; } - else if (STRCMP (SYMBOL_NAME (sym), name) < 0) + else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0) { bot = inc; } @@ -1247,19 +1282,8 @@ lookup_block_symbol (register const stru while (bot < top) { sym = BLOCK_SYM (block, bot); - inc = SYMBOL_NAME (sym)[0] - name[0]; - if (inc == 0) - { - inc = STRCMP (SYMBOL_NAME (sym), name); - } - if (inc == 0 && SYMBOL_NAMESPACE (sym) == namespace) - { - return (sym); - } - if (inc > 0) - { - break; - } + if (SYMBOL_MATCHES_NAME (sym, name)) + return sym; bot++; } } Elena Daniel Berlin writes: > > Once again, I don't have a changelog handy to paste from. > It hasn't changed anyway, unless i'm misremembering. > I have an exam tomorrow, so it's quite possible i *am* misremembering, > and someone did request changelog modifications to the previous patch. > > > Elena, this includes the suggested modifications to lookup_symbol, so > that needstofreename gets initialized to 0, reducing the amount of > code. I have an odd feeling I missed something when changing that > code, so i'd appreciate it if you'd double check it for me. > It's probably just my stress level, but .... > > Index: symfile.c > =================================================================== > RCS file: /cvs/src/src/gdb/symfile.c,v > retrieving revision 1.18 > diff -c -3 -p -r1.18 symfile.c > *** symfile.c 2000/09/02 00:09:06 1.18 > --- symfile.c 2000/10/11 03:55:07 > *************** compare_symbols (const PTR s1p, const PT > *** 212,219 **** > > s1 = (struct symbol **) s1p; > s2 = (struct symbol **) s2p; > ! > ! return (STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2))); > } > > /* > --- 212,218 ---- > > s1 = (struct symbol **) s1p; > s2 = (struct symbol **) s2p; > ! return (STRCMP (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2))); > } > > /* > *************** compare_symbols (const PTR s1p, const PT > *** 241,248 **** > static int > compare_psymbols (const PTR s1p, const PTR s2p) > { > ! register char *st1 = SYMBOL_NAME (*(struct partial_symbol **) s1p); > ! register char *st2 = SYMBOL_NAME (*(struct partial_symbol **) s2p); > > if ((st1[0] - st2[0]) || !st1[0]) > { > --- 240,253 ---- > static int > compare_psymbols (const PTR s1p, const PTR s2p) > { > ! register struct partial_symbol **s1, **s2; > ! register char *st1, *st2; > ! > ! s1 = (struct partial_symbol **) s1p; > ! s2 = (struct partial_symbol **) s2p; > ! st1 = SYMBOL_SOURCE_NAME (*s1); > ! st2 = SYMBOL_SOURCE_NAME (*s2); > ! > > if ((st1[0] - st2[0]) || !st1[0]) > { > Index: symtab.c > =================================================================== > RCS file: /cvs/src/src/gdb/symtab.c,v > retrieving revision 1.15 > diff -c -3 -p -r1.15 symtab.c > *** symtab.c 2000/09/04 08:29:25 1.15 > --- symtab.c 2000/10/11 03:55:08 > *************** static struct partial_symbol *lookup_par > *** 83,88 **** > --- 83,95 ---- > > static struct symtab *lookup_symtab_1 (char *); > > + static struct symbol *lookup_symbol_aux (const char *name, const > + struct block *block, const > + namespace_enum namespace, int > + *is_a_field_of_this, struct > + symtab **symtab); > + > + > static void cplusplus_hint (char *); > > static struct symbol *find_active_alias (struct symbol *sym, CORE_ADDR addr); > *************** fixup_psymbol_section (struct partial_sy > *** 572,588 **** > can probably assume it will never hit the C++ code). */ > > struct symbol * > ! lookup_symbol (const char *name, register const struct block *block, > const namespace_enum namespace, int *is_a_field_of_this, > struct symtab **symtab) > { > ! register struct symbol *sym; > ! register struct symtab *s = NULL; > ! register struct partial_symtab *ps; > ! struct blockvector *bv; > ! register struct objfile *objfile = NULL; > ! register struct block *b; > ! register struct minimal_symbol *msymbol; > > if (case_sensitivity == case_sensitive_off) > { > --- 565,578 ---- > can probably assume it will never hit the C++ code). */ > > struct symbol * > ! lookup_symbol (const char *name, const struct block *block, > const namespace_enum namespace, int *is_a_field_of_this, > struct symtab **symtab) > { > ! char *modified_name = NULL; > ! char *modified_name2 = NULL; > ! int needtofreename=0; > ! struct symbol *returnval; > > if (case_sensitivity == case_sensitive_off) > { > *************** lookup_symbol (const char *name, registe > *** 594,601 **** > for (i= 0; i < len; i++) > copy[i] = tolower (name[i]); > copy[len] = 0; > ! name = copy; > } > > /* Search specified block and its superiors. */ > > --- 584,630 ---- > for (i= 0; i < len; i++) > copy[i] = tolower (name[i]); > copy[len] = 0; > ! modified_name = copy; > } > + else > + { > + modified_name = (char *)name; > + } > + modified_name2 = modified_name; > + /* If we are using C++ language, demangle the name before doing a lookup, so > + we can always binary search. */ > + if (current_language->la_language == language_cplus) > + { > + modified_name2 = cplus_demangle (modified_name, DMGL_ANSI | > + DMGL_PARAMS); > + needtofreename=1; > + } > + > + if (!modified_name2) > + { > + modified_name2 = modified_name; > + } > + returnval = lookup_symbol_aux (modified_name2, block, namespace, > + is_a_field_of_this, symtab); > + if (needtofreename) > + free(modified_name2); > + > + return returnval; > + } > + > + static struct symbol * > + lookup_symbol_aux (const char *name, const struct block *block, > + const namespace_enum namespace, int *is_a_field_of_this, > + struct symtab **symtab) > + { > + register struct symbol *sym; > + register struct symtab *s = NULL; > + register struct partial_symtab *ps; > + register struct blockvector *bv; > + register struct objfile *objfile = NULL; > + register struct block *b; > + register struct minimal_symbol *msymbol; > + > > /* Search specified block and its superiors. */ > > *************** lookup_partial_symbol (struct partial_sy > *** 987,993 **** > { > do_linear_search = 1; > } > ! if (STRCMP (SYMBOL_NAME (*center), name) >= 0) > { > top = center; > } > --- 1017,1023 ---- > { > do_linear_search = 1; > } > ! if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0) > { > top = center; > } > *************** lookup_block_symbol (register const stru > *** 1190,1198 **** > { > /* Reset the linear search flag so if the binary search fails, we > won't do the linear search once unless we find some reason to > ! do so, such as finding a C++ symbol during the binary search. > ! Note that for C++ modules, ALL the symbols in a block should > ! end up marked as C++ symbols. */ > > do_linear_search = 0; > top = BLOCK_NSYMS (block); > --- 1220,1226 ---- > { > /* Reset the linear search flag so if the binary search fails, we > won't do the linear search once unless we find some reason to > ! do so */ > > do_linear_search = 0; > top = BLOCK_NSYMS (block); > *************** lookup_block_symbol (register const stru > *** 1210,1231 **** > } > inc = (inc >> 1) + bot; > sym = BLOCK_SYM (block, inc); > ! if (!do_linear_search > ! && (SYMBOL_LANGUAGE (sym) == language_cplus > ! || SYMBOL_LANGUAGE (sym) == language_java > ! )) > { > do_linear_search = 1; > } > ! if (SYMBOL_NAME (sym)[0] < name[0]) > { > bot = inc; > } > ! else if (SYMBOL_NAME (sym)[0] > name[0]) > { > top = inc; > } > ! else if (STRCMP (SYMBOL_NAME (sym), name) < 0) > { > bot = inc; > } > --- 1238,1256 ---- > } > inc = (inc >> 1) + bot; > sym = BLOCK_SYM (block, inc); > ! if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java)) > { > do_linear_search = 1; > } > ! if (SYMBOL_SOURCE_NAME (sym)[0] < name[0]) > { > bot = inc; > } > ! else if (SYMBOL_SOURCE_NAME (sym)[0] > name[0]) > { > top = inc; > } > ! else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0) > { > bot = inc; > } > *************** lookup_block_symbol (register const stru > *** 1247,1265 **** > while (bot < top) > { > sym = BLOCK_SYM (block, bot); > ! inc = SYMBOL_NAME (sym)[0] - name[0]; > ! if (inc == 0) > ! { > ! inc = STRCMP (SYMBOL_NAME (sym), name); > ! } > ! if (inc == 0 && SYMBOL_NAMESPACE (sym) == namespace) > ! { > ! return (sym); > ! } > ! if (inc > 0) > ! { > ! break; > ! } > bot++; > } > } > --- 1272,1279 ---- > while (bot < top) > { > sym = BLOCK_SYM (block, bot); > ! if (SYMBOL_MATCHES_NAME (sym, name)) > ! return sym; > bot++; > } > } > > >From ezannoni@cygnus.com Thu Oct 12 12:35:00 2000 From: Elena Zannoni To: Daniel Berlin Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH] Mangling, take 2 Date: Thu, 12 Oct 2000 12:35:00 -0000 Message-id: <14822.4725.826556.108136@kwikemart.cygnus.com> References: X-SW-Source: 2000-10/msg00077.html Content-length: 4857 I committed this one as well. With a ChangeLog entry! Elena Daniel Berlin writes: > This should be correct. > I don't have the changelogs handy to paste, I finally just checked out 5 > seperate copies of the gdb tree so I could do rediffs there. > > > Any problems with this one that I missed? > Index: symtab.c > =================================================================== > RCS file: /cvs/src/src/gdb/symtab.c,v > retrieving revision 1.15 > diff -c -3 -p -r1.15 symtab.c > *** symtab.c 2000/09/04 08:29:25 1.15 > --- symtab.c 2000/10/11 03:50:53 > *************** gdb_mangle_name (struct type *type, int > *** 296,301 **** > --- 303,311 ---- > char buf[20]; > int len = (newname == NULL ? 0 : strlen (newname)); > > + if (OPNAME_PREFIX_P (field_name)) > + return xstrdup(physname); > + > is_full_physname_constructor = > ((physname[0] == '_' && physname[1] == '_' && > (isdigit (physname[2]) || physname[2] == 'Q' || physname[2] == 't')) > *************** gdb_mangle_name (struct type *type, int > *** 331,357 **** > sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len); > } > mangled_name_len = ((is_constructor ? 0 : strlen (field_name)) > ! + strlen (buf) + len > ! + strlen (physname) > ! + 1); > > - /* Only needed for GNU-mangled names. ANSI-mangled names > - work with the normal mechanisms. */ > - if (OPNAME_PREFIX_P (field_name)) > { > - const char *opname = cplus_mangle_opname (field_name + 3, 0); > - if (opname == NULL) > - error ("No mangling for \"%s\"", field_name); > - mangled_name_len += strlen (opname); > mangled_name = (char *) xmalloc (mangled_name_len); > - > - strncpy (mangled_name, field_name, 3); > - mangled_name[3] = '\0'; > - strcat (mangled_name, opname); > - } > - else > - { > - mangled_name = (char *) xmalloc (mangled_name_len); > if (is_constructor) > mangled_name[0] = '\0'; > else > --- 341,350 ---- > sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len); > } > mangled_name_len = ((is_constructor ? 0 : strlen (field_name)) > ! + strlen (buf) + len + strlen (physname) + 1); > > { > mangled_name = (char *) xmalloc (mangled_name_len); > if (is_constructor) > mangled_name[0] = '\0'; > else > =================================================================== > RCS file: /cvs/src/src/gdb/symtab.h,v > retrieving revision 1.13 > diff -c -3 -p -r1.13 symtab.h > *** symtab.h 2000/08/07 15:02:48 1.13 > --- symtab.h 2000/10/11 03:50:53 > *************** extern CORE_ADDR symbol_overlayed_addres > *** 170,175 **** > --- 170,177 ---- > #define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \ > do { \ > char *demangled = NULL; \ > + if (SYMBOL_LANGUAGE (symbol) == language_unknown) \ > + SYMBOL_LANGUAGE(symbol) = language_auto; \ > if (SYMBOL_LANGUAGE (symbol) == language_cplus \ > || SYMBOL_LANGUAGE (symbol) == language_auto) \ > { \ > *************** extern CORE_ADDR symbol_overlayed_addres > *** 222,231 **** > SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; \ > } \ > } \ > - if (SYMBOL_LANGUAGE (symbol) == language_auto) \ > - { \ > - SYMBOL_LANGUAGE (symbol) = language_unknown; \ > - } \ > } while (0) > > /* Macro that returns the demangled name for a symbol based on the language > --- 224,229 ---- > *************** struct partial_symtab > *** 1047,1059 **** > #define VTBL_FNADDR_OFFSET 2 > > /* Macro that yields non-zero value iff NAME is the prefix for C++ operator > ! names. If you leave out the parenthesis here you will lose! > ! Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the > ! symbol-file and the names in gdb's symbol table. > ! Note that this macro is g++ specific (FIXME). */ > ! > #define OPNAME_PREFIX_P(NAME) \ > ! ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2])) > > /* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl > names. Note that this macro is g++ specific (FIXME). > --- 1045,1053 ---- > #define VTBL_FNADDR_OFFSET 2 > > /* Macro that yields non-zero value iff NAME is the prefix for C++ operator > ! names. If you leave out the parenthesis here you will lose! */ > #define OPNAME_PREFIX_P(NAME) \ > ! (!strncmp(NAME,"operator",8)) > > /* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl > names. Note that this macro is g++ specific (FIXME). > > > >From kevinb@cygnus.com Thu Oct 12 15:02:00 2000 From: Kevin Buettner To: Kevin Buettner , gdb-patches@sourceware.cygnus.com Subject: Re: [PATCH RFC] Protoize remote-rdp.c, remote-sds.c, remote-sim.c Date: Thu, 12 Oct 2000 15:02:00 -0000 Message-id: <1001012220154.ZM6317@ocotillo.lan> References: <1001010054414.ZM1389@ocotillo.lan> X-SW-Source: 2000-10/msg00078.html Content-length: 223 On Oct 9, 10:44pm, Kevin Buettner wrote: > * remote-rdp.c (remote_rdp_xfer_inferior_memory): Protoize. > * remote-sds.c (sds_xfer_memory): Protoize. > * remote-sim.c (gdbsim_xfer_inferior_memory): Protoize. Committed. >From kevinb@cygnus.com Thu Oct 12 15:05:00 2000 From: Kevin Buettner To: gdb-patches@sourceware.cygnus.com Subject: [PATCH RFC] Protoize remote-st.c, remote-utils.c, remote-vx.c Date: Thu, 12 Oct 2000 15:05:00 -0000 Message-id: <1001012220502.ZM6323@ocotillo.lan> X-SW-Source: 2000-10/msg00079.html Content-length: 3446 More protoization... Again, a FIXME comment was removed for reasons previously cited. * remote-st.c (st2000_xfer_inferior_memory): Protoize. * remote-utils.c (gr_multi_scan): Protoize. * remote-vx.c (vx_xfer_memory, net_get_symbols): Protoize. Index: remote-st.c =================================================================== RCS file: /cvs/src/src/gdb/remote-st.c,v retrieving revision 1.4 diff -u -r1.4 remote-st.c --- remote-st.c 2000/09/01 00:12:10 1.4 +++ remote-st.c 2000/10/12 21:48:44 @@ -548,14 +548,15 @@ return len; } -/* FIXME-someday! Merge these two. */ +/* Transfer LEN bytes between GDB address MYADDR and target address + MEMADDR. If WRITE is non-zero, transfer them to the target, + otherwise transfer them from the target. TARGET is unused. + + Returns the number of bytes transferred. */ + static int -st2000_xfer_inferior_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ +st2000_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, + int write, struct target_ops *target) { if (write) return st2000_write_inferior_memory (memaddr, myaddr, len); Index: remote-utils.c =================================================================== RCS file: /cvs/src/src/gdb/remote-utils.c,v retrieving revision 1.7 diff -u -r1.7 remote-utils.c --- remote-utils.c 2000/09/01 00:12:10 1.7 +++ remote-utils.c 2000/10/12 21:48:44 @@ -502,9 +502,7 @@ pass non-matching data on. */ int -gr_multi_scan (list, passthrough) - char *list[]; - int passthrough; +gr_multi_scan (char *list[], int passthrough) { char *swallowed = NULL; /* holding area */ char *swallowed_p = swallowed; /* Current position in swallowed. */ Index: remote-vx.c =================================================================== RCS file: /cvs/src/src/gdb/remote-vx.c,v retrieving revision 1.7 diff -u -r1.7 remote-vx.c --- remote-vx.c 2000/08/27 22:30:29 1.7 +++ remote-vx.c 2000/10/12 21:48:46 @@ -468,19 +468,15 @@ /* Copy LEN bytes to or from remote inferior's memory starting at MEMADDR to debugger memory starting at MYADDR. WRITE is true if writing to the - inferior. + inferior. TARGET is unused. Result is the number of bytes written or read (zero if error). The protocol allows us to return a negative count, indicating that we can't handle the current address but can handle one N bytes further, but vxworks doesn't give us that information. */ static int -vx_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ +vx_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, + struct target_ops *target) { int status; Rptrace ptrace_in; @@ -800,14 +796,14 @@ return (status == RPC_SUCCESS) ? 0 : -1; } -/* Fetch a list of loaded object modules from the VxWorks target. +/* Fetch a list of loaded object modules from the VxWorks target + and store in PLOADTABLE. Returns -1 if rpc failed, 0 otherwise There's no way to check if the returned loadTable is correct. VxWorks doesn't check it. */ static int -net_get_symbols (pLoadTable) - ldtabl *pLoadTable; /* return pointer to ldtabl here */ +net_get_symbols (ldtabl *pLoadTable) { enum clnt_stat status;