The world's most popular open source database
#include <stdio.h>#include <ctype.h>#include <bfd.h>#include "bucomm.h"#include <libiberty.h>#include "demangle.h"#include "debug.h"#include "budbg.h"#include "aout/aout64.h"#include "aout/stab_gnu.h"Include dependency graph for stabs.c:

Go to the source code of this file.
Classes | |
| struct | stab_handle |
| struct | stab_pending_var |
| struct | stab_types |
| struct | stab_tag |
| struct | bincl_file |
| struct | stab_demangle_typestring |
| struct | stab_demangle_info |
Defines | |
| #define | BYTES_IN_WORD 4 |
| #define | XCOFF_TYPE_COUNT 34 |
| #define | STAB_TYPES_SLOTS (16) |
| #define | LLLOW "01000000000000000000000;" |
| #define | LLHIGH "0777777777777777777777;" |
| #define | ULLHIGH "01777777777777777777777;" |
Functions | |
| static char *savestring | PARAMS ((const char *, int)) |
| static bfd_vma parse_number | PARAMS ((const char **, boolean *)) |
| static void bad_stab | PARAMS ((const char *)) |
| static void warn_stab | PARAMS ((const char *, const char *)) |
| static boolean parse_stab_string | PARAMS ((PTR, struct stab_handle *, int, int, bfd_vma, const char *)) |
| static debug_type parse_stab_type | PARAMS ((PTR, struct stab_handle *, const char *, const char **, debug_type **)) |
| static boolean parse_stab_type_number | PARAMS ((const char **, int *)) |
| static debug_type parse_stab_range_type | PARAMS ((PTR, struct stab_handle *, const char *, const char **, const int *)) |
| static debug_type parse_stab_sun_builtin_type | PARAMS ((PTR, const char **)) |
| static debug_type parse_stab_struct_type | PARAMS ((PTR, struct stab_handle *, const char *, const char **, boolean, const int *)) |
| static boolean parse_stab_baseclasses | PARAMS ((PTR, struct stab_handle *, const char **, debug_baseclass **)) |
| static boolean parse_stab_struct_fields | PARAMS ((PTR, struct stab_handle *, const char **, debug_field **, boolean *)) |
| static boolean parse_stab_cpp_abbrev | PARAMS ((PTR, struct stab_handle *, const char **, debug_field *)) |
| static boolean parse_stab_one_struct_field | PARAMS ((PTR, struct stab_handle *, const char **, const char *, debug_field *, boolean *)) |
| static boolean parse_stab_members | PARAMS ((PTR, struct stab_handle *, const char *, const char **, const int *, debug_method **)) |
| static debug_type parse_stab_argtypes | PARAMS ((PTR, struct stab_handle *, debug_type, const char *, const char *, debug_type, const char *, boolean, boolean, const char **)) |
| static boolean parse_stab_tilde_field | PARAMS ((PTR, struct stab_handle *, const char **, const int *, debug_type *, boolean *)) |
| static debug_type parse_stab_array_type | PARAMS ((PTR, struct stab_handle *, const char **, boolean)) |
| static void push_bincl | PARAMS ((struct stab_handle *, const char *, bfd_vma)) |
| static const char *pop_bincl | PARAMS ((struct stab_handle *)) |
| static boolean stab_record_variable | PARAMS ((PTR, struct stab_handle *, const char *, debug_type, enum debug_var_kind, bfd_vma)) |
| static boolean stab_emit_pending_vars | PARAMS ((PTR, struct stab_handle *)) |
| static debug_type *stab_find_slot | PARAMS ((struct stab_handle *, const int *)) |
| static debug_type stab_find_type | PARAMS ((PTR, struct stab_handle *, const int *)) |
| static boolean stab_record_type | PARAMS ((PTR, struct stab_handle *, const int *, debug_type)) |
| static debug_type stab_xcoff_builtin_type | PARAMS ((PTR, struct stab_handle *, int)) |
| static debug_type stab_find_tagged_type | PARAMS ((PTR, struct stab_handle *, const char *, int, enum debug_type_kind)) |
| static debug_type *stab_demangle_argtypes | PARAMS ((PTR, struct stab_handle *, const char *, boolean *)) |
| static char * | savestring (char *start, int len) const |
| static bfd_vma | parse_number (char **pp, boolean *poverflow) const |
| static void | bad_stab (char *p) const |
| static void | warn_stab (char *p, const char *err) const |
| PTR | start_stab (PTR dhandle, bfd *abfd, boolean sections, asymbol **syms, long symcount) |
| boolean | finish_stab (PTR dhandle, PTR handle) |
| boolean | parse_stab (PTR dhandle, PTR handle, int type, int desc, bfd_vma value, const char *string) |
| static boolean | parse_stab_string (PTR dhandle, struct stab_handle *info, int stabtype, int desc, bfd_vma value, const char *string) |
| static debug_type | parse_stab_type (PTR dhandle, struct stab_handle *info, const char *typename, const char **pp, debug_type **slotp) |
| static boolean | parse_stab_type_number (char **pp, int *typenums) const |
| static debug_type | parse_stab_range_type (PTR dhandle, struct stab_handle *info, const char *typename, const char **pp, const int *typenums) |
| static debug_type | parse_stab_sun_builtin_type (PTR dhandle, const char **pp) |
| static debug_type | parse_stab_sun_floating_type (PTR dhandle, const char **pp) |
| static debug_type | parse_stab_enum_type (PTR dhandle, const char **pp) |
| static debug_type | parse_stab_struct_type (PTR dhandle, struct stab_handle *info, const char *tagname, const char **pp, boolean structp, const int *typenums) |
| static boolean | parse_stab_baseclasses (PTR dhandle, struct stab_handle *info, const char **pp, debug_baseclass **retp) |
| static boolean | parse_stab_struct_fields (PTR dhandle, struct stab_handle *info, const char **pp, debug_field **retp, boolean *staticsp) |
| static boolean | parse_stab_cpp_abbrev (PTR dhandle, struct stab_handle *info, const char **pp, debug_field *retp) |
| static boolean | parse_stab_one_struct_field (PTR dhandle, struct stab_handle *info, const char **pp, const char *p, debug_field *retp, boolean *staticsp) |
| static boolean | parse_stab_members (PTR dhandle, struct stab_handle *info, const char *tagname, const char **pp, const int *typenums, debug_method **retp) |
| static debug_type | parse_stab_argtypes (PTR dhandle, struct stab_handle *info, debug_type class_type, const char *fieldname, const char *tagname, debug_type return_type, const char *argtypes, boolean constp, boolean volatilep, const char **pphysname) |
| static boolean | parse_stab_tilde_field (PTR dhandle, struct stab_handle *info, const char **pp, const int *typenums, debug_type *retvptrbase, boolean *retownvptr) |
| static debug_type | parse_stab_array_type (PTR dhandle, struct stab_handle *info, const char **pp, boolean stringp) |
| static void | push_bincl (struct stab_handle *info, const char *name, bfd_vma hash) |
| static const char * | pop_bincl (struct stab_handle *info) |
| static boolean | find_excl (struct stab_handle *info, const char *name, bfd_vma hash) |
| static boolean | stab_record_variable (PTR dhandle, struct stab_handle *info, const char *name, debug_type type, enum debug_var_kind kind, bfd_vma val) |
| static boolean | stab_emit_pending_vars (PTR dhandle, struct stab_handle *info) |
| static debug_type * | stab_find_slot (struct stab_handle *info, const int *typenums) |
| static debug_type | stab_find_type (PTR dhandle, struct stab_handle *info, const int *typenums) |
| static boolean | stab_record_type (PTR dhandle, struct stab_handle *info, const int *typenums, debug_type type) |
| static debug_type | stab_xcoff_builtin_type (PTR dhandle, struct stab_handle *info, int typenum) |
| static debug_type | stab_find_tagged_type (PTR dhandle, struct stab_handle *info, const char *p, int len, enum debug_type_kind kind) |
| static unsigned int stab_demangle_count | PARAMS ((const char **)) |
| static boolean stab_demangle_get_count | PARAMS ((const char **, unsigned int *)) |
| static boolean stab_demangle_prefix | PARAMS ((struct stab_demangle_info *, const char **)) |
| static boolean stab_demangle_function_name | PARAMS ((struct stab_demangle_info *, const char **, const char *)) |
| static boolean stab_demangle_qualified | PARAMS ((struct stab_demangle_info *, const char **, debug_type *)) |
| static boolean stab_demangle_class | PARAMS ((struct stab_demangle_info *, const char **, const char **)) |
| static boolean stab_demangle_args | PARAMS ((struct stab_demangle_info *, const char **, debug_type **, boolean *)) |
| static boolean stab_demangle_arg | PARAMS ((struct stab_demangle_info *, const char **, debug_type **, unsigned int *, unsigned int *)) |
| static boolean stab_demangle_remember_type | PARAMS ((struct stab_demangle_info *, const char *, int)) |
| static void | stab_bad_demangle (char *s) const |
| static unsigned int | stab_demangle_count (char **pp) const |
| static boolean | stab_demangle_get_count (char **pp, unsigned int *pi) const |
| static debug_type * | stab_demangle_argtypes (PTR dhandle, struct stab_handle *info, const char *physname, boolean *pvarargs) |
| static boolean | stab_demangle_prefix (struct stab_demangle_info *minfo, const char **pp) |
| static boolean | stab_demangle_function_name (struct stab_demangle_info *minfo, const char **pp, const char *scan) |
| static boolean | stab_demangle_signature (struct stab_demangle_info *minfo, const char **pp) |
| static boolean | stab_demangle_qualified (struct stab_demangle_info *minfo, const char **pp, debug_type *ptype) |
| static boolean | stab_demangle_template (struct stab_demangle_info *minfo, const char **pp) |
| static boolean | stab_demangle_class (struct stab_demangle_info *minfo, const char **pp, const char **pstart) |
| static boolean | stab_demangle_args (struct stab_demangle_info *minfo, const char **pp, debug_type **pargs, boolean *pvarargs) |
| static boolean | stab_demangle_arg (struct stab_demangle_info *minfo, const char **pp, debug_type **pargs, unsigned int *pcount, unsigned int *palloc) |
| static boolean | stab_demangle_type (struct stab_demangle_info *minfo, const char **pp, debug_type *ptype) |
| static boolean | stab_demangle_fund_type (struct stab_demangle_info *minfo, const char **pp, debug_type *ptype) |
| static boolean | stab_demangle_remember_type (struct stab_demangle_info *minfo, const char *p, int len) |
| #define LLHIGH "0777777777777777777777;" |
Referenced by parse_stab_range_type().
| #define LLLOW "01000000000000000000000;" |
Referenced by parse_stab_range_type().
| #define STAB_TYPES_SLOTS (16) |
| #define ULLHIGH "01777777777777777777777;" |
Referenced by parse_stab_range_type().
| #define XCOFF_TYPE_COUNT 34 |
| static void bad_stab | ( | char * | p | ) | const [static] |
Definition at line 339 of file stabs.c.
Referenced by parse_stab_array_type(), parse_stab_baseclasses(), parse_stab_cpp_abbrev(), parse_stab_enum_type(), parse_stab_members(), parse_stab_one_struct_field(), parse_stab_range_type(), parse_stab_string(), parse_stab_struct_fields(), parse_stab_sun_builtin_type(), parse_stab_sun_floating_type(), parse_stab_tilde_field(), parse_stab_type(), and parse_stab_type_number().
00341 { 00342 fprintf (stderr, "Bad stab: %s\n", p); 00343 }
Here is the caller graph for this function:

| static boolean find_excl | ( | struct stab_handle * | info, | |
| const char * | name, | |||
| bfd_vma | hash | |||
| ) | [static] |
Definition at line 3217 of file stabs.c.
References bincl_file::file_types, bincl_file::hash, bincl_file::name, bincl_file::next, NULL, strcmp(), warn_stab(), and xrealloc().
Referenced by parse_stab().
03221 { 03222 struct bincl_file *l; 03223 03224 ++info->files; 03225 info->file_types = ((struct stab_types **) 03226 xrealloc ((PTR) info->file_types, 03227 (info->files 03228 * sizeof *info->file_types))); 03229 03230 for (l = info->bincl_list; l != NULL; l = l->next) 03231 if (l->hash == hash && strcmp (l->name, name) == 0) 03232 break; 03233 if (l == NULL) 03234 { 03235 warn_stab (name, "Undefined N_EXCL"); 03236 info->file_types[info->files - 1] = NULL; 03237 return true; 03238 } 03239 03240 info->file_types[info->files - 1] = l->file_types; 03241 03242 return true; 03243 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean finish_stab | ( | PTR | dhandle, | |
| PTR | handle | |||
| ) |
Definition at line 385 of file stabs.c.
References debug_end_function(), DEBUG_KIND_ILLEGAL, DEBUG_KIND_STRUCT, debug_make_undefined_tagged_type(), DEBUG_TYPE_NULL, stab_handle::function_end, info, stab_tag::kind, stab_tag::name, stab_tag::next, NULL, stab_tag::slot, stab_emit_pending_vars(), stab_handle::tags, and stab_handle::within_function.
Referenced by read_section_stabs_debugging_info(), and read_symbol_stabs_debugging_info().
00388 { 00389 struct stab_handle *info = (struct stab_handle *) handle; 00390 struct stab_tag *st; 00391 00392 if (info->within_function) 00393 { 00394 if (! stab_emit_pending_vars (dhandle, info) 00395 || ! debug_end_function (dhandle, info->function_end)) 00396 return false; 00397 info->within_function = false; 00398 info->function_end = (bfd_vma) -1; 00399 } 00400 00401 for (st = info->tags; st != NULL; st = st->next) 00402 { 00403 enum debug_type_kind kind; 00404 00405 kind = st->kind; 00406 if (kind == DEBUG_KIND_ILLEGAL) 00407 kind = DEBUG_KIND_STRUCT; 00408 st->slot = debug_make_undefined_tagged_type (dhandle, st->name, kind); 00409 if (st->slot == DEBUG_TYPE_NULL) 00410 return false; 00411 } 00412 00413 return true; 00414 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_remember_type PARAMS | ( | (struct stab_demangle_info *, const char *, int) | ) | [static] |
| static boolean stab_demangle_arg PARAMS | ( | (struct stab_demangle_info *, const char **, debug_type **, unsigned int *, unsigned int *) | ) | [static] |
| static boolean stab_demangle_args PARAMS | ( | (struct stab_demangle_info *, const char **, debug_type **, boolean *) | ) | [static] |
| static boolean stab_demangle_class PARAMS | ( | (struct stab_demangle_info *, const char **, const char **) | ) | [static] |
| static boolean stab_demangle_qualified PARAMS | ( | (struct stab_demangle_info *, const char **, debug_type *) | ) | [static] |
| static boolean stab_demangle_function_name PARAMS | ( | (struct stab_demangle_info *, const char **, const char *) | ) | [static] |
| static boolean stab_demangle_prefix PARAMS | ( | (struct stab_demangle_info *, const char **) | ) | [static] |
| static boolean stab_demangle_get_count PARAMS | ( | (const char **, unsigned int *) | ) | [static] |
| static unsigned int stab_demangle_count PARAMS | ( | (const char **) | ) | [static] |
| static debug_type* stab_demangle_argtypes PARAMS | ( | (PTR, struct stab_handle *, const char *, boolean *) | ) | [static] |
| static debug_type stab_find_tagged_type PARAMS | ( | (PTR, struct stab_handle *, const char *, int, enum debug_type_kind) | ) | [static] |
| static debug_type stab_xcoff_builtin_type PARAMS | ( | (PTR, struct stab_handle *, int) | ) | [static] |
| static boolean stab_record_type PARAMS | ( | (PTR, struct stab_handle *, const int *, debug_type) | ) | [static] |
| static debug_type stab_find_type PARAMS | ( | (PTR, struct stab_handle *, const int *) | ) | [static] |
| static debug_type* stab_find_slot PARAMS | ( | (struct stab_handle *, const int *) | ) | [static] |
| static boolean stab_emit_pending_vars PARAMS | ( | (PTR, struct stab_handle *) | ) | [static] |
| static boolean stab_record_variable PARAMS | ( | (PTR, struct stab_handle *, const char *, debug_type, enum debug_var_kind, bfd_vma) | ) | [static] |
| static const char* pop_bincl PARAMS | ( | (struct stab_handle *) | ) | [static] |
| static void push_bincl PARAMS | ( | (struct stab_handle *, const char *, bfd_vma) | ) | [static] |
| static debug_type parse_stab_array_type PARAMS | ( | (PTR, struct stab_handle *, const char **, boolean) | ) | [static] |
| static boolean parse_stab_tilde_field PARAMS | ( | (PTR, struct stab_handle *, const char **, const int *, debug_type *, boolean *) | ) | [static] |
| static debug_type parse_stab_argtypes PARAMS | ( | (PTR, struct stab_handle *, debug_type, const char *, const char *, debug_type, const char *, boolean, boolean, const char **) | ) | [static] |
| static boolean parse_stab_members PARAMS | ( | (PTR, struct stab_handle *, const char *, const char **, const int *, debug_method **) | ) | [static] |
| static boolean parse_stab_one_struct_field PARAMS | ( | (PTR, struct stab_handle *, const char **, const char *, debug_field *, boolean *) | ) | [static] |
| static boolean parse_stab_cpp_abbrev PARAMS | ( | (PTR, struct stab_handle *, const char **, debug_field *) | ) | [static] |
| static boolean parse_stab_struct_fields PARAMS | ( | (PTR, struct stab_handle *, const char **, debug_field **, boolean *) | ) | [static] |
| static boolean parse_stab_baseclasses PARAMS | ( | (PTR, struct stab_handle *, const char **, debug_baseclass **) | ) | [static] |
| static debug_type parse_stab_struct_type PARAMS | ( | (PTR, struct stab_handle *, const char *, const char **, boolean, const int *) | ) | [static] |
| static debug_type parse_stab_sun_builtin_type PARAMS | ( | (PTR, const char **) | ) | [static] |
| static debug_type parse_stab_range_type PARAMS | ( | (PTR, struct stab_handle *, const char *, const char **, const int *) | ) | [static] |
| static boolean parse_stab_type_number PARAMS | ( | (const char **, int *) | ) | [static] |
| static debug_type parse_stab_type PARAMS | ( | (PTR, struct stab_handle *, const char *, const char **, debug_type **) | ) | [static] |
| static boolean parse_stab_string PARAMS | ( | (PTR, struct stab_handle *, int, int, bfd_vma, const char *) | ) | [static] |
| static void warn_stab PARAMS | ( | (const char *, const char *) | ) | [static] |
| static void bad_stab PARAMS | ( | (const char *) | ) | [static] |
| static bfd_vma parse_number PARAMS | ( | (const char **, boolean *) | ) | [static] |
| static char* savestring PARAMS | ( | (const char *, int) | ) | [static] |
| static bfd_vma parse_number | ( | char ** | pp, | |
| boolean * | poverflow | |||
| ) | const [static] |
Definition at line 231 of file stabs.c.
References errno, NULL, p, strtoul(), and warn_stab().
Referenced by parse_stab_array_type(), parse_stab_baseclasses(), parse_stab_cpp_abbrev(), parse_stab_enum_type(), parse_stab_members(), parse_stab_one_struct_field(), parse_stab_range_type(), parse_stab_struct_type(), parse_stab_sun_builtin_type(), parse_stab_sun_floating_type(), and parse_stab_type_number().
00234 { 00235 unsigned long ul; 00236 const char *orig; 00237 00238 if (poverflow != NULL) 00239 *poverflow = false; 00240 00241 orig = *pp; 00242 00243 errno = 0; 00244 ul = strtoul (*pp, (char **) pp, 0); 00245 if (ul + 1 != 0 || errno == 0) 00246 return (bfd_vma) ul; 00247 00248 /* Note that even though strtoul overflowed, it should have set *pp 00249 to the end of the number, which is where we want it. */ 00250 00251 if (sizeof (bfd_vma) > sizeof (unsigned long)) 00252 { 00253 const char *p; 00254 boolean neg; 00255 int base; 00256 bfd_vma over, lastdig; 00257 boolean overflow; 00258 bfd_vma v; 00259 00260 /* Our own version of strtoul, for a bfd_vma. */ 00261 00262 p = orig; 00263 00264 neg = false; 00265 if (*p == '+') 00266 ++p; 00267 else if (*p == '-') 00268 { 00269 neg = true; 00270 ++p; 00271 } 00272 00273 base = 10; 00274 if (*p == '0') 00275 { 00276 if (p[1] == 'x' || p[1] == 'X') 00277 { 00278 base = 16; 00279 p += 2; 00280 } 00281 else 00282 { 00283 base = 8; 00284 ++p; 00285 } 00286 } 00287 00288 over = ((bfd_vma) (bfd_signed_vma) -1) / (bfd_vma) base; 00289 lastdig = ((bfd_vma) (bfd_signed_vma) -1) % (bfd_vma) base; 00290 00291 overflow = false; 00292 v = 0; 00293 while (1) 00294 { 00295 int d; 00296 00297 d = *p++; 00298 if (isdigit ((unsigned char) d)) 00299 d -= '0'; 00300 else if (isupper ((unsigned char) d)) 00301 d -= 'A'; 00302 else if (islower ((unsigned char) d)) 00303 d -= 'a'; 00304 else 00305 break; 00306 00307 if (d >= base) 00308 break; 00309 00310 if (v > over || (v == over && (bfd_vma) d > lastdig)) 00311 { 00312 overflow = true; 00313 break; 00314 } 00315 } 00316 00317 if (! overflow) 00318 { 00319 if (neg) 00320 v = - v; 00321 return v; 00322 } 00323 } 00324 00325 /* If we get here, the number is too large to represent in a 00326 bfd_vma. */ 00327 00328 if (poverflow != NULL) 00329 *poverflow = true; 00330 else 00331 warn_stab (orig, "numeric overflow"); 00332 00333 return 0; 00334 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean parse_stab | ( | PTR | dhandle, | |
| PTR | handle, | |||
| int | type, | |||
| int | desc, | |||
| bfd_vma | value, | |||
| const char * | string | |||
| ) |
Definition at line 419 of file stabs.c.
References stab_handle::block_depth, debug_end_block(), debug_end_common_block(), debug_end_function(), debug_record_line(), debug_set_filename(), debug_start_block(), debug_start_common_block(), debug_start_source(), f, stab_handle::file_start_offset, stab_handle::file_types, stab_handle::files, find_excl(), free, stab_handle::function_end, stab_handle::function_start_offset, stab_handle::gcc_compiled, info, stab_handle::main_filename, N_FN, N_FN_SEQ, stab_handle::n_opt_found, NULL, parse_stab_string(), pop_bincl(), push_bincl(), stab_handle::sections, stab_handle::so_string, stab_handle::so_value, stab_emit_pending_vars(), strchr(), strcmp(), stab_handle::within_function, and xmalloc().
Referenced by read_section_stabs_debugging_info(), and read_symbol_stabs_debugging_info().
00426 { 00427 struct stab_handle *info = (struct stab_handle *) handle; 00428 00429 /* gcc will emit two N_SO strings per compilation unit, one for the 00430 directory name and one for the file name. We just collect N_SO 00431 strings as we see them, and start the new compilation unit when 00432 we see a non N_SO symbol. */ 00433 if (info->so_string != NULL 00434 && (type != N_SO || *string == '\0' || value != info->so_value)) 00435 { 00436 if (! debug_set_filename (dhandle, info->so_string)) 00437 return false; 00438 info->main_filename = info->so_string; 00439 00440 info->gcc_compiled = 0; 00441 info->n_opt_found = false; 00442 00443 /* Generally, for stabs in the symbol table, the N_LBRAC and 00444 N_RBRAC symbols are relative to the N_SO symbol value. */ 00445 if (! info->sections) 00446 info->file_start_offset = info->so_value; 00447 00448 /* We need to reset the mapping from type numbers to types. We 00449 can't free the old mapping, because of the use of 00450 debug_make_indirect_type. */ 00451 info->files = 1; 00452 info->file_types = ((struct stab_types **) 00453 xmalloc (sizeof *info->file_types)); 00454 info->file_types[0] = NULL; 00455 00456 info->so_string = NULL; 00457 00458 /* Now process whatever type we just got. */ 00459 } 00460 00461 switch (type) 00462 { 00463 case N_FN: 00464 case N_FN_SEQ: 00465 break; 00466 00467 case N_LBRAC: 00468 /* Ignore extra outermost context from SunPRO cc and acc. */ 00469 if (info->n_opt_found && desc == 1) 00470 break; 00471 00472 if (! info->within_function) 00473 { 00474 fprintf (stderr, "N_LBRAC not within function\n"); 00475 return false; 00476 } 00477 00478 /* Start an inner lexical block. */ 00479 if (! debug_start_block (dhandle, 00480 (value 00481 + info->file_start_offset 00482 + info->function_start_offset))) 00483 return false; 00484 00485 /* Emit any pending variable definitions. */ 00486 if (! stab_emit_pending_vars (dhandle, info)) 00487 return false; 00488 00489 ++info->block_depth; 00490 break; 00491 00492 case N_RBRAC: 00493 /* Ignore extra outermost context from SunPRO cc and acc. */ 00494 if (info->n_opt_found && desc == 1) 00495 break; 00496 00497 /* We shouldn't have any pending variable definitions here, but, 00498 if we do, we probably need to emit them before closing the 00499 block. */ 00500 if (! stab_emit_pending_vars (dhandle, info)) 00501 return false; 00502 00503 /* End an inner lexical block. */ 00504 if (! debug_end_block (dhandle, 00505 (value 00506 + info->file_start_offset 00507 + info->function_start_offset))) 00508 return false; 00509 00510 --info->block_depth; 00511 if (info->block_depth < 0) 00512 { 00513 fprintf (stderr, "Too many N_RBRACs\n"); 00514 return false; 00515 } 00516 break; 00517 00518 case N_SO: 00519 /* This always ends a function. */ 00520 if (info->within_function) 00521 { 00522 bfd_vma endval; 00523 00524 endval = value; 00525 if (*string != '\0' 00526 && info->function_end != (bfd_vma) -1 00527 && info->function_end < endval) 00528 endval = info->function_end; 00529 if (! stab_emit_pending_vars (dhandle, info) 00530 || ! debug_end_function (dhandle, endval)) 00531 return false; 00532 info->within_function = false; 00533 info->function_end = (bfd_vma) -1; 00534 } 00535 00536 /* An empty string is emitted by gcc at the end of a compilation 00537 unit. */ 00538 if (*string == '\0') 00539 return true; 00540 00541 /* Just accumulate strings until we see a non N_SO symbol. If 00542 the string starts with '/', we discard the previously 00543 accumulated strings. */ 00544 if (info->so_string == NULL) 00545 info->so_string = xstrdup (string); 00546 else 00547 { 00548 char *f; 00549 00550 f = info->so_string; 00551 if (*string == '/') 00552 info->so_string = xstrdup (string); 00553 else 00554 info->so_string = concat (info->so_string, string, 00555 (const char *) NULL); 00556 free (f); 00557 } 00558 00559 info->so_value = value; 00560 00561 break; 00562 00563 case N_SOL: 00564 /* Start an include file. */ 00565 if (! debug_start_source (dhandle, string)) 00566 return false; 00567 break; 00568 00569 case N_BINCL: 00570 /* Start an include file which may be replaced. */ 00571 push_bincl (info, string, value); 00572 if (! debug_start_source (dhandle, string)) 00573 return false; 00574 break; 00575 00576 case N_EINCL: 00577 /* End an N_BINCL include. */ 00578 if (! debug_start_source (dhandle, pop_bincl (info))) 00579 return false; 00580 break; 00581 00582 case N_EXCL: 00583 /* This is a duplicate of a header file named by N_BINCL which 00584 was eliminated by the linker. */ 00585 if (! find_excl (info, string, value)) 00586 return false; 00587 break; 00588 00589 case N_SLINE: 00590 if (! debug_record_line (dhandle, desc, 00591 value + info->function_start_offset)) 00592 return false; 00593 break; 00594 00595 case N_BCOMM: 00596 if (! debug_start_common_block (dhandle, string)) 00597 return false; 00598 break; 00599 00600 case N_ECOMM: 00601 if (! debug_end_common_block (dhandle, string)) 00602 return false; 00603 break; 00604 00605 case N_FUN: 00606 if (*string == '\0') 00607 { 00608 if (info->within_function) 00609 { 00610 /* This always marks the end of a function; we don't 00611 need to worry about info->function_end. */ 00612 if (info->sections) 00613 value += info->function_start_offset; 00614 if (! stab_emit_pending_vars (dhandle, info) 00615 || ! debug_end_function (dhandle, value)) 00616 return false; 00617 info->within_function = false; 00618 info->function_end = (bfd_vma) -1; 00619 } 00620 break; 00621 } 00622 00623 /* A const static symbol in the .text section will have an N_FUN 00624 entry. We need to use these to mark the end of the function, 00625 in case we are looking at gcc output before it was changed to 00626 always emit an empty N_FUN. We can't call debug_end_function 00627 here, because it might be a local static symbol. */ 00628 if (info->within_function 00629 && (info->function_end == (bfd_vma) -1 00630 || value < info->function_end)) 00631 info->function_end = value; 00632 00633 /* Fall through. */ 00634 /* FIXME: gdb checks the string for N_STSYM, N_LCSYM or N_ROSYM 00635 symbols, and if it does not start with :S, gdb relocates the 00636 value to the start of the section. gcc always seems to use 00637 :S, so we don't worry about this. */ 00638 /* Fall through. */ 00639 default: 00640 { 00641 const char *colon; 00642 00643 colon = strchr (string, ':'); 00644 if (colon != NULL 00645 && (colon[1] == 'f' || colon[1] == 'F')) 00646 { 00647 if (info->within_function) 00648 { 00649 bfd_vma endval; 00650 00651 endval = value; 00652 if (info->function_end != (bfd_vma) -1 00653 && info->function_end < endval) 00654 endval = info->function_end; 00655 if (! stab_emit_pending_vars (dhandle, info) 00656 || ! debug_end_function (dhandle, endval)) 00657 return false; 00658 info->function_end = (bfd_vma) -1; 00659 } 00660 /* For stabs in sections, line numbers and block addresses 00661 are offsets from the start of the function. */ 00662 if (info->sections) 00663 info->function_start_offset = value; 00664 info->within_function = true; 00665 } 00666 00667 if (! parse_stab_string (dhandle, info, type, desc, value, string)) 00668 return false; 00669 } 00670 break; 00671 00672 case N_OPT: 00673 if (string != NULL && strcmp (string, "gcc2_compiled.") == 0) 00674 info->gcc_compiled = 2; 00675 else if (string != NULL && strcmp (string, "gcc_compiled.") == 0) 00676 info->gcc_compiled = 1; 00677 else 00678 info->n_opt_found = true; 00679 break; 00680 00681 case N_OBJ: 00682 case N_ENDM: 00683 case N_MAIN: 00684 break; 00685 } 00686 00687 return true; 00688 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type parse_stab_argtypes | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| debug_type | class_type, | |||
| const char * | fieldname, | |||
| const char * | tagname, | |||
| debug_type | return_type, | |||
| const char * | argtypes, | |||
| boolean | constp, | |||
| boolean | volatilep, | |||
| const char ** | pphysname | |||
| ) | [static] |
Definition at line 2845 of file stabs.c.
References args, buf, debug_make_method_type(), DEBUG_TYPE_NULL, NULL, stab_demangle_argtypes(), strcat(), strchr(), strcmp(), strlen(), and xmalloc().
Referenced by parse_stab_members().
02857 { 02858 boolean is_full_physname_constructor; 02859 boolean is_constructor; 02860 boolean is_destructor; 02861 debug_type *args; 02862 boolean varargs; 02863 02864 /* Constructors are sometimes handled specially. */ 02865 is_full_physname_constructor = ((argtypes[0] == '_' 02866 && argtypes[1] == '_' 02867 && (isdigit ((unsigned char) argtypes[2]) 02868 || argtypes[2] == 'Q' 02869 || argtypes[2] == 't')) 02870 || strncmp (argtypes, "__ct", 4) == 0); 02871 02872 is_constructor = (is_full_physname_constructor 02873 || (tagname != NULL 02874 && strcmp (fieldname, tagname) == 0)); 02875 is_destructor = ((argtypes[0] == '_' 02876 && (argtypes[1] == '$' || argtypes[1] == '.') 02877 && argtypes[2] == '_') 02878 || strncmp (argtypes, "__dt", 4) == 0); 02879 02880 if (is_destructor || is_full_physname_constructor) 02881 *pphysname = argtypes; 02882 else 02883 { 02884 unsigned int len; 02885 const char *const_prefix; 02886 const char *volatile_prefix; 02887 char buf[20]; 02888 unsigned int mangled_name_len; 02889 char *physname; 02890 02891 len = tagname == NULL ? 0 : strlen (tagname); 02892 const_prefix = constp ? "C" : ""; 02893 volatile_prefix = volatilep ? "V" : ""; 02894 02895 if (len == 0) 02896 sprintf (buf, "__%s%s", const_prefix, volatile_prefix); 02897 else if (tagname != NULL && strchr (tagname, '<') != NULL) 02898 { 02899 /* Template methods are fully mangled. */ 02900 sprintf (buf, "__%s%s", const_prefix, volatile_prefix); 02901 tagname = NULL; 02902 len = 0; 02903 } 02904 else 02905 sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len); 02906 02907 mangled_name_len = ((is_constructor ? 0 : strlen (fieldname)) 02908 + strlen (buf) 02909 + len 02910 + strlen (argtypes) 02911 + 1); 02912 02913 if (fieldname[0] == 'o' 02914 && fieldname[1] == 'p' 02915 && (fieldname[2] == '$' || fieldname[2] == '.')) 02916 { 02917 const char *opname; 02918 02919 opname = cplus_mangle_opname (fieldname + 3, 0); 02920 if (opname == NULL) 02921 { 02922 fprintf (stderr, "No mangling for \"%s\"\n", fieldname); 02923 return DEBUG_TYPE_NULL; 02924 } 02925 mangled_name_len += strlen (opname); 02926 physname = (char *) xmalloc (mangled_name_len); 02927 strncpy (physname, fieldname, 3); 02928 strcpy (physname + 3, opname); 02929 } 02930 else 02931 { 02932 physname = (char *) xmalloc (mangled_name_len); 02933 if (is_constructor) 02934 physname[0] = '\0'; 02935 else 02936 strcpy (physname, fieldname); 02937 } 02938 02939 strcat (physname, buf); 02940 if (tagname != NULL) 02941 strcat (physname, tagname); 02942 strcat (physname, argtypes); 02943 02944 *pphysname = physname; 02945 } 02946 02947 if (*argtypes == '\0' || is_destructor) 02948 { 02949 args = (debug_type *) xmalloc (sizeof *args); 02950 *args = NULL; 02951 return debug_make_method_type (dhandle, return_type, class_type, args, 02952 false); 02953 } 02954 02955 args = stab_demangle_argtypes (dhandle, info, *pphysname, &varargs); 02956 if (args == NULL) 02957 return DEBUG_TYPE_NULL; 02958 02959 return debug_make_method_type (dhandle, return_type, class_type, args, 02960 varargs); 02961 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type parse_stab_array_type | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char ** | pp, | |||
| boolean | stringp | |||
| ) | [static] |
Definition at line 3048 of file stabs.c.
References bad_stab(), debug_find_named_type(), debug_make_array_type(), debug_make_int_type(), DEBUG_TYPE_NULL, NULL, p, parse_number(), parse_stab_type(), and parse_stab_type_number().
Referenced by parse_stab_type().
03053 { 03054 const char *orig; 03055 const char *p; 03056 int typenums[2]; 03057 debug_type index_type; 03058 boolean adjustable; 03059 bfd_signed_vma lower, upper; 03060 debug_type element_type; 03061 03062 /* Format of an array type: 03063 "ar<index type>;lower;upper;<array_contents_type>". 03064 OS9000: "arlower,upper;<array_contents_type>". 03065 03066 Fortran adjustable arrays use Adigits or Tdigits for lower or upper; 03067 for these, produce a type like float[][]. */ 03068 03069 orig = *pp; 03070 03071 /* FIXME: gdb checks os9k_stabs here. */ 03072 03073 /* If the index type is type 0, we take it as int. */ 03074 p = *pp; 03075 if (! parse_stab_type_number (&p, typenums)) 03076 return DEBUG_TYPE_NULL; 03077 if (typenums[0] == 0 && typenums[1] == 0 && **pp != '=') 03078 { 03079 index_type = debug_find_named_type (dhandle, "int"); 03080 if (index_type == DEBUG_TYPE_NULL) 03081 { 03082 index_type = debug_make_int_type (dhandle, 4, false); 03083 if (index_type == DEBUG_TYPE_NULL) 03084 return DEBUG_TYPE_NULL; 03085 } 03086 *pp = p; 03087 } 03088 else 03089 { 03090 index_type = parse_stab_type (dhandle, info, (const char *) NULL, pp, 03091 (debug_type **) NULL); 03092 } 03093 03094 if (**pp != ';') 03095 { 03096 bad_stab (orig); 03097 return DEBUG_TYPE_NULL; 03098 } 03099 ++*pp; 03100 03101 adjustable = false; 03102 03103 if (! isdigit ((unsigned char) **pp) && **pp != '-') 03104 { 03105 ++*pp; 03106 adjustable = true; 03107 } 03108 03109 lower = (bfd_signed_vma) parse_number (pp, (boolean *) NULL); 03110 if (**pp != ';') 03111 { 03112 bad_stab (orig); 03113 return DEBUG_TYPE_NULL; 03114 } 03115 ++*pp; 03116 03117 if (! isdigit ((unsigned char) **pp) && **pp != '-') 03118 { 03119 ++*pp; 03120 adjustable = true; 03121 } 03122 03123 upper = (bfd_signed_vma) parse_number (pp, (boolean *) NULL); 03124 if (**pp != ';') 03125 { 03126 bad_stab (orig); 03127 return DEBUG_TYPE_NULL; 03128 } 03129 ++*pp; 03130 03131 element_type = parse_stab_type (dhandle, info, (const char *) NULL, pp, 03132 (debug_type **) NULL); 03133 if (element_type == DEBUG_TYPE_NULL) 03134 return DEBUG_TYPE_NULL; 03135 03136 if (adjustable) 03137 { 03138 lower = 0; 03139 upper = -1; 03140 } 03141 03142 return debug_make_array_type (dhandle, element_type, index_type, lower, 03143 upper, stringp); 03144 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean parse_stab_baseclasses | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char ** | pp, | |||
| debug_baseclass ** | retp | |||
| ) | [static] |
Definition at line 2082 of file stabs.c.
References bad_stab(), DEBUG_BASECLASS_NULL, debug_make_baseclass(), DEBUG_TYPE_NULL, DEBUG_VISIBILITY_PRIVATE, DEBUG_VISIBILITY_PROTECTED, DEBUG_VISIBILITY_PUBLIC, int(), NULL, parse_number(), parse_stab_type(), stab_tag::type, warn_stab(), and xmalloc().
Referenced by parse_stab_struct_type().
02087 { 02088 const char *orig; 02089 unsigned int c, i; 02090 debug_baseclass *classes; 02091 02092 *retp = NULL; 02093 02094 orig = *pp; 02095 02096 if (**pp != '!') 02097 { 02098 /* No base classes. */ 02099 return true; 02100 } 02101 ++*pp; 02102 02103 c = (unsigned int) parse_number (pp, (boolean *) NULL); 02104 02105 if (**pp != ',') 02106 { 02107 bad_stab (orig); 02108 return false; 02109 } 02110 ++*pp; 02111 02112 classes = (debug_baseclass *) xmalloc ((c + 1) * sizeof (**retp)); 02113 02114 for (i = 0; i < c; i++) 02115 { 02116 boolean virtual; 02117 enum debug_visibility visibility; 02118 bfd_vma bitpos; 02119 debug_type type; 02120 02121 switch (**pp) 02122 { 02123 case '0': 02124 virtual = false; 02125 break; 02126 case '1': 02127 virtual = true; 02128 break; 02129 default: 02130 warn_stab (orig, "unknown virtual character for baseclass"); 02131 virtual = false; 02132 break; 02133 } 02134 ++*pp; 02135 02136 switch (**pp) 02137 { 02138 case '0': 02139 visibility = DEBUG_VISIBILITY_PRIVATE; 02140 break; 02141 case '1': 02142 visibility = DEBUG_VISIBILITY_PROTECTED; 02143 break; 02144 case '2': 02145 visibility = DEBUG_VISIBILITY_PUBLIC; 02146 break; 02147 default: 02148 warn_stab (orig, "unknown visibility character for baseclass"); 02149 visibility = DEBUG_VISIBILITY_PUBLIC; 02150 break; 02151 } 02152 ++*pp; 02153 02154 /* The remaining value is the bit offset of the portion of the 02155 object corresponding to this baseclass. Always zero in the 02156 absence of multiple inheritance. */ 02157 bitpos = parse_number (pp, (boolean *) NULL); 02158 if (**pp != ',') 02159 { 02160 bad_stab (orig); 02161 return false; 02162 } 02163 ++*pp; 02164 02165 type = parse_stab_type (dhandle, info, (const char *) NULL, pp, 02166 (debug_type **) NULL); 02167 if (type == DEBUG_TYPE_NULL) 02168 return false; 02169 02170 classes[i] = debug_make_baseclass (dhandle, type, bitpos, virtual, 02171 visibility); 02172 if (classes[i] == DEBUG_BASECLASS_NULL) 02173 return false; 02174 02175 if (**pp != ';') 02176 return false; 02177 ++*pp; 02178 } 02179 02180 classes[i] = DEBUG_BASECLASS_NULL; 02181 02182 *retp = classes; 02183 02184 return true; 02185 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean parse_stab_cpp_abbrev | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char ** | pp, | |||
| debug_field * | retp | |||
| ) | [static] |
Definition at line 2291 of file stabs.c.
References bad_stab(), DEBUG_FIELD_NULL, debug_get_type_name(), debug_make_field(), DEBUG_TYPE_NULL, DEBUG_VISIBILITY_PRIVATE, name, NULL, parse_number(), parse_stab_type(), stab_tag::type, and warn_stab().
Referenced by parse_stab_struct_fields().
02296 { 02297 const char *orig; 02298 int cpp_abbrev; 02299 debug_type context; 02300 const char *name; 02301 const char *typename; 02302 debug_type type; 02303 bfd_vma bitpos; 02304 02305 *retp = DEBUG_FIELD_NULL; 02306 02307 orig = *pp; 02308 02309 if (**pp != 'v') 02310 { 02311 bad_stab (*pp); 02312 return false; 02313 } 02314 ++*pp; 02315 02316 cpp_abbrev = **pp; 02317 ++*pp; 02318 02319 /* At this point, *pp points to something like "22:23=*22...", where 02320 the type number before the ':' is the "context" and everything 02321 after is a regular type definition. Lookup the type, find it's 02322 name, and construct the field name. */ 02323 02324 context = parse_stab_type (dhandle, info, (const char *) NULL, pp, 02325 (debug_type **) NULL); 02326 if (context == DEBUG_TYPE_NULL) 02327 return false; 02328 02329 switch (cpp_abbrev) 02330 { 02331 case 'f': 02332 /* $vf -- a virtual function table pointer. */ 02333 name = "_vptr$"; 02334 break; 02335 case 'b': 02336 /* $vb -- a virtual bsomethingorother */ 02337 typename = debug_get_type_name (dhandle, context); 02338 if (typename == NULL) 02339 { 02340 warn_stab (orig, "unnamed $vb type"); 02341 typename = "FOO"; 02342 } 02343 name = concat ("_vb$", typename, (const char *) NULL); 02344 break; 02345 default: 02346 warn_stab (orig, "unrecognized C++ abbreviation"); 02347 name = "INVALID_CPLUSPLUS_ABBREV"; 02348 break; 02349 } 02350 02351 if (**pp != ':') 02352 { 02353 bad_stab (orig); 02354 return false; 02355 } 02356 ++*pp; 02357 02358 type = parse_stab_type (dhandle, info, (const char *) NULL, pp, 02359 (debug_type **) NULL); 02360 if (**pp != ',') 02361 { 02362 bad_stab (orig); 02363 return false; 02364 } 02365 ++*pp; 02366 02367 bitpos = parse_number (pp, (boolean *) NULL); 02368 if (**pp != ';') 02369 { 02370 bad_stab (orig); 02371 return false; 02372 } 02373 ++*pp; 02374 02375 *retp = debug_make_field (dhandle, name, type, bitpos, 0, 02376 DEBUG_VISIBILITY_PRIVATE); 02377 if (*retp == DEBUG_FIELD_NULL) 02378 return false; 02379 02380 return true; 02381 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type parse_stab_enum_type | ( | PTR | dhandle, | |
| const char ** | pp | |||
| ) | [static] |
Definition at line 1934 of file stabs.c.
References bad_stab(), debug_make_enum_type(), DEBUG_TYPE_NULL, n, name, NULL, p, parse_number(), savestring, xmalloc(), and xrealloc().
Referenced by parse_stab_type().
01937 { 01938 const char *orig; 01939 const char **names; 01940 bfd_signed_vma *values; 01941 unsigned int n; 01942 unsigned int alloc; 01943 01944 orig = *pp; 01945 01946 /* FIXME: gdb checks os9k_stabs here. */ 01947 01948 /* The aix4 compiler emits an extra field before the enum members; 01949 my guess is it's a type of some sort. Just ignore it. */ 01950 if (**pp == '-') 01951 { 01952 while (**pp != ':') 01953 ++*pp; 01954 ++*pp; 01955 } 01956 01957 /* Read the value-names and their values. 01958 The input syntax is NAME:VALUE,NAME:VALUE, and so on. 01959 A semicolon or comma instead of a NAME means the end. */ 01960 alloc = 10; 01961 names = (const char **) xmalloc (alloc * sizeof *names); 01962 values = (bfd_signed_vma *) xmalloc (alloc * sizeof *values); 01963 n = 0; 01964 while (**pp != '\0' && **pp != ';' && **pp != ',') 01965 { 01966 const char *p; 01967 char *name; 01968 bfd_signed_vma val; 01969 01970 p = *pp; 01971 while (*p != ':') 01972 ++p; 01973 01974 name = savestring (*pp, p - *pp); 01975 01976 *pp = p + 1; 01977 val = (bfd_signed_vma) parse_number (pp, (boolean *) NULL); 01978 if (**pp != ',') 01979 { 01980 bad_stab (orig); 01981 return DEBUG_TYPE_NULL; 01982 } 01983 ++*pp; 01984 01985 if (n + 1 >= alloc) 01986 { 01987 alloc += 10; 01988 names = ((const char **) 01989 xrealloc ((PTR) names, alloc * sizeof *names)); 01990 values = ((bfd_signed_vma *) 01991 xrealloc ((PTR) values, alloc * sizeof *values)); 01992 } 01993 01994 names[n] = name; 01995 values[n] = val; 01996 ++n; 01997 } 01998 01999 names[n] = NULL; 02000 values[n] = 0; 02001 02002 if (**pp == ';') 02003 ++*pp; 02004 02005 return debug_make_enum_type (dhandle, names, values); 02006 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean parse_stab_members | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char * | tagname, | |||
| const char ** | pp, | |||
| const int * | typenums, | |||
| debug_method ** | retp | |||
| ) | [static] |
Definition at line 2524 of file stabs.c.
References bad_stab(), debug_get_parameter_types(), debug_get_return_type(), debug_get_type_kind(), DEBUG_KIND_METHOD, debug_make_method(), debug_make_method_variant(), debug_make_static_method_variant(), DEBUG_METHOD_NULL, DEBUG_METHOD_VARIANT_NULL, DEBUG_TYPE_NULL, DEBUG_VISIBILITY_PRIVATE, DEBUG_VISIBILITY_PROTECTED, DEBUG_VISIBILITY_PUBLIC, name, NULL, p, parse_number(), parse_stab_argtypes(), parse_stab_type(), savestring, stab_find_type(), strchr(), strlen(), stab_tag::type, warn_stab(), xmalloc(), and xrealloc().
Referenced by parse_stab_struct_type().
02531 { 02532 const char *orig; 02533 debug_method *methods; 02534 unsigned int c; 02535 unsigned int alloc; 02536 02537 *retp = NULL; 02538 02539 orig = *pp; 02540 02541 alloc = 0; 02542 methods = NULL; 02543 c = 0; 02544 02545 while (**pp != ';') 02546 { 02547 const char *p; 02548 char *name; 02549 debug_method_variant *variants; 02550 unsigned int cvars; 02551 unsigned int allocvars; 02552 debug_type look_ahead_type; 02553 02554 p = strchr (*pp, ':'); 02555 if (p == NULL || p[1] != ':') 02556 break; 02557 02558 /* FIXME: Some systems use something other than '$' here. */ 02559 if ((*pp)[0] != 'o' || (*pp)[1] != 'p' || (*pp)[2] != '$') 02560 { 02561 name = savestring (*pp, p - *pp); 02562 *pp = p + 2; 02563 } 02564 else 02565 { 02566 /* This is a completely wierd case. In order to stuff in the 02567 names that might contain colons (the usual name delimiter), 02568 Mike Tiemann defined a different name format which is 02569 signalled if the identifier is "op$". In that case, the 02570 format is "op$::XXXX." where XXXX is the name. This is 02571 used for names like "+" or "=". YUUUUUUUK! FIXME! */ 02572 *pp = p + 2; 02573 for (p = *pp; *p != '.' && *p != '\0'; p++) 02574 ; 02575 if (*p != '.') 02576 { 02577 bad_stab (orig); 02578 return false; 02579 } 02580 name = savestring (*pp, p - *pp); 02581 *pp = p + 1; 02582 } 02583 02584 allocvars = 10; 02585 variants = ((debug_method_variant *) 02586 xmalloc (allocvars * sizeof *variants)); 02587 cvars = 0; 02588 02589 look_ahead_type = DEBUG_TYPE_NULL; 02590 02591 do 02592 { 02593 debug_type type; 02594 boolean stub; 02595 char *argtypes; 02596 enum debug_visibility visibility; 02597 boolean constp, volatilep, staticp; 02598 bfd_vma voffset; 02599 debug_type context; 02600 const char *physname; 02601 boolean varargs; 02602 02603 if (look_ahead_type != DEBUG_TYPE_NULL) 02604 { 02605 /* g++ version 1 kludge */ 02606 type = look_ahead_type; 02607 look_ahead_type = DEBUG_TYPE_NULL; 02608 } 02609 else 02610 { 02611 type = parse_stab_type (dhandle, info, (const char *) NULL, pp, 02612 (debug_type **) NULL); 02613 if (type == DEBUG_TYPE_NULL) 02614 return false; 02615 if (**pp != ':') 02616 { 02617 bad_stab (orig); 02618 return false; 02619 } 02620 } 02621 02622 ++*pp; 02623 p = strchr (*pp, ';'); 02624 if (p == NULL) 02625 { 02626 bad_stab (orig); 02627 return false; 02628 } 02629 02630 stub = false; 02631 if (debug_get_type_kind (dhandle, type) == DEBUG_KIND_METHOD 02632 && debug_get_parameter_types (dhandle, type, &varargs) == NULL) 02633 stub = true; 02634 02635 argtypes = savestring (*pp, p - *pp); 02636 *pp = p + 1; 02637 02638 switch (**pp) 02639 { 02640 case '0': 02641 visibility = DEBUG_VISIBILITY_PRIVATE; 02642 break; 02643 case '1': 02644 visibility = DEBUG_VISIBILITY_PROTECTED; 02645 break; 02646 default: 02647 visibility = DEBUG_VISIBILITY_PUBLIC; 02648 break; 02649 } 02650 ++*pp; 02651 02652 constp = false; 02653 volatilep = false; 02654 switch (**pp) 02655 { 02656 case 'A': 02657 /* Normal function. */ 02658 ++*pp; 02659 break; 02660 case 'B': 02661 /* const member function. */ 02662 constp = true; 02663 ++*pp; 02664 break; 02665 case 'C': 02666 /* volatile member function. */ 02667 volatilep = true; 02668 ++*pp; 02669 break; 02670 case 'D': 02671 /* const volatile member function. */ 02672 constp = true; 02673 volatilep = true; 02674 ++*pp; 02675 break; 02676 case '*': 02677 case '?': 02678 case '.': 02679 /* File compiled with g++ version 1; no information. */ 02680 break; 02681 default: 02682 warn_stab (orig, "const/volatile indicator missing"); 02683 break; 02684 } 02685 02686 staticp = false; 02687 switch (**pp) 02688 { 02689 case '*': 02690 /* virtual member function, followed by index. The sign 02691 bit is supposedly set to distinguish 02692 pointers-to-methods from virtual function indicies. */ 02693 ++*pp; 02694 voffset = parse_number (pp, (boolean *) NULL); 02695 if (**pp != ';') 02696 { 02697 bad_stab (orig); 02698 return false; 02699 } 02700 ++*pp; 02701 voffset &= 0x7fffffff; 02702 02703 if (**pp == ';' || *pp == '\0') 02704 { 02705 /* Must be g++ version 1. */ 02706 context = DEBUG_TYPE_NULL; 02707 } 02708 else 02709 { 02710 /* Figure out from whence this virtual function 02711 came. It may belong to virtual function table of 02712 one of its baseclasses. */ 02713 look_ahead_type = parse_stab_type (dhandle, info, 02714 (const char *) NULL, 02715 pp, 02716 (debug_type **) NULL); 02717 if (**pp == ':') 02718 { 02719 /* g++ version 1 overloaded methods. */ 02720 context = DEBUG_TYPE_NULL; 02721 } 02722 else 02723 { 02724 context = look_ahead_type; 02725 look_ahead_type = DEBUG_TYPE_NULL; 02726 if (**pp != ';') 02727 { 02728 bad_stab (orig); 02729 return false; 02730 } 02731 ++*pp; 02732 } 02733 } 02734 break; 02735 02736 case '?': 02737 /* static member function. */ 02738 ++*pp; 02739 staticp = true; 02740 voffset = 0; 02741 context = DEBUG_TYPE_NULL; 02742 if (strncmp (argtypes, name, strlen (name)) != 0) 02743 stub = true; 02744 break; 02745 02746 default: 02747 warn_stab (orig, "member function type missing"); 02748 voffset = 0; 02749 context = DEBUG_TYPE_NULL; 02750 break; 02751 02752 case '.': 02753 ++*pp; 02754 voffset = 0; 02755 context = DEBUG_TYPE_NULL; 02756 break; 02757 } 02758 02759 /* If the type is not a stub, then the argtypes string is 02760 the physical name of the function. Otherwise the 02761 argtypes string is the mangled form of the argument 02762 types, and the full type and the physical name must be 02763 extracted from them. */ 02764 if (! stub) 02765 physname = argtypes; 02766 else 02767 { 02768 debug_type class_type, return_type; 02769 02770 class_type = stab_find_type (dhandle, info, typenums); 02771 if (class_type == DEBUG_TYPE_NULL) 02772 return false; 02773 return_type = debug_get_return_type (dhandle, type); 02774 if (return_type == DEBUG_TYPE_NULL) 02775 { 02776 bad_stab (orig); 02777 return false; 02778 } 02779 type = parse_stab_argtypes (dhandle, info, class_type, name, 02780 tagname, return_type, argtypes, 02781 constp, volatilep, &physname); 02782 if (type == DEBUG_TYPE_NULL) 02783 return false; 02784 } 02785 02786 if (cvars + 1 >= allocvars) 02787 { 02788 allocvars += 10; 02789 variants = ((debug_method_variant *) 02790 xrealloc ((PTR) variants, 02791 allocvars * sizeof *variants)); 02792 } 02793 02794 if (! staticp) 02795 variants[cvars] = debug_make_method_variant (dhandle, physname, 02796 type, visibility, 02797 constp, volatilep, 02798 voffset, context); 02799 else 02800 variants[cvars] = debug_make_static_method_variant (dhandle, 02801 physname, 02802 type, 02803 visibility, 02804 constp, 02805 volatilep); 02806 if (variants[cvars] == DEBUG_METHOD_VARIANT_NULL) 02807 return false; 02808 02809 ++cvars; 02810 } 02811 while (**pp != ';' && **pp != '\0'); 02812 02813 variants[cvars] = DEBUG_METHOD_VARIANT_NULL; 02814 02815 if (**pp != '\0') 02816 ++*pp; 02817 02818 if (c + 1 >= alloc) 02819 { 02820 alloc += 10; 02821 methods = ((debug_method *) 02822 xrealloc ((PTR) methods, alloc * sizeof *methods)); 02823 } 02824 02825 methods[c] = debug_make_method (dhandle, name, variants); 02826 02827 ++c; 02828 } 02829 02830 if (methods != NULL) 02831 methods[c] = DEBUG_METHOD_NULL; 02832 02833 *retp = methods; 02834 02835 return true; 02836 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean parse_stab_one_struct_field | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char ** | pp, | |||
| const char * | p, | |||
| debug_field * | retp, | |||
| boolean * | staticsp | |||
| ) | [static] |
Definition at line 2386 of file stabs.c.
References bad_stab(), debug_make_field(), debug_make_static_member(), DEBUG_TYPE_NULL, DEBUG_VISIBILITY_IGNORE, DEBUG_VISIBILITY_PRIVATE, DEBUG_VISIBILITY_PROTECTED, DEBUG_VISIBILITY_PUBLIC, name, NULL, parse_number(), parse_stab_type(), savestring, strchr(), stab_tag::type, and warn_stab().
Referenced by parse_stab_struct_fields().
02393 { 02394 const char *orig; 02395 char *name; 02396 enum debug_visibility visibility; 02397 debug_type type; 02398 bfd_vma bitpos; 02399 bfd_vma bitsize; 02400 02401 orig = *pp; 02402 02403 /* FIXME: gdb checks ARM_DEMANGLING here. */ 02404 02405 name = savestring (*pp, p - *pp); 02406 02407 *pp = p + 1; 02408 02409 if (**pp != '/') 02410 visibility = DEBUG_VISIBILITY_PUBLIC; 02411 else 02412 { 02413 ++*pp; 02414 switch (**pp) 02415 { 02416 case '0': 02417 visibility = DEBUG_VISIBILITY_PRIVATE; 02418 break; 02419 case '1': 02420 visibility = DEBUG_VISIBILITY_PROTECTED; 02421 break; 02422 case '2': 02423 visibility = DEBUG_VISIBILITY_PUBLIC; 02424 break; 02425 default: 02426 warn_stab (orig, "unknown visibility character for field"); 02427 visibility = DEBUG_VISIBILITY_PUBLIC; 02428 break; 02429 } 02430 ++*pp; 02431 } 02432 02433 type = parse_stab_type (dhandle, info, (const char *) NULL, pp, 02434 (debug_type **) NULL); 02435 if (type == DEBUG_TYPE_NULL) 02436 return false; 02437 02438 if (**pp == ':') 02439 { 02440 char *varname; 02441 02442 /* This is a static class member. */ 02443 ++*pp; 02444 p = strchr (*pp, ';'); 02445 if (p == NULL) 02446 { 02447 bad_stab (orig); 02448 return false; 02449 } 02450 02451 varname = savestring (*pp, p - *pp); 02452 02453 *pp = p + 1; 02454 02455 *retp = debug_make_static_member (dhandle, name, type, varname, 02456 visibility); 02457 *staticsp = true; 02458 02459 return true; 02460 } 02461 02462 if (**pp != ',') 02463 { 02464 bad_stab (orig); 02465 return false; 02466 } 02467 ++*pp; 02468 02469 bitpos = parse_number (pp, (boolean *) NULL); 02470 if (**pp != ',') 02471 { 02472 bad_stab (orig); 02473 return false; 02474 } 02475 ++*pp; 02476 02477 bitsize = parse_number (pp, (boolean *) NULL); 02478 if (**pp != ';') 02479 { 02480 bad_stab (orig); 02481 return false; 02482 } 02483 ++*pp; 02484 02485 if (bitpos == 0 && bitsize == 0) 02486 { 02487 /* This can happen in two cases: (1) at least for gcc 2.4.5 or 02488 so, it is a field which has been optimized out. The correct 02489 stab for this case is to use VISIBILITY_IGNORE, but that is a 02490 recent invention. (2) It is a 0-size array. For example 02491 union { int num; char str[0]; } foo. Printing "<no value>" 02492 for str in "p foo" is OK, since foo.str (and thus foo.str[3]) 02493 will continue to work, and a 0-size array as a whole doesn't 02494 have any contents to print. 02495 02496 I suspect this probably could also happen with gcc -gstabs 02497 (not -gstabs+) for static fields, and perhaps other C++ 02498 extensions. Hopefully few people use -gstabs with gdb, since 02499 it is intended for dbx compatibility. */ 02500 visibility = DEBUG_VISIBILITY_IGNORE; 02501 } 02502 02503 /* FIXME: gdb does some stuff here to mark fields as unpacked. */ 02504 02505 *retp = debug_make_field (dhandle, name, type, bitpos, bitsize, visibility); 02506 02507 return true; 02508 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type parse_stab_range_type | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char * | typename, | |||
| const char ** | pp, | |||
| const int * | typenums | |||
| ) | [static] |
Definition at line 1641 of file stabs.c.
References bad_stab(), debug_make_complex_type(), debug_make_float_type(), debug_make_int_type(), debug_make_range_type(), debug_make_void_type(), DEBUG_TYPE_NULL, LLHIGH, LLLOW, NULL, parse_number(), parse_stab_type(), parse_stab_type_number(), stab_find_type(), strcmp(), ULLHIGH, and warn_stab().
Referenced by parse_stab_type().
01647 { 01648 const char *orig; 01649 int rangenums[2]; 01650 boolean self_subrange; 01651 debug_type index_type; 01652 const char *s2, *s3; 01653 bfd_signed_vma n2, n3; 01654 boolean ov2, ov3; 01655 01656 orig = *pp; 01657 01658 index_type = DEBUG_TYPE_NULL; 01659 01660 /* First comes a type we are a subrange of. 01661 In C it is usually 0, 1 or the type being defined. */ 01662 if (! parse_stab_type_number (pp, rangenums)) 01663 return DEBUG_TYPE_NULL; 01664 01665 self_subrange = (rangenums[0] == typenums[0] 01666 && rangenums[1] == typenums[1]); 01667 01668 if (**pp == '=') 01669 { 01670 *pp = orig; 01671 index_type = parse_stab_type (dhandle, info, (const char *) NULL, 01672 pp, (debug_type **) NULL); 01673 if (index_type == DEBUG_TYPE_NULL) 01674 return DEBUG_TYPE_NULL; 01675 } 01676 01677 if (**pp == ';') 01678 ++*pp; 01679 01680 /* The remaining two operands are usually lower and upper bounds of 01681 the range. But in some special cases they mean something else. */ 01682 s2 = *pp; 01683 n2 = parse_number (pp, &ov2); 01684 if (**pp != ';') 01685 { 01686 bad_stab (orig); 01687 return DEBUG_TYPE_NULL; 01688 } 01689 ++*pp; 01690 01691 s3 = *pp; 01692 n3 = parse_number (pp, &ov3); 01693 if (**pp != ';') 01694 { 01695 bad_stab (orig); 01696 return DEBUG_TYPE_NULL; 01697 } 01698 ++*pp; 01699 01700 if (ov2 || ov3) 01701 { 01702 /* gcc will emit range stabs for long long types. Handle this 01703 as a special case. FIXME: This needs to be more general. */ 01704 #define LLLOW "01000000000000000000000;" 01705 #define LLHIGH "0777777777777777777777;" 01706 #define ULLHIGH "01777777777777777777777;" 01707 if (index_type == DEBUG_TYPE_NULL) 01708 { 01709 if (strncmp (s2, LLLOW, sizeof LLLOW - 1) == 0 01710 && strncmp (s3, LLHIGH, sizeof LLHIGH - 1) == 0) 01711 return debug_make_int_type (dhandle, 8, false); 01712 if (! ov2 01713 && n2 == 0 01714 && strncmp (s3, ULLHIGH, sizeof ULLHIGH - 1) == 0) 01715 return debug_make_int_type (dhandle, 8, true); 01716 } 01717 01718 warn_stab (orig, "numeric overflow"); 01719 } 01720 01721 if (index_type == DEBUG_TYPE_NULL) 01722 { 01723 /* A type defined as a subrange of itself, with both bounds 0, 01724 is void. */ 01725 if (self_subrange && n2 == 0 && n3 == 0) 01726 return debug_make_void_type (dhandle); 01727 01728 /* A type defined as a subrange of itself, with n2 positive and 01729 n3 zero, is a complex type, and n2 is the number of bytes. */ 01730 if (self_subrange && n3 == 0 && n2 > 0) 01731 return debug_make_complex_type (dhandle, n2); 01732 01733 /* If n3 is zero and n2 is positive, this is a floating point 01734 type, and n2 is the number of bytes. */ 01735 if (n3 == 0 && n2 > 0) 01736 return debug_make_float_type (dhandle, n2); 01737 01738 /* If the upper bound is -1, this is an unsigned int. */ 01739 if (n2 == 0 && n3 == -1) 01740 { 01741 /* When gcc is used with -gstabs, but not -gstabs+, it will emit 01742 long long int:t6=r1;0;-1; 01743 long long unsigned int:t7=r1;0;-1; 01744 We hack here to handle this reasonably. */ 01745 if (typename != NULL) 01746 { 01747 if (strcmp (typename, "long long int") == 0) 01748 return debug_make_int_type (dhandle, 8, false); 01749 else if (strcmp (typename, "long long unsigned int") == 0) 01750 return debug_make_int_type (dhandle, 8, true); 01751 } 01752 /* FIXME: The size here really depends upon the target. */ 01753 return debug_make_int_type (dhandle, 4, true); 01754 } 01755 01756 /* A range of 0 to 127 is char. */ 01757 if (self_subrange && n2 == 0 && n3 == 127) 01758 return debug_make_int_type (dhandle, 1, false); 01759 01760 /* FIXME: gdb checks for the language CHILL here. */ 01761 01762 if (n2 == 0) 01763 { 01764 if (n3 < 0) 01765 return debug_make_int_type (dhandle, - n3, true); 01766 else if (n3 == 0xff) 01767 return debug_make_int_type (dhandle, 1, true); 01768 else if (n3 == 0xffff) 01769 return debug_make_int_type (dhandle, 2, true); 01770 /* -1 is used for the upper bound of (4 byte) "unsigned int" 01771 and "unsigned long", and we already checked for that, so 01772 don't need to test for it here. */ 01773 } 01774 else if (n3 == 0 01775 && n2 < 0 01776 && (self_subrange || n2 == -8)) 01777 return debug_make_int_type (dhandle, - n2, true); 01778 else if (n2 == - n3 - 1) 01779 { 01780 if (n3 == 0x7f) 01781 return debug_make_int_type (dhandle, 1, false); 01782 else if (n3 == 0x7fff) 01783 return debug_make_int_type (dhandle, 2, false); 01784 else if (n3 == 0x7fffffff) 01785 return debug_make_int_type (dhandle, 4, false); 01786 } 01787 } 01788 01789 /* At this point I don't have the faintest idea how to deal with a 01790 self_subrange type; I'm going to assume that this is used as an 01791 idiom, and that all of them are special cases. So . . . */ 01792 if (self_subrange) 01793 { 01794 bad_stab (orig); 01795 return DEBUG_TYPE_NULL; 01796 } 01797 01798 index_type = stab_find_type (dhandle, info, rangenums); 01799 if (index_type == DEBUG_TYPE_NULL) 01800 { 01801 /* Does this actually ever happen? Is that why we are worrying 01802 about dealing with it rather than just calling error_type? */ 01803 warn_stab (orig, "missing index type"); 01804 index_type = debug_make_int_type (dhandle, 4, false); 01805 } 01806 01807 return debug_make_range_type (dhandle, index_type, n2, n3); 01808 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean parse_stab_string | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| int | stabtype, | |||
| int | desc, | |||
| bfd_vma | value, | |||
| const char * | string | |||
| ) | [static] |
Definition at line 693 of file stabs.c.
References stab_handle::abfd, atof(), atoi(), bad_stab(), DEBUG_GLOBAL, DEBUG_LOCAL, DEBUG_LOCAL_STATIC, debug_make_function_type(), debug_make_pointer_type(), debug_name_type(), DEBUG_PARM_REF_REG, DEBUG_PARM_REFERENCE, DEBUG_PARM_REG, DEBUG_PARM_STACK, debug_record_float_const(), debug_record_function(), debug_record_int_const(), debug_record_label(), debug_record_parameter(), debug_record_typed_const(), DEBUG_REGISTER, DEBUG_STATIC, debug_tag_type(), DEBUG_TYPE_NULL, stab_handle::gcc_compiled, n, name, stab_tag::next, NULL, p, parse_stab_type(), savestring, stab_tag::slot, stab_record_variable(), strchr(), strcmp(), stab_handle::symcount, stab_handle::syms, stab_handle::tags, and warn_stab().
Referenced by parse_stab().
00700 { 00701 const char *p; 00702 char *name; 00703 int type; 00704 debug_type dtype; 00705 boolean synonym; 00706 unsigned int lineno; 00707 debug_type *slot; 00708 00709 p = strchr (string, ':'); 00710 if (p == NULL) 00711 return true; 00712 00713 while (p[1] == ':') 00714 { 00715 p += 2; 00716 p = strchr (p, ':'); 00717 if (p == NULL) 00718 { 00719 bad_stab (string); 00720 return false; 00721 } 00722 } 00723 00724 /* GCC 2.x puts the line number in desc. SunOS apparently puts in 00725 the number of bytes occupied by a type or object, which we 00726 ignore. */ 00727 if (info->gcc_compiled >= 2) 00728 lineno = desc; 00729 else 00730 lineno = 0; 00731 00732 /* FIXME: Sometimes the special C++ names start with '.'. */ 00733 name = NULL; 00734 if (string[0] == '$') 00735 { 00736 switch (string[1]) 00737 { 00738 case 't': 00739 name = "this"; 00740 break; 00741 case 'v': 00742 /* Was: name = "vptr"; */ 00743 break; 00744 case 'e': 00745 name = "eh_throw"; 00746 break; 00747 case '_': 00748 /* This was an anonymous type that was never fixed up. */ 00749 break; 00750 case 'X': 00751 /* SunPRO (3.0 at least) static variable encoding. */ 00752 break; 00753 default: 00754 warn_stab (string, "unknown C++ encoded name"); 00755 break; 00756 } 00757 } 00758 00759 if (name == NULL) 00760 { 00761 if (p == string || (string[0] == ' ' && p == string + 1)) 00762 name = NULL; 00763 else 00764 name = savestring (string, p - string); 00765 } 00766 00767 ++p; 00768 if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-') 00769 type = 'l'; 00770 else 00771 type = *p++; 00772 00773 switch (type) 00774 { 00775 case 'c': 00776 /* c is a special case, not followed by a type-number. 00777 SYMBOL:c=iVALUE for an integer constant symbol. 00778 SYMBOL:c=rVALUE for a floating constant symbol. 00779 SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol. 00780 e.g. "b:c=e6,0" for "const b = blob1" 00781 (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */ 00782 if (*p != '=') 00783 { 00784 bad_stab (string); 00785 return false; 00786 } 00787 ++p; 00788 switch (*p++) 00789 { 00790 case 'r': 00791 /* Floating point constant. */ 00792 if (! debug_record_float_const (dhandle, name, atof (p))) 00793 return false; 00794 break; 00795 case 'i': 00796 /* Integer constant. */ 00797 /* Defining integer constants this way is kind of silly, 00798 since 'e' constants allows the compiler to give not only 00799 the value, but the type as well. C has at least int, 00800 long, unsigned int, and long long as constant types; 00801 other languages probably should have at least unsigned as 00802 well as signed constants. */ 00803 if (! debug_record_int_const (dhandle, name, atoi (p))) 00804 return false; 00805 break; 00806 case 'e': 00807 /* SYMBOL:c=eTYPE,INTVALUE for a constant symbol whose value 00808 can be represented as integral. 00809 e.g. "b:c=e6,0" for "const b = blob1" 00810 (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */ 00811 dtype = parse_stab_type (dhandle, info, (const char *) NULL, 00812 &p, (debug_type **) NULL); 00813 if (dtype == DEBUG_TYPE_NULL) 00814 return false; 00815 if (*p != ',') 00816 { 00817 bad_stab (string); 00818 return false; 00819 } 00820 if (! debug_record_typed_const (dhandle, name, dtype, atoi (p))) 00821 return false; 00822 break; 00823 default: 00824 bad_stab (string); 00825 return false; 00826 } 00827 00828 break; 00829 00830 case 'C': 00831 /* The name of a caught exception. */ 00832 dtype = parse_stab_type (dhandle, info, (const char *) NULL, 00833 &p, (debug_type **) NULL); 00834 if (dtype == DEBUG_TYPE_NULL) 00835 return false; 00836 if (! debug_record_label (dhandle, name, dtype, value)) 00837 return false; 00838 break; 00839 00840 case 'f': 00841 case 'F': 00842 /* A function definition. */ 00843 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 00844 (debug_type **) NULL); 00845 if (dtype == DEBUG_TYPE_NULL) 00846 return false; 00847 if (! debug_record_function (dhandle, name, dtype, type == 'F', value)) 00848 return false; 00849 00850 /* Sun acc puts declared types of arguments here. We don't care 00851 about their actual types (FIXME -- we should remember the whole 00852 function prototype), but the list may define some new types 00853 that we have to remember, so we must scan it now. */ 00854 while (*p == ';') 00855 { 00856 ++p; 00857 if (parse_stab_type (dhandle, info, (const char *) NULL, &p, 00858 (debug_type **) NULL) 00859 == DEBUG_TYPE_NULL) 00860 return false; 00861 } 00862 00863 break; 00864 00865 case 'G': 00866 { 00867 char leading; 00868 long c; 00869 asymbol **ps; 00870 00871 /* A global symbol. The value must be extracted from the 00872 symbol table. */ 00873 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 00874 (debug_type **) NULL); 00875 if (dtype == DEBUG_TYPE_NULL) 00876 return false; 00877 leading = bfd_get_symbol_leading_char (info->abfd); 00878 for (c = info->symcount, ps = info->syms; c > 0; --c, ++ps) 00879 { 00880 const char *n; 00881 00882 n = bfd_asymbol_name (*ps); 00883 if (leading != '\0' && *n == leading) 00884 ++n; 00885 if (*n == *name && strcmp (n, name) == 0) 00886 break; 00887 } 00888 if (c > 0) 00889 value = bfd_asymbol_value (*ps); 00890 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_GLOBAL, 00891 value)) 00892 return false; 00893 } 00894 break; 00895 00896 /* This case is faked by a conditional above, when there is no 00897 code letter in the dbx data. Dbx data never actually 00898 contains 'l'. */ 00899 case 'l': 00900 case 's': 00901 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 00902 (debug_type **) NULL); 00903 if (dtype == DEBUG_TYPE_NULL) 00904 return false; 00905 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_LOCAL, 00906 value)) 00907 return false; 00908 break; 00909 00910 case 'p': 00911 /* A function parameter. */ 00912 if (*p != 'F') 00913 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 00914 (debug_type **) NULL); 00915 else 00916 { 00917 /* pF is a two-letter code that means a function parameter in 00918 Fortran. The type-number specifies the type of the return 00919 value. Translate it into a pointer-to-function type. */ 00920 ++p; 00921 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 00922 (debug_type **) NULL); 00923 if (dtype != DEBUG_TYPE_NULL) 00924 { 00925 debug_type ftype; 00926 00927 ftype = debug_make_function_type (dhandle, dtype, 00928 (debug_type *) NULL, false); 00929 dtype = debug_make_pointer_type (dhandle, ftype); 00930 } 00931 } 00932 if (dtype == DEBUG_TYPE_NULL) 00933 return false; 00934 if (! debug_record_parameter (dhandle, name, dtype, DEBUG_PARM_STACK, 00935 value)) 00936 return false; 00937 00938 /* FIXME: At this point gdb considers rearranging the parameter 00939 address on a big endian machine if it is smaller than an int. 00940 We have no way to do that, since we don't really know much 00941 about the target. */ 00942 00943 break; 00944 00945 case 'P': 00946 if (stabtype == N_FUN) 00947 { 00948 /* Prototype of a function referenced by this file. */ 00949 while (*p == ';') 00950 { 00951 ++p; 00952 if (parse_stab_type (dhandle, info, (const char *) NULL, &p, 00953 (debug_type **) NULL) 00954 == DEBUG_TYPE_NULL) 00955 return false; 00956 } 00957 break; 00958 } 00959 /* Fall through. */ 00960 case 'R': 00961 /* Parameter which is in a register. */ 00962 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 00963 (debug_type **) NULL); 00964 if (dtype == DEBUG_TYPE_NULL) 00965 return false; 00966 if (! debug_record_parameter (dhandle, name, dtype, DEBUG_PARM_REG, 00967 value)) 00968 return false; 00969 break; 00970 00971 case 'r': 00972 /* Register variable (either global or local). */ 00973 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 00974 (debug_type **) NULL); 00975 if (dtype == DEBUG_TYPE_NULL) 00976 return false; 00977 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_REGISTER, 00978 value)) 00979 return false; 00980 00981 /* FIXME: At this point gdb checks to combine pairs of 'p' and 00982 'r' stabs into a single 'P' stab. */ 00983 00984 break; 00985 00986 case 'S': 00987 /* Static symbol at top level of file */ 00988 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 00989 (debug_type **) NULL); 00990 if (dtype == DEBUG_TYPE_NULL) 00991 return false; 00992 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_STATIC, 00993 value)) 00994 return false; 00995 break; 00996 00997 case 't': 00998 /* A typedef. */ 00999 dtype = parse_stab_type (dhandle, info, name, &p, &slot); 01000 if (dtype == DEBUG_TYPE_NULL) 01001 return false; 01002 if (name == NULL) 01003 { 01004 /* A nameless type. Nothing to do. */ 01005 return true; 01006 } 01007 01008 dtype = debug_name_type (dhandle, name, dtype); 01009 if (dtype == DEBUG_TYPE_NULL) 01010 return false; 01011 01012 if (slot != NULL) 01013 *slot = dtype; 01014 01015 break; 01016 01017 case 'T': 01018 /* Struct, union, or enum tag. For GNU C++, this can be be followed 01019 by 't' which means we are typedef'ing it as well. */ 01020 if (*p != 't') 01021 { 01022 synonym = false; 01023 /* FIXME: gdb sets synonym to true if the current language 01024 is C++. */ 01025 } 01026 else 01027 { 01028 synonym = true; 01029 ++p; 01030 } 01031 01032 dtype = parse_stab_type (dhandle, info, name, &p, &slot); 01033 if (dtype == DEBUG_TYPE_NULL) 01034 return false; 01035 if (name == NULL) 01036 return true; 01037 01038 dtype = debug_tag_type (dhandle, name, dtype); 01039 if (dtype == DEBUG_TYPE_NULL) 01040 return false; 01041 if (slot != NULL) 01042 *slot = dtype; 01043 01044 /* See if we have a cross reference to this tag which we can now 01045 fill in. */ 01046 { 01047 register struct stab_tag **pst; 01048 01049 for (pst = &info->tags; *pst != NULL; pst = &(*pst)->next) 01050 { 01051 if ((*pst)->name[0] == name[0] 01052 && strcmp ((*pst)->name, name) == 0) 01053 { 01054 (*pst)->slot = dtype; 01055 *pst = (*pst)->next; 01056 break; 01057 } 01058 } 01059 } 01060 01061 if (synonym) 01062 { 01063 dtype = debug_name_type (dhandle, name, dtype); 01064 if (dtype == DEBUG_TYPE_NULL) 01065 return false; 01066 01067 if (slot != NULL) 01068 *slot = dtype; 01069 } 01070 01071 break; 01072 01073 case 'V': 01074 /* Static symbol of local scope */ 01075 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 01076 (debug_type **) NULL); 01077 if (dtype == DEBUG_TYPE_NULL) 01078 return false; 01079 /* FIXME: gdb checks os9k_stabs here. */ 01080 if (! stab_record_variable (dhandle, info, name, dtype, 01081 DEBUG_LOCAL_STATIC, value)) 01082 return false; 01083 break; 01084 01085 case 'v': 01086 /* Reference parameter. */ 01087 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 01088 (debug_type **) NULL); 01089 if (dtype == DEBUG_TYPE_NULL) 01090 return false; 01091 if (! debug_record_parameter (dhandle, name, dtype, DEBUG_PARM_REFERENCE, 01092 value)) 01093 return false; 01094 break; 01095 01096 case 'a': 01097 /* Reference parameter which is in a register. */ 01098 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 01099 (debug_type **) NULL); 01100 if (dtype == DEBUG_TYPE_NULL) 01101 return false; 01102 if (! debug_record_parameter (dhandle, name, dtype, DEBUG_PARM_REF_REG, 01103 value)) 01104 return false; 01105 break; 01106 01107 case 'X': 01108 /* This is used by Sun FORTRAN for "function result value". 01109 Sun claims ("dbx and dbxtool interfaces", 2nd ed) 01110 that Pascal uses it too, but when I tried it Pascal used 01111 "x:3" (local symbol) instead. */ 01112 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, 01113 (debug_type **) NULL); 01114 if (dtype == DEBUG_TYPE_NULL) 01115 return false; 01116 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_LOCAL, 01117 value)) 01118 return false; 01119 break; 01120 01121 default: 01122 bad_stab (string); 01123 return false; 01124 } 01125 01126 /* FIXME: gdb converts structure values to structure pointers in a 01127 couple of cases, depending upon the target. */ 01128 01129 return true; 01130 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean parse_stab_struct_fields | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char ** | pp, | |||
| debug_field ** | retp, | |||
| boolean * | staticsp | |||
| ) | [static] |
Definition at line 2208 of file stabs.c.
References bad_stab(), DEBUG_FIELD_NULL, NULL, p, parse_stab_cpp_abbrev(), parse_stab_one_struct_field(), strchr(), xmalloc(), and xrealloc().
Referenced by parse_stab_struct_type().
02214 { 02215 const char *orig; 02216 const char *p; 02217 debug_field *fields; 02218 unsigned int c; 02219 unsigned int alloc; 02220 02221 *retp = NULL; 02222 *staticsp = false; 02223 02224 orig = *pp; 02225 02226 c = 0; 02227 alloc = 10; 02228 fields = (debug_field *) xmalloc (alloc * sizeof *fields); 02229 while (**pp != ';') 02230 { 02231 /* FIXME: gdb checks os9k_stabs here. */ 02232 02233 p = *pp; 02234 02235 /* Add 1 to c to leave room for NULL pointer at end. */ 02236 if (c + 1 >= alloc) 02237 { 02238 alloc += 10; 02239 fields = ((debug_field *) 02240 xrealloc ((PTR) fields, alloc * sizeof *fields)); 02241 } 02242 02243 /* If it starts with CPLUS_MARKER it is a special abbreviation, 02244 unless the CPLUS_MARKER is followed by an underscore, in 02245 which case it is just the name of an anonymous type, which we 02246 should handle like any other type name. We accept either '$' 02247 or '.', because a field name can never contain one of these 02248 characters except as a CPLUS_MARKER. */ 02249 02250 if ((*p == '$' || *p == '.') && p[1] != '_') 02251 { 02252 ++*pp; 02253 if (! parse_stab_cpp_abbrev (dhandle, info, pp, fields + c)) 02254 return false; 02255 ++c; 02256 continue; 02257 } 02258 02259 /* Look for the ':' that separates the field name from the field 02260 values. Data members are delimited by a single ':', while member 02261 functions are delimited by a pair of ':'s. When we hit the member 02262 functions (if any), terminate scan loop and return. */ 02263 02264 p = strchr (p, ':'); 02265 if (p == NULL) 02266 { 02267 bad_stab (orig); 02268 return false; 02269 } 02270 02271 if (p[1] == ':') 02272 break; 02273 02274 if (! parse_stab_one_struct_field (dhandle, info, pp, p, fields + c, 02275 staticsp)) 02276 return false; 02277 02278 ++c; 02279 } 02280 02281 fields[c] = DEBUG_FIELD_NULL; 02282 02283 *retp = fields; 02284 02285 return true; 02286 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type parse_stab_struct_type | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char * | tagname, | |||
| const char ** | pp, | |||
| boolean | structp, | |||
| const int * | typenums | |||
| ) | [static] |
Definition at line 2016 of file stabs.c.
References debug_make_object_type(), debug_make_struct_type(), DEBUG_TYPE_NULL, NULL, parse_number(), parse_stab_baseclasses(), parse_stab_members(), parse_stab_struct_fields(), and parse_stab_tilde_field().
Referenced by parse_stab_type().
02023 { 02024 const char *orig; 02025 bfd_vma size; 02026 debug_baseclass *baseclasses; 02027 debug_field *fields; 02028 boolean statics; 02029 debug_method *methods; 02030 debug_type vptrbase; 02031 boolean ownvptr; 02032 02033 orig = *pp; 02034 02035 /* Get the size. */ 02036 size = parse_number (pp, (boolean *) NULL); 02037 02038 /* Get the other information. */ 02039 if (! parse_stab_baseclasses (dhandle, info, pp, &baseclasses) 02040 || ! parse_stab_struct_fields (dhandle, info, pp, &fields, &statics) 02041 || ! parse_stab_members (dhandle, info, tagname, pp, typenums, &methods) 02042 || ! parse_stab_tilde_field (dhandle, info, pp, typenums, &vptrbase, 02043 &ownvptr)) 02044 return DEBUG_TYPE_NULL; 02045 02046 if (! statics 02047 && baseclasses == NULL 02048 && methods == NULL 02049 && vptrbase == DEBUG_TYPE_NULL 02050 && ! ownvptr) 02051 return debug_make_struct_type (dhandle, structp, size, fields); 02052 02053 return debug_make_object_type (dhandle, structp, size, fields, baseclasses, 02054 methods, vptrbase, ownvptr); 02055 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type parse_stab_sun_builtin_type | ( | PTR | dhandle, | |
| const char ** | pp | |||
| ) | [static] |
Definition at line 1823 of file stabs.c.
References bad_stab(), debug_make_int_type(), debug_make_void_type(), DEBUG_TYPE_NULL, NULL, and parse_number().
Referenced by parse_stab_type().
01826 { 01827 const char *orig; 01828 boolean unsignedp; 01829 bfd_vma bits; 01830 01831 orig = *pp; 01832 01833 switch (**pp) 01834 { 01835 case 's': 01836 unsignedp = false; 01837 break; 01838 case 'u': 01839 unsignedp = true; 01840 break; 01841 default: 01842 bad_stab (orig); 01843 return DEBUG_TYPE_NULL; 01844 } 01845 ++*pp; 01846 01847 /* For some odd reason, all forms of char put a c here. This is strange 01848 because no other type has this honor. We can safely ignore this because 01849 we actually determine 'char'acterness by the number of bits specified in 01850 the descriptor. */ 01851 if (**pp == 'c') 01852 ++*pp; 01853 01854 /* The first number appears to be the number of bytes occupied 01855 by this type, except that unsigned short is 4 instead of 2. 01856 Since this information is redundant with the third number, 01857 we will ignore it. */ 01858 (void) parse_number (pp, (boolean *) NULL); 01859 if (**pp != ';') 01860 { 01861 bad_stab (orig); 01862 return DEBUG_TYPE_NULL; 01863 } 01864 ++*pp; 01865 01866 /* The second number is always 0, so ignore it too. */ 01867 (void) parse_number (pp, (boolean *) NULL); 01868 if (**pp != ';') 01869 { 01870 bad_stab (orig); 01871 return DEBUG_TYPE_NULL; 01872 } 01873 ++*pp; 01874 01875 /* The third number is the number of bits for this type. */ 01876 bits = parse_number (pp, (boolean *) NULL); 01877 01878 /* The type *should* end with a semicolon. If it are embedded 01879 in a larger type the semicolon may be the only way to know where 01880 the type ends. If this type is at the end of the stabstring we 01881 can deal with the omitted semicolon (but we don't have to like 01882 it). Don't bother to complain(), Sun's compiler omits the semicolon 01883 for "void". */ 01884 if (**pp == ';') 01885 ++*pp; 01886 01887 if (bits == 0) 01888 return debug_make_void_type (dhandle); 01889 01890 return debug_make_int_type (dhandle, bits / 8, unsignedp); 01891 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type parse_stab_sun_floating_type | ( | PTR | dhandle, | |
| const char ** | pp | |||
| ) | [static] |
Definition at line 1896 of file stabs.c.
References bad_stab(), debug_make_complex_type(), debug_make_float_type(), DEBUG_TYPE_NULL, NF_COMPLEX, NF_COMPLEX16, NF_COMPLEX32, NULL, and parse_number().
Referenced by parse_stab_type().
01899 { 01900 const char *orig; 01901 bfd_vma details; 01902 bfd_vma bytes; 01903 01904 orig = *pp; 01905 01906 /* The first number has more details about the type, for example 01907 FN_COMPLEX. */ 01908 details = parse_number (pp, (boolean *) NULL); 01909 if (**pp != ';') 01910 { 01911 bad_stab (orig); 01912 return DEBUG_TYPE_NULL; 01913 } 01914 01915 /* The second number is the number of bytes occupied by this type */ 01916 bytes = parse_number (pp, (boolean *) NULL); 01917 if (**pp != ';') 01918 { 01919 bad_stab (orig); 01920 return DEBUG_TYPE_NULL; 01921 } 01922 01923 if (details == NF_COMPLEX 01924 || details == NF_COMPLEX16 01925 || details == NF_COMPLEX32) 01926 return debug_make_complex_type (dhandle, bytes); 01927 01928 return debug_make_float_type (dhandle, bytes); 01929 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean parse_stab_tilde_field | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char ** | pp, | |||
| const int * | typenums, | |||
| debug_type * | retvptrbase, | |||
| boolean * | retownvptr | |||
| ) | [static] |
Definition at line 2972 of file stabs.c.
References bad_stab(), DEBUG_TYPE_NULL, NULL, p, parse_stab_type(), and parse_stab_type_number().
Referenced by parse_stab_struct_type().
02979 { 02980 const char *orig; 02981 const char *hold; 02982 int vtypenums[2]; 02983 02984 *retvptrbase = DEBUG_TYPE_NULL; 02985 *retownvptr = false; 02986 02987 orig = *pp; 02988 02989 /* If we are positioned at a ';', then skip it. */ 02990 if (**pp == ';') 02991 ++*pp; 02992 02993 if (**pp != '~') 02994 return true; 02995 02996 ++*pp; 02997 02998 if (**pp == '=' || **pp == '+' || **pp == '-') 02999 { 03000 /* Obsolete flags that used to indicate the presence of 03001 constructors and/or destructors. */ 03002 ++*pp; 03003 } 03004 03005 if (**pp != '%') 03006 return true; 03007 03008 ++*pp; 03009 03010 hold = *pp; 03011 03012 /* The next number is the type number of the base class (possibly 03013 our own class) which supplies the vtable for this class. */ 03014 if (! parse_stab_type_number (pp, vtypenums)) 03015 return false; 03016 03017 if (vtypenums[0] == typenums[0] 03018 && vtypenums[1] == typenums[1]) 03019 *retownvptr = true; 03020 else 03021 { 03022 debug_type vtype; 03023 const char *p; 03024 03025 *pp = hold; 03026 03027 vtype = parse_stab_type (dhandle, info, (const char *) NULL, pp, 03028 (debug_type **) NULL); 03029 for (p = *pp; *p != ';' && *p != '\0'; p++) 03030 ; 03031 if (*p != ';') 03032 { 03033 bad_stab (orig); 03034 return false; 03035 } 03036 03037 *retvptrbase = vtype; 03038 03039 *pp = p + 1; 03040 } 03041 03042 return true; 03043 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type parse_stab_type | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char * | typename, | |||
| const char ** | pp, | |||
| debug_type ** | slotp | |||
| ) | [static] |
Definition at line 1138 of file stabs.c.
References args, atoi(), bad_stab(), debug_get_type_kind(), DEBUG_KIND_ENUM, DEBUG_KIND_STRUCT, DEBUG_KIND_UNION, DEBUG_KIND_VOID, debug_make_const_type(), debug_make_function_type(), debug_make_method_type(), debug_make_offset_type(), debug_make_pointer_type(), debug_make_reference_type(), debug_make_set_type(), debug_make_void_type(), debug_make_volatile_type(), debug_record_type_size(), DEBUG_TYPE_NULL, n, NULL, p, parse_stab_array_type(), parse_stab_enum_type(), parse_stab_range_type(), parse_stab_struct_type(), parse_stab_sun_builtin_type(), parse_stab_sun_floating_type(), parse_stab_type_number(), stab_find_slot(), stab_find_tagged_type(), stab_find_type(), stab_record_type(), strchr(), warn_stab(), xmalloc(), and xrealloc().
Referenced by parse_stab_array_type(), parse_stab_baseclasses(), parse_stab_cpp_abbrev(), parse_stab_members(), parse_stab_one_struct_field(), parse_stab_range_type(), parse_stab_string(), and parse_stab_tilde_field().
01144 { 01145 const char *orig; 01146 int typenums[2]; 01147 int size; 01148 boolean stringp; 01149 int descriptor; 01150 debug_type dtype; 01151 01152 if (slotp != NULL) 01153 *slotp = NULL; 01154 01155 orig = *pp; 01156 01157 size = -1; 01158 stringp = false; 01159 01160 /* Read type number if present. The type number may be omitted. 01161 for instance in a two-dimensional array declared with type 01162 "ar1;1;10;ar1;1;10;4". */ 01163 if (! isdigit ((unsigned char) **pp) && **pp != '(' && **pp != '-') 01164 { 01165 /* 'typenums=' not present, type is anonymous. Read and return 01166 the definition, but don't put it in the type vector. */ 01167 typenums[0] = typenums[1] = -1; 01168 } 01169 else 01170 { 01171 if (! parse_stab_type_number (pp, typenums)) 01172 return DEBUG_TYPE_NULL; 01173 01174 if (**pp != '=') 01175 { 01176 /* Type is not being defined here. Either it already 01177 exists, or this is a forward reference to it. */ 01178 return stab_find_type (dhandle, info, typenums); 01179 } 01180 01181 /* Only set the slot if the type is being defined. This means 01182 that the mapping from type numbers to types will only record 01183 the name of the typedef which defines a type. If we don't do 01184 this, then something like 01185 typedef int foo; 01186 int i; 01187 will record that i is of type foo. Unfortunately, stabs 01188 information is ambiguous about variable types. For this code, 01189 typedef int foo; 01190 int i; 01191 foo j; 01192 the stabs information records both i and j as having the same 01193 type. This could be fixed by patching the compiler. */ 01194 if (slotp != NULL && typenums[0] >= 0 && typenums[1] >= 0) 01195 *slotp = stab_find_slot (info, typenums); 01196 01197 /* Type is being defined here. */ 01198 /* Skip the '='. */ 01199 ++*pp; 01200 01201 while (**pp == '@') 01202 { 01203 const char *p = *pp + 1; 01204 const char *attr; 01205 01206 if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-') 01207 { 01208 /* Member type. */ 01209 break; 01210 } 01211 01212 /* Type attributes. */ 01213 attr = p; 01214 01215 for (; *p != ';'; ++p) 01216 { 01217 if (*p == '\0') 01218 { 01219 bad_stab (orig); 01220 return DEBUG_TYPE_NULL; 01221 } 01222 } 01223 *pp = p + 1; 01224 01225 switch (*attr) 01226 { 01227 case 's': 01228 size = atoi (attr + 1); 01229 if (size <= 0) 01230 size = -1; 01231 break; 01232 01233 case 'S': 01234 stringp = true; 01235 break; 01236 01237 default: 01238 /* Ignore unrecognized type attributes, so future 01239 compilers can invent new ones. */ 01240 break; 01241 } 01242 } 01243 } 01244 01245 descriptor = **pp; 01246 ++*pp; 01247 01248 switch (descriptor) 01249 { 01250 case 'x': 01251 { 01252 enum debug_type_kind code; 01253 const char *q1, *q2, *p; 01254 01255 /* A cross reference to another type. */ 01256 01257 switch (**pp) 01258 { 01259 case 's': 01260 code = DEBUG_KIND_STRUCT; 01261 break; 01262 case 'u': 01263 code = DEBUG_KIND_UNION; 01264 break; 01265 case 'e': 01266 code = DEBUG_KIND_ENUM; 01267 break; 01268 default: 01269 /* Complain and keep going, so compilers can invent new 01270 cross-reference types. */ 01271 warn_stab (orig, "unrecognized cross reference type"); 01272 code = DEBUG_KIND_STRUCT; 01273 break; 01274 } 01275 ++*pp; 01276 01277 q1 = strchr (*pp, '<'); 01278 p = strchr (*pp, ':'); 01279 if (p == NULL) 01280 { 01281 bad_stab (orig); 01282 return DEBUG_TYPE_NULL; 01283 } 01284 while (q1 != NULL && p > q1 && p[1] == ':') 01285 { 01286 q2 = strchr (q1, '>'); 01287 if (q2 == NULL || q2 < p) 01288 break; 01289 p += 2; 01290 p = strchr (p, ':'); 01291 if (p == NULL) 01292 { 01293 bad_stab (orig); 01294 return DEBUG_TYPE_NULL; 01295 } 01296 } 01297 01298 dtype = stab_find_tagged_type (dhandle, info, *pp, p - *pp, code); 01299 01300 *pp = p + 1; 01301 } 01302 break; 01303 01304 case '-': 01305 case '0': 01306 case '1': 01307 case '2': 01308 case '3': 01309 case '4': 01310 case '5': 01311 case '6': 01312 case '7': 01313 case '8': 01314 case '9': 01315 case '(': 01316 { 01317 const char *hold; 01318 int xtypenums[2]; 01319 01320 /* This type is defined as another type. */ 01321 01322 (*pp)--; 01323 hold = *pp; 01324 01325 /* Peek ahead at the number to detect void. */ 01326 if (! parse_stab_type_number (pp, xtypenums)) 01327 return DEBUG_TYPE_NULL; 01328 01329 if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1]) 01330 { 01331 /* This type is being defined as itself, which means that 01332 it is void. */ 01333 dtype = debug_make_void_type (dhandle); 01334 } 01335 else 01336 { 01337 *pp = hold; 01338 01339 /* Go back to the number and have parse_stab_type get it. 01340 This means that we can deal with something like 01341 t(1,2)=(3,4)=... which the Lucid compiler uses. */ 01342 dtype = parse_stab_type (dhandle, info, (const char *) NULL, 01343 pp, (debug_type **) NULL); 01344 if (dtype == DEBUG_TYPE_NULL) 01345 return DEBUG_TYPE_NULL; 01346 } 01347 01348 if (typenums[0] != -1) 01349 { 01350 if (! stab_record_type (dhandle, info, typenums, dtype)) 01351 return DEBUG_TYPE_NULL; 01352 } 01353 01354 break; 01355 } 01356 01357 case '*': 01358 dtype = debug_make_pointer_type (dhandle, 01359 parse_stab_type (dhandle, info, 01360 (const char *) NULL, 01361 pp, 01362 (debug_type **) NULL)); 01363 break; 01364 01365 case '&': 01366 /* Reference to another type. */ 01367 dtype = (debug_make_reference_type 01368 (dhandle, 01369 parse_stab_type (dhandle, info, (const char *) NULL, pp, 01370 (debug_type **) NULL))); 01371 break; 01372 01373 case 'f': 01374 /* Function returning another type. */ 01375 /* FIXME: gdb checks os9k_stabs here. */ 01376 dtype = (debug_make_function_type 01377 (dhandle, 01378 parse_stab_type (dhandle, info, (const char *) NULL, pp, 01379 (debug_type **) NULL), 01380 (debug_type *) NULL, false)); 01381 break; 01382 01383 case 'k': 01384 /* Const qualifier on some type (Sun). */ 01385 /* FIXME: gdb accepts 'c' here if os9k_stabs. */ 01386 dtype = debug_make_const_type (dhandle, 01387 parse_stab_type (dhandle, info, 01388 (const char *) NULL, 01389 pp, 01390 (debug_type **) NULL)); 01391 break; 01392 01393 case 'B': 01394 /* Volatile qual on some type (Sun). */ 01395 /* FIXME: gdb accepts 'i' here if os9k_stabs. */ 01396 dtype = (debug_make_volatile_type 01397 (dhandle, 01398 parse_stab_type (dhandle, info, (const char *) NULL, pp, 01399 (debug_type **) NULL))); 01400 break; 01401 01402 case '@': 01403 /* Offset (class & variable) type. This is used for a pointer 01404 relative to an object. */ 01405 { 01406 debug_type domain; 01407 debug_type memtype; 01408 01409 /* Member type. */ 01410 01411 domain = parse_stab_type (dhandle, info, (const char *) NULL, pp, 01412 (debug_type **) NULL); 01413 if (domain == DEBUG_TYPE_NULL) 01414 return DEBUG_TYPE_NULL; 01415 01416 if (**pp != ',') 01417 { 01418 bad_stab (orig); 01419 return DEBUG_TYPE_NULL; 01420 } 01421 ++*pp; 01422 01423 memtype = parse_stab_type (dhandle, info, (const char *) NULL, pp, 01424 (debug_type **) NULL); 01425 if (memtype == DEBUG_TYPE_NULL) 01426 return DEBUG_TYPE_NULL; 01427 01428 dtype = debug_make_offset_type (dhandle, domain, memtype); 01429 } 01430 break; 01431 01432 case '#': 01433 /* Method (class & fn) type. */ 01434 if (**pp == '#') 01435 { 01436 debug_type return_type; 01437 01438 ++*pp; 01439 return_type = parse_stab_type (dhandle, info, (const char *) NULL, 01440 pp, (debug_type **) NULL); 01441 if (return_type == DEBUG_TYPE_NULL) 01442 return DEBUG_TYPE_NULL; 01443 if (**pp != ';') 01444 { 01445 bad_stab (orig); 01446 return DEBUG_TYPE_NULL; 01447 } 01448 ++*pp; 01449 dtype = debug_make_method_type (dhandle, return_type, 01450 DEBUG_TYPE_NULL, 01451 (debug_type *) NULL, false); 01452 } 01453 else 01454 { 01455 debug_type domain; 01456 debug_type return_type; 01457 debug_type *args; 01458 unsigned int n; 01459 unsigned int alloc; 01460 boolean varargs; 01461 01462 domain = parse_stab_type (dhandle, info, (const char *) NULL, 01463 pp, (debug_type **) NULL); 01464 if (domain == DEBUG_TYPE_NULL) 01465 return DEBUG_TYPE_NULL; 01466 01467 if (**pp != ',') 01468 { 01469 bad_stab (orig); 01470 return DEBUG_TYPE_NULL; 01471 } 01472 ++*pp; 01473 01474 return_type = parse_stab_type (dhandle, info, (const char *) NULL, 01475 pp, (debug_type **) NULL); 01476 if (return_type == DEBUG_TYPE_NULL) 01477 return DEBUG_TYPE_NULL; 01478 01479 alloc = 10; 01480 args = (debug_type *) xmalloc (alloc * sizeof *args); 01481 n = 0; 01482 while (**pp != ';') 01483 { 01484 if (**pp != ',') 01485 { 01486 bad_stab (orig); 01487 return DEBUG_TYPE_NULL; 01488 } 01489 ++*pp; 01490 01491 if (n + 1 >= alloc) 01492 { 01493 alloc += 10; 01494 args = ((debug_type *) 01495 xrealloc ((PTR) args, alloc * sizeof *args)); 01496 } 01497 01498 args[n] = parse_stab_type (dhandle, info, (const char *) NULL, 01499 pp, (debug_type **) NULL); 01500 if (args[n] == DEBUG_TYPE_NULL) 01501 return DEBUG_TYPE_NULL; 01502 ++n; 01503 } 01504 ++*pp; 01505 01506 /* If the last type is not void, then this function takes a 01507 variable number of arguments. Otherwise, we must strip 01508 the void type. */ 01509 if (n == 0 01510 || debug_get_type_kind (dhandle, args[n - 1]) != DEBUG_KIND_VOID) 01511 varargs = true; 01512 else 01513 { 01514 --n; 01515 varargs = false; 01516 } 01517 01518 args[n] = DEBUG_TYPE_NULL; 01519 01520 dtype = debug_make_method_type (dhandle, return_type, domain, args, 01521 varargs); 01522 } 01523 break; 01524 01525 case 'r': 01526 /* Range type. */ 01527 dtype = parse_stab_range_type (dhandle, info, typename, pp, typenums); 01528 break; 01529 01530 case 'b': 01531 /* FIXME: gdb checks os9k_stabs here. */ 01532 /* Sun ACC builtin int type. */ 01533 dtype = parse_stab_sun_builtin_type (dhandle, pp); 01534 break; 01535 01536 case 'R': 01537 /* Sun ACC builtin float type. */ 01538 dtype = parse_stab_sun_floating_type (dhandle, pp); 01539 break; 01540 01541 case 'e': 01542 /* Enumeration type. */ 01543 dtype = parse_stab_enum_type (dhandle, pp); 01544 break; 01545 01546 case 's': 01547 case 'u': 01548 /* Struct or union type. */ 01549 dtype = parse_stab_struct_type (dhandle, info, typename, pp, 01550 descriptor == 's', typenums); 01551 break; 01552 01553 case 'a': 01554 /* Array type. */ 01555 if (**pp != 'r') 01556 { 01557 bad_stab (orig); 01558 return DEBUG_TYPE_NULL; 01559 } 01560 ++*pp; 01561 01562 dtype = parse_stab_array_type (dhandle, info, pp, stringp); 01563 break; 01564 01565 case 'S': 01566 dtype = debug_make_set_type (dhandle, 01567 parse_stab_type (dhandle, info, 01568 (const char *) NULL, 01569 pp, 01570 (debug_type **) NULL), 01571 stringp); 01572 break; 01573 01574 default: 01575 bad_stab (orig); 01576 return DEBUG_TYPE_NULL; 01577 } 01578 01579 if (dtype == DEBUG_TYPE_NULL) 01580 return DEBUG_TYPE_NULL; 01581 01582 if (typenums[0] != -1) 01583 { 01584 if (! stab_record_type (dhandle, info, typenums, dtype)) 01585 return DEBUG_TYPE_NULL; 01586 } 01587 01588 if (size != -1) 01589 { 01590 if (! debug_record_type_size (dhandle, dtype, (unsigned int) size)) 01591 return DEBUG_TYPE_NULL; 01592 } 01593 01594 return dtype; 01595 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean parse_stab_type_number | ( | char ** | pp, | |
| int * | typenums | |||
| ) | const [static] |
Definition at line 1603 of file stabs.c.
References bad_stab(), int(), NULL, and parse_number().
Referenced by parse_stab_array_type(), parse_stab_range_type(), parse_stab_tilde_field(), and parse_stab_type().
01606 { 01607 const char *orig; 01608 01609 orig = *pp; 01610 01611 if (**pp != '(') 01612 { 01613 typenums[0] = 0; 01614 typenums[1] = (int) parse_number (pp, (boolean *) NULL); 01615 } 01616 else 01617 { 01618 ++*pp; 01619 typenums[0] = (int) parse_number (pp, (boolean *) NULL); 01620 if (**pp != ',') 01621 { 01622 bad_stab (orig); 01623 return false; 01624 } 01625 ++*pp; 01626 typenums[1] = (int) parse_number (pp, (boolean *) NULL); 01627 if (**pp != ')') 01628 { 01629 bad_stab (orig); 01630 return false; 01631 } 01632 ++*pp; 01633 } 01634 01635 return true; 01636 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static const char* pop_bincl | ( | struct stab_handle * | info | ) | [static] |
Definition at line 3197 of file stabs.c.
References bincl_file::file, bincl_file::file_types, bincl_file::next_stack, and NULL.
Referenced by parse_stab().
03199 { 03200 struct bincl_file *o; 03201 03202 o = info->bincl_stack; 03203 if (o == NULL) 03204 return info->main_filename; 03205 info->bincl_stack = o->next_stack; 03206 03207 o->file_types = info->file_types[o->file]; 03208 03209 if (info->bincl_stack == NULL) 03210 return info->main_filename; 03211 return info->bincl_stack->name; 03212 }
Here is the caller graph for this function:

| static void push_bincl | ( | struct stab_handle * | info, | |
| const char * | name, | |||
| bfd_vma | hash | |||
| ) | [static] |
Definition at line 3168 of file stabs.c.
References n, NULL, xmalloc(), and xrealloc().
Referenced by parse_stab().
03172 { 03173 struct bincl_file *n; 03174 03175 n = (struct bincl_file *) xmalloc (sizeof *n); 03176 n->next = info->bincl_list; 03177 n->next_stack = info->bincl_stack; 03178 n->name = name; 03179 n->hash = hash; 03180 n->file = info->files; 03181 n->file_types = NULL; 03182 info->bincl_list = n; 03183 info->bincl_stack = n; 03184 03185 ++info->files; 03186 info->file_types = ((struct stab_types **) 03187 xrealloc ((PTR) info->file_types, 03188 (info->files 03189 * sizeof *info->file_types))); 03190 info->file_types[n->file] = NULL; 03191 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static char* savestring | ( | char * | start, | |
| int | len | |||
| ) | const [static] |
| static void stab_bad_demangle | ( | char * | s | ) | const [static] |
Definition at line 3711 of file stabs.c.
Referenced by stab_demangle_args(), stab_demangle_class(), stab_demangle_fund_type(), stab_demangle_prefix(), stab_demangle_qualified(), stab_demangle_signature(), stab_demangle_template(), and stab_demangle_type().
Here is the caller graph for this function:

| static boolean stab_demangle_arg | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp, | |||
| debug_type ** | pargs, | |||
| unsigned int * | pcount, | |||
| unsigned int * | palloc | |||
| ) | [static] |
Definition at line 4516 of file stabs.c.
References DEBUG_TYPE_NULL, NULL, stab_demangle_remember_type(), stab_demangle_type(), start(), and xrealloc().
Referenced by stab_demangle_args().
04522 { 04523 const char *start; 04524 debug_type type; 04525 04526 start = *pp; 04527 if (! stab_demangle_type (minfo, pp, 04528 pargs == NULL ? (debug_type *) NULL : &type) 04529 || ! stab_demangle_remember_type (minfo, start, *pp - start)) 04530 return false; 04531 04532 if (pargs != NULL) 04533 { 04534 if (type == DEBUG_TYPE_NULL) 04535 return false; 04536 04537 if (*pcount + 1 >= *palloc) 04538 { 04539 *palloc += 10; 04540 *pargs = ((debug_type *) 04541 xrealloc (*pargs, *palloc * sizeof **pargs)); 04542 } 04543 (*pargs)[*pcount] = type; 04544 ++*pcount; 04545 } 04546 04547 return true; 04548 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_args | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp, | |||
| debug_type ** | pargs, | |||
| boolean * | pvarargs | |||
| ) | [static] |
Definition at line 4433 of file stabs.c.
References count, DEBUG_TYPE_NULL, NULL, stab_bad_demangle(), stab_demangle_arg(), stab_demangle_get_count(), and xmalloc().
Referenced by stab_demangle_signature(), and stab_demangle_type().
04438 { 04439 const char *orig; 04440 unsigned int alloc, count; 04441 04442 orig = *pp; 04443 04444 alloc = 10; 04445 if (pargs != NULL) 04446 { 04447 *pargs = (debug_type *) xmalloc (alloc * sizeof **pargs); 04448 *pvarargs = false; 04449 } 04450 count = 0; 04451 04452 while (**pp != '_' && **pp != '\0' && **pp != 'e') 04453 { 04454 if (**pp == 'N' || **pp == 'T') 04455 { 04456 char temptype; 04457 unsigned int r, t; 04458 04459 temptype = **pp; 04460 ++*pp; 04461 04462 if (temptype == 'T') 04463 r = 1; 04464 else 04465 { 04466 if (! stab_demangle_get_count (pp, &r)) 04467 { 04468 stab_bad_demangle (orig); 04469 return false; 04470 } 04471 } 04472 04473 if (! stab_demangle_get_count (pp, &t)) 04474 { 04475 stab_bad_demangle (orig); 04476 return false; 04477 } 04478 04479 if (t >= minfo->typestring_count) 04480 { 04481 stab_bad_demangle (orig); 04482 return false; 04483 } 04484 while (r-- > 0) 04485 { 04486 const char *tem; 04487 04488 tem = minfo->typestrings[t].typestring; 04489 if (! stab_demangle_arg (minfo, &tem, pargs, &count, &alloc)) 04490 return false; 04491 } 04492 } 04493 else 04494 { 04495 if (! stab_demangle_arg (minfo, pp, pargs, &count, &alloc)) 04496 return false; 04497 } 04498 } 04499 04500 if (pargs != NULL) 04501 (*pargs)[count] = DEBUG_TYPE_NULL; 04502 04503 if (**pp == 'e') 04504 { 04505 if (pargs != NULL) 04506 *pvarargs = true; 04507 ++*pp; 04508 } 04509 04510 return true; 04511 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type* stab_demangle_argtypes | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char * | physname, | |||
| boolean * | pvarargs | |||
| ) | [static] |
Definition at line 3776 of file stabs.c.
References stab_demangle_info::args, stab_demangle_info::dhandle, free, stab_demangle_info::info, NULL, stab_demangle_prefix(), stab_demangle_signature(), stab_demangle_info::typestring_alloc, stab_demangle_info::typestring_count, stab_demangle_info::typestrings, stab_demangle_info::varargs, and xmalloc().
Referenced by parse_stab_argtypes().
03781 { 03782 struct stab_demangle_info minfo; 03783 03784 minfo.dhandle = dhandle; 03785 minfo.info = info; 03786 minfo.args = NULL; 03787 minfo.varargs = false; 03788 minfo.typestring_alloc = 10; 03789 minfo.typestrings = ((struct stab_demangle_typestring *) 03790 xmalloc (minfo.typestring_alloc 03791 * sizeof *minfo.typestrings)); 03792 minfo.typestring_count = 0; 03793 03794 /* cplus_demangle checks for special GNU mangled forms, but we can't 03795 see any of them in mangled method argument types. */ 03796 03797 if (! stab_demangle_prefix (&minfo, &physname)) 03798 goto error_return; 03799 03800 if (*physname != '\0') 03801 { 03802 if (! stab_demangle_signature (&minfo, &physname)) 03803 goto error_return; 03804 } 03805 03806 free (minfo.typestrings); 03807 minfo.typestrings = NULL; 03808 03809 if (minfo.args == NULL) 03810 fprintf (stderr, "no argument types in mangled string\n"); 03811 03812 *pvarargs = minfo.varargs; 03813 return minfo.args; 03814 03815 error_return: 03816 if (minfo.typestrings != NULL) 03817 free (minfo.typestrings); 03818 return NULL; 03819 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_class | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp, | |||
| const char ** | pstart | |||
| ) | [static] |
Definition at line 4404 of file stabs.c.
References n, NULL, stab_bad_demangle(), stab_demangle_count(), and strlen().
Referenced by stab_demangle_fund_type(), and stab_demangle_signature().
04408 { 04409 const char *orig; 04410 unsigned int n; 04411 04412 orig = *pp; 04413 04414 n = stab_demangle_count (pp); 04415 if (strlen (*pp) < n) 04416 { 04417 stab_bad_demangle (orig); 04418 return false; 04419 } 04420 04421 if (pstart != NULL) 04422 *pstart = *pp; 04423 04424 *pp += n; 04425 04426 return true; 04427 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static unsigned int stab_demangle_count | ( | char ** | pp | ) | const [static] |
Definition at line 3720 of file stabs.c.
References count.
Referenced by stab_demangle_class(), stab_demangle_qualified(), stab_demangle_template(), and stab_demangle_type().
03722 { 03723 unsigned int count; 03724 03725 count = 0; 03726 while (isdigit ((unsigned char) **pp)) 03727 { 03728 count *= 10; 03729 count += **pp - '0'; 03730 ++*pp; 03731 } 03732 return count; 03733 }
Here is the caller graph for this function:

| static boolean stab_demangle_function_name | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp, | |||
| const char * | scan | |||
| ) | [static] |
Definition at line 3899 of file stabs.c.
References name, NULL, and stab_demangle_type().
Referenced by stab_demangle_prefix().
03903 { 03904 const char *name; 03905 03906 /* The string from *pp to scan is the name of the function. We 03907 don't care about the name, since we just looking for argument 03908 types. However, for conversion operators, the name may include a 03909 type which we must remember in order to handle backreferences. */ 03910 03911 name = *pp; 03912 *pp = scan + 2; 03913 03914 if (*pp - name >= 5 03915 && strncmp (name, "type", 4) == 0 03916 && (name[4] == '$' || name[4] == '.')) 03917 { 03918 const char *tem; 03919 03920 /* This is a type conversion operator. */ 03921 tem = name + 5; 03922 if (! stab_demangle_type (minfo, &tem, (debug_type *) NULL)) 03923 return false; 03924 } 03925 else if (name[0] == '_' 03926 && name[1] == '_' 03927 && name[2] == 'o' 03928 && name[3] == 'p') 03929 { 03930 const char *tem; 03931 03932 /* This is a type conversion operator. */ 03933 tem = name + 4; 03934 if (! stab_demangle_type (minfo, &tem, (debug_type *) NULL)) 03935 return false; 03936 } 03937 03938 return true; 03939 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_fund_type | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp, | |||
| debug_type * | ptype | |||
| ) | [static] |
Definition at line 4809 of file stabs.c.
References debug_find_named_type(), DEBUG_KIND_ILLEGAL, debug_make_bool_type(), debug_make_const_type(), debug_make_float_type(), debug_make_int_type(), debug_make_pointer_type(), debug_make_void_type(), debug_make_volatile_type(), debug_name_type(), DEBUG_TYPE_NULL, free, name, NULL, savestring, stab_bad_demangle(), stab_demangle_class(), stab_demangle_template(), and stab_find_tagged_type().
Referenced by stab_demangle_type().
04813 { 04814 const char *orig; 04815 boolean constp, volatilep, unsignedp, signedp; 04816 boolean done; 04817 04818 orig = *pp; 04819 04820 constp = false; 04821 volatilep = false; 04822 unsignedp = false; 04823 signedp = false; 04824 04825 done = false; 04826 while (! done) 04827 { 04828 switch (**pp) 04829 { 04830 case 'C': 04831 constp = true; 04832 ++*pp; 04833 break; 04834 04835 case 'U': 04836 unsignedp = true; 04837 ++*pp; 04838 break; 04839 04840 case 'S': 04841 signedp = true; 04842 ++*pp; 04843 break; 04844 04845 case 'V': 04846 volatilep = true; 04847 ++*pp; 04848 break; 04849 04850 default: 04851 done = true; 04852 break; 04853 } 04854 } 04855 04856 switch (**pp) 04857 { 04858 case '\0': 04859 case '_': 04860 /* cplus_demangle permits this, but I don't know what it means. */ 04861 stab_bad_demangle (orig); 04862 break; 04863 04864 case 'v': /* void */ 04865 if (ptype != NULL) 04866 { 04867 *ptype = debug_find_named_type (minfo->dhandle, "void"); 04868 if (*ptype == DEBUG_TYPE_NULL) 04869 *ptype = debug_make_void_type (minfo->dhandle); 04870 } 04871 ++*pp; 04872 break; 04873 04874 case 'x': /* long long */ 04875 if (ptype != NULL) 04876 { 04877 *ptype = debug_find_named_type (minfo->dhandle, 04878 (unsignedp 04879 ? "long long unsigned int" 04880 : "long long int")); 04881 if (*ptype == DEBUG_TYPE_NULL) 04882 *ptype = debug_make_int_type (minfo->dhandle, 8, unsignedp); 04883 } 04884 ++*pp; 04885 break; 04886 04887 case 'l': /* long */ 04888 if (ptype != NULL) 04889 { 04890 *ptype = debug_find_named_type (minfo->dhandle, 04891 (unsignedp 04892 ? "long unsigned int" 04893 : "long int")); 04894 if (*ptype == DEBUG_TYPE_NULL) 04895 *ptype = debug_make_int_type (minfo->dhandle, 4, unsignedp); 04896 } 04897 ++*pp; 04898 break; 04899 04900 case 'i': /* int */ 04901 if (ptype != NULL) 04902 { 04903 *ptype = debug_find_named_type (minfo->dhandle, 04904 (unsignedp 04905 ? "unsigned int" 04906 : "int")); 04907 if (*ptype == DEBUG_TYPE_NULL) 04908 *ptype = debug_make_int_type (minfo->dhandle, 4, unsignedp); 04909 } 04910 ++*pp; 04911 break; 04912 04913 case 's': /* short */ 04914 if (ptype != NULL) 04915 { 04916 *ptype = debug_find_named_type (minfo->dhandle, 04917 (unsignedp 04918 ? "short unsigned int" 04919 : "short int")); 04920 if (*ptype == DEBUG_TYPE_NULL) 04921 *ptype = debug_make_int_type (minfo->dhandle, 2, unsignedp); 04922 } 04923 ++*pp; 04924 break; 04925 04926 case 'b': /* bool */ 04927 if (ptype != NULL) 04928 { 04929 *ptype = debug_find_named_type (minfo->dhandle, "bool"); 04930 if (*ptype == DEBUG_TYPE_NULL) 04931 *ptype = debug_make_bool_type (minfo->dhandle, 4); 04932 } 04933 ++*pp; 04934 break; 04935 04936 case 'c': /* char */ 04937 if (ptype != NULL) 04938 { 04939 *ptype = debug_find_named_type (minfo->dhandle, 04940 (unsignedp 04941 ? "unsigned char" 04942 : (signedp 04943 ? "signed char" 04944 : "char"))); 04945 if (*ptype == DEBUG_TYPE_NULL) 04946 *ptype = debug_make_int_type (minfo->dhandle, 1, unsignedp); 04947 } 04948 ++*pp; 04949 break; 04950 04951 case 'w': /* wchar_t */ 04952 if (ptype != NULL) 04953 { 04954 *ptype = debug_find_named_type (minfo->dhandle, "__wchar_t"); 04955 if (*ptype == DEBUG_TYPE_NULL) 04956 *ptype = debug_make_int_type (minfo->dhandle, 2, true); 04957 } 04958 ++*pp; 04959 break; 04960 04961 case 'r': /* long double */ 04962 if (ptype != NULL) 04963 { 04964 *ptype = debug_find_named_type (minfo->dhandle, "long double"); 04965 if (*ptype == DEBUG_TYPE_NULL) 04966 *ptype = debug_make_float_type (minfo->dhandle, 8); 04967 } 04968 ++*pp; 04969 break; 04970 04971 case 'd': /* double */ 04972 if (ptype != NULL) 04973 { 04974 *ptype = debug_find_named_type (minfo->dhandle, "double"); 04975 if (*ptype == DEBUG_TYPE_NULL) 04976 *ptype = debug_make_float_type (minfo->dhandle, 8); 04977 } 04978 ++*pp; 04979 break; 04980 04981 case 'f': /* float */ 04982 if (ptype != NULL) 04983 { 04984 *ptype = debug_find_named_type (minfo->dhandle, "float"); 04985 if (*ptype == DEBUG_TYPE_NULL) 04986 *ptype = debug_make_float_type (minfo->dhandle, 4); 04987 } 04988 ++*pp; 04989 break; 04990 04991 case 'G': 04992 ++*pp; 04993 if (! isdigit ((unsigned char) **pp)) 04994 { 04995 stab_bad_demangle (orig); 04996 return false; 04997 } 04998 /* Fall through. */ 04999 case '0': case '1': case '2': case '3': case '4': 05000 case '5': case '6': case '7': case '8': case '9': 05001 { 05002 const char *hold; 05003 05004 if (! stab_demangle_class (minfo, pp, &hold)) 05005 return false; 05006 if (ptype != NULL) 05007 { 05008 char *name; 05009 05010 name = savestring (hold, *pp - hold); 05011 *ptype = debug_find_named_type (minfo->dhandle, name); 05012 if (*ptype == DEBUG_TYPE_NULL) 05013 { 05014 /* FIXME: It is probably incorrect to assume that 05015 undefined types are tagged types. */ 05016 *ptype = stab_find_tagged_type (minfo->dhandle, minfo->info, 05017 hold, *pp - hold, 05018 DEBUG_KIND_ILLEGAL); 05019 } 05020 free (name); 05021 } 05022 } 05023 break; 05024 05025 case 't': 05026 if (! stab_demangle_template (minfo, pp)) 05027 return false; 05028 if (ptype != NULL) 05029 { 05030 debug_type t; 05031 05032 /* FIXME: I really don't know how a template should be 05033 represented in the current type system. Perhaps the 05034 template should be demangled into a string, and the type 05035 should be represented as a named type. However, I don't 05036 know what the base type of the named type should be. */ 05037 t = debug_make_void_type (minfo->dhandle); 05038 t = debug_make_pointer_type (minfo->dhandle, t); 05039 t = debug_name_type (minfo->dhandle, "TEMPLATE", t); 05040 *ptype = t; 05041 } 05042 break; 05043 05044 default: 05045 stab_bad_demangle (orig); 05046 return false; 05047 } 05048 05049 if (ptype != NULL) 05050 { 05051 if (constp) 05052 *ptype = debug_make_const_type (minfo->dhandle, *ptype); 05053 if (volatilep) 05054 *ptype = debug_make_volatile_type (minfo->dhandle, *ptype); 05055 } 05056 05057 return true; 05058 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_get_count | ( | char ** | pp, | |
| unsigned int * | pi | |||
| ) | const [static] |
Definition at line 3739 of file stabs.c.
Referenced by stab_demangle_args(), stab_demangle_template(), and stab_demangle_type().
03742 { 03743 if (! isdigit ((unsigned char) **pp)) 03744 return false; 03745 03746 *pi = **pp - '0'; 03747 ++*pp; 03748 if (isdigit ((unsigned char) **pp)) 03749 { 03750 unsigned int count; 03751 const char *p; 03752 03753 count = *pi; 03754 p = *pp; 03755 do 03756 { 03757 count *= 10; 03758 count += *p - '0'; 03759 ++p; 03760 } 03761 while (isdigit ((unsigned char) *p)); 03762 if (*p == '_') 03763 { 03764 *pp = p + 1; 03765 *pi = count; 03766 } 03767 } 03768 03769 return true; 03770 }
Here is the caller graph for this function:

| static boolean stab_demangle_prefix | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp | |||
| ) | [static] |
Definition at line 3824 of file stabs.c.
References NULL, stab_bad_demangle(), stab_demangle_function_name(), strchr(), and strstr().
Referenced by stab_demangle_argtypes().
03827 { 03828 const char *scan; 03829 unsigned int i; 03830 03831 /* cplus_demangle checks for global constructors and destructors, 03832 but we can't see them in mangled argument types. */ 03833 03834 /* Look for `__'. */ 03835 scan = *pp; 03836 do 03837 { 03838 scan = strchr (scan, '_'); 03839 } 03840 while (scan != NULL && *++scan != '_'); 03841 03842 if (scan == NULL) 03843 { 03844 stab_bad_demangle (*pp); 03845 return false; 03846 } 03847 03848 --scan; 03849 03850 /* We found `__'; move ahead to the last contiguous `__' pair. */ 03851 i = strspn (scan, "_"); 03852 if (i > 2) 03853 scan += i - 2; 03854 03855 if (scan == *pp 03856 && (isdigit ((unsigned char) scan[2]) 03857 || scan[2] == 'Q' 03858 || scan[2] == 't')) 03859 { 03860 /* This is a GNU style constructor name. */ 03861 *pp = scan + 2; 03862 return true; 03863 } 03864 else if (scan == *pp 03865 && ! isdigit ((unsigned char) scan[2]) 03866 && scan[2] != 't') 03867 { 03868 /* Look for the `__' that separates the prefix from the 03869 signature. */ 03870 while (*scan == '_') 03871 ++scan; 03872 scan = strstr (scan, "__"); 03873 if (scan == NULL || scan[2] == '\0') 03874 { 03875 stab_bad_demangle (*pp); 03876 return false; 03877 } 03878 03879 return stab_demangle_function_name (minfo, pp, scan); 03880 } 03881 else if (scan[2] != '\0') 03882 { 03883 /* The name doesn't start with `__', but it does contain `__'. */ 03884 return stab_demangle_function_name (minfo, pp, scan); 03885 } 03886 else 03887 { 03888 stab_bad_demangle (*pp); 03889 return false; 03890 } 03891 /*NOTREACHED*/ 03892 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_qualified | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp, | |||
| debug_type * | ptype | |||
| ) | [static] |
Definition at line 4061 of file stabs.c.
References atoi(), DEBUG_FIELD_NULL, debug_find_named_type(), debug_get_field_type(), debug_get_fields(), debug_get_type_name(), DEBUG_KIND_CLASS, DEBUG_KIND_ILLEGAL, DEBUG_TYPE_NULL, free, stab_demangle_typestring::len, name, NULL, p, savestring, stab_bad_demangle(), stab_demangle_count(), stab_demangle_template(), stab_find_tagged_type(), strcmp(), and strlen().
Referenced by stab_demangle_signature(), and stab_demangle_type().
04065 { 04066 const char *orig; 04067 const char *p; 04068 unsigned int qualifiers; 04069 debug_type context; 04070 04071 orig = *pp; 04072 04073 switch ((*pp)[1]) 04074 { 04075 case '_': 04076 /* GNU mangled name with more than 9 classes. The count is 04077 preceded by an underscore (to distinguish it from the <= 9 04078 case) and followed by an underscore. */ 04079 p = *pp + 2; 04080 if (! isdigit ((unsigned char) *p) || *p == '0') 04081 { 04082 stab_bad_demangle (orig); 04083 return false; 04084 } 04085 qualifiers = atoi (p); 04086 while (isdigit ((unsigned char) *p)) 04087 ++p; 04088 if (*p != '_') 04089 { 04090 stab_bad_demangle (orig); 04091 return false; 04092 } 04093 *pp = p + 1; 04094 break; 04095 04096 case '1': case '2': case '3': case '4': case '5': 04097 case '6': case '7': case '8': case '9': 04098 qualifiers = (*pp)[1] - '0'; 04099 /* Skip an optional underscore after the count. */ 04100 if ((*pp)[2] == '_') 04101 ++*pp; 04102 *pp += 2; 04103 break; 04104 04105 case '0': 04106 default: 04107 stab_bad_demangle (orig); 04108 return false; 04109 } 04110 04111 context = DEBUG_TYPE_NULL; 04112 04113 /* Pick off the names. */ 04114 while (qualifiers-- > 0) 04115 { 04116 if (**pp == '_') 04117 ++*pp; 04118 if (**pp == 't') 04119 { 04120 /* FIXME: I don't know how to handle the ptype != NULL case 04121 here. */ 04122 if (! stab_demangle_template (minfo, pp)) 04123 return false; 04124 } 04125 else 04126 { 04127 unsigned int len; 04128 04129 len = stab_demangle_count (pp); 04130 if (strlen (*pp) < len) 04131 { 04132 stab_bad_demangle (orig); 04133 return false; 04134 } 04135 04136 if (ptype != NULL) 04137 { 04138 const debug_field *fields; 04139 04140 fields = NULL; 04141 if (context != DEBUG_TYPE_NULL) 04142 fields = debug_get_fields (minfo->dhandle, context); 04143 04144 context = DEBUG_TYPE_NULL; 04145 04146 if (fields != NULL) 04147 { 04148 char *name; 04149 04150 /* Try to find the type by looking through the 04151 fields of context until we find a field with the 04152 same type. This ought to work for a class 04153 defined within a class, but it won't work for, 04154 e.g., an enum defined within a class. stabs does 04155 not give us enough information to figure out the 04156 latter case. */ 04157 04158 name = savestring (*pp, len); 04159 04160 for (; *fields != DEBUG_FIELD_NULL; fields++) 04161 { 04162 debug_type ft; 04163 const char *dn; 04164 04165 ft = debug_get_field_type (minfo->dhandle, *fields); 04166 if (ft == NULL) 04167 return false; 04168 dn = debug_get_type_name (minfo->dhandle, ft); 04169 if (dn != NULL && strcmp (dn, name) == 0) 04170 { 04171 context = ft; 04172 break; 04173 } 04174 } 04175 04176 free (name); 04177 } 04178 04179 if (context == DEBUG_TYPE_NULL) 04180 { 04181 /* We have to fall back on finding the type by name. 04182 If there are more types to come, then this must 04183 be a class. Otherwise, it could be anything. */ 04184 04185 if (qualifiers == 0) 04186 { 04187 char *name; 04188 04189 name = savestring (*pp, len); 04190 context = debug_find_named_type (minfo->dhandle, 04191 name); 04192 free (name); 04193 } 04194 04195 if (context == DEBUG_TYPE_NULL) 04196 { 04197 context = stab_find_tagged_type (minfo->dhandle, 04198 minfo->info, 04199 *pp, len, 04200 (qualifiers == 0 04201 ? DEBUG_KIND_ILLEGAL 04202 : DEBUG_KIND_CLASS)); 04203 if (context == DEBUG_TYPE_NULL) 04204 return false; 04205 } 04206 } 04207 } 04208 04209 *pp += len; 04210 } 04211 } 04212 04213 if (ptype != NULL) 04214 *ptype = context; 04215 04216 return true; 04217 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_remember_type | ( | struct stab_demangle_info * | minfo, | |
| const char * | p, | |||
| int | len | |||
| ) | [static] |
Definition at line 5063 of file stabs.c.
References int(), and xrealloc().
Referenced by stab_demangle_arg(), and stab_demangle_signature().
05067 { 05068 if (minfo->typestring_count >= minfo->typestring_alloc) 05069 { 05070 minfo->typestring_alloc += 10; 05071 minfo->typestrings = ((struct stab_demangle_typestring *) 05072 xrealloc (minfo->typestrings, 05073 (minfo->typestring_alloc 05074 * sizeof *minfo->typestrings))); 05075 } 05076 05077 minfo->typestrings[minfo->typestring_count].typestring = p; 05078 minfo->typestrings[minfo->typestring_count].len = (unsigned int) len; 05079 ++minfo->typestring_count; 05080 05081 return true; 05082 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_signature | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp | |||
| ) | [static] |
Definition at line 3945 of file stabs.c.
References NULL, stab_bad_demangle(), stab_demangle_args(), stab_demangle_class(), stab_demangle_qualified(), stab_demangle_remember_type(), and stab_demangle_template().
Referenced by stab_demangle_argtypes().
03948 { 03949 const char *orig; 03950 boolean expect_func, func_done; 03951 const char *hold; 03952 03953 orig = *pp; 03954 03955 expect_func = false; 03956 func_done = false; 03957 hold = NULL; 03958 03959 while (**pp != '\0') 03960 { 03961 switch (**pp) 03962 { 03963 case 'Q': 03964 hold = *pp; 03965 if (! stab_demangle_qualified (minfo, pp, (debug_type *) NULL) 03966 || ! stab_demangle_remember_type (minfo, hold, *pp - hold)) 03967 return false; 03968 expect_func = true; 03969 hold = NULL; 03970 break; 03971 03972 case 'S': 03973 /* Static member function. FIXME: Can this happen? */ 03974 if (hold == NULL) 03975 hold = *pp; 03976 ++*pp; 03977 break; 03978 03979 case 'C': 03980 /* Const member function. */ 03981 if (hold == NULL) 03982 hold = *pp; 03983 ++*pp; 03984 break; 03985 03986 case '0': case '1': case '2': case '3': case '4': 03987 case '5': case '6': case '7': case '8': case '9': 03988 if (hold == NULL) 03989 hold = *pp; 03990 if (! stab_demangle_class (minfo, pp, (const char **) NULL) 03991 || ! stab_demangle_remember_type (minfo, hold, *pp - hold)) 03992 return false; 03993 expect_func = true; 03994 hold = NULL; 03995 break; 03996 03997 case 'F': 03998 /* Function. I don't know if this actually happens with g++ 03999 output. */ 04000 hold = NULL; 04001 func_done = true; 04002 ++*pp; 04003 if (! stab_demangle_args (minfo, pp, &minfo->args, &minfo->varargs)) 04004 return false; 04005 break; 04006 04007 case 't': 04008 /* Template. */ 04009 if (hold == NULL) 04010 hold = *pp; 04011 if (! stab_demangle_template (minfo, pp) 04012 || ! stab_demangle_remember_type (minfo, hold, *pp - hold)) 04013 return false; 04014 hold = NULL; 04015 expect_func = true; 04016 break; 04017 04018 case '_': 04019 /* At the outermost level, we cannot have a return type 04020 specified, so if we run into another '_' at this point we 04021 are dealing with a mangled name that is either bogus, or 04022 has been mangled by some algorithm we don't know how to 04023 deal with. So just reject the entire demangling. */ 04024 stab_bad_demangle (orig); 04025 return false; 04026 04027 default: 04028 /* Assume we have stumbled onto the first outermost function 04029 argument token, and start processing args. */ 04030 func_done = true; 04031 if (! stab_demangle_args (minfo, pp, &minfo->args, &minfo->varargs)) 04032 return false; 04033 break; 04034 } 04035 04036 if (expect_func) 04037 { 04038 func_done = true; 04039 if (! stab_demangle_args (minfo, pp, &minfo->args, &minfo->varargs)) 04040 return false; 04041 } 04042 } 04043 04044 if (! func_done) 04045 { 04046 /* With GNU style demangling, bar__3foo is 'foo::bar(void)', and 04047 bar__3fooi is 'foo::bar(int)'. We get here when we find the 04048 first case, and need to ensure that the '(void)' gets added 04049 to the current declp. */ 04050 if (! stab_demangle_args (minfo, pp, &minfo->args, &minfo->varargs)) 04051 return false; 04052 } 04053 04054 return true; 04055 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_template | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp | |||
| ) | [static] |
Definition at line 4222 of file stabs.c.
References abort(), stab_demangle_typestring::len, NULL, stab_bad_demangle(), stab_demangle_count(), stab_demangle_get_count(), stab_demangle_type(), and strlen().
Referenced by stab_demangle_fund_type(), stab_demangle_qualified(), and stab_demangle_signature().
04225 { 04226 const char *orig; 04227 unsigned int r, i; 04228 04229 orig = *pp; 04230 04231 ++*pp; 04232 04233 /* Skip the template name. */ 04234 r = stab_demangle_count (pp); 04235 if (r == 0 || strlen (*pp) < r) 04236 { 04237 stab_bad_demangle (orig); 04238 return false; 04239 } 04240 *pp += r; 04241 04242 /* Get the size of the parameter list. */ 04243 if (stab_demangle_get_count (pp, &r) == 0) 04244 { 04245 stab_bad_demangle (orig); 04246 return false; 04247 } 04248 04249 for (i = 0; i < r; i++) 04250 { 04251 if (**pp == 'Z') 04252 { 04253 /* This is a type parameter. */ 04254 ++*pp; 04255 if (! stab_demangle_type (minfo, pp, (debug_type *) NULL)) 04256 return false; 04257 } 04258 else 04259 { 04260 const char *old_p; 04261 boolean pointerp, realp, integralp, charp, boolp; 04262 boolean done; 04263 04264 old_p = *pp; 04265 pointerp = false; 04266 realp = false; 04267 integralp = false; 04268 charp = false; 04269 boolp = false; 04270 done = false; 04271 04272 /* This is a value parameter. */ 04273 04274 if (! stab_demangle_type (minfo, pp, (debug_type *) NULL)) 04275 return false; 04276 04277 while (*old_p != '\0' && ! done) 04278 { 04279 switch (*old_p) 04280 { 04281 case 'P': 04282 case 'p': 04283 case 'R': 04284 pointerp = true; 04285 done = true; 04286 break; 04287 case 'C': /* Const. */ 04288 case 'S': /* Signed. */ 04289 case 'U': /* Unsigned. */ 04290 case 'V': /* Volatile. */ 04291 case 'F': /* Function. */ 04292 case 'M': /* Member function. */ 04293 case 'O': /* ??? */ 04294 ++old_p; 04295 break; 04296 case 'Q': /* Qualified name. */ 04297 integralp = true; 04298 done = true; 04299 break; 04300 case 'T': /* Remembered type. */ 04301 abort (); 04302 case 'v': /* Void. */ 04303 abort (); 04304 case 'x': /* Long long. */ 04305 case 'l': /* Long. */ 04306 case 'i': /* Int. */ 04307 case 's': /* Short. */ 04308 case 'w': /* Wchar_t. */ 04309 integralp = true; 04310 done = true; 04311 break; 04312 case 'b': /* Bool. */ 04313 boolp = true; 04314 done = true; 04315 break; 04316 case 'c': /* Char. */ 04317 charp = true; 04318 done = true; 04319 break; 04320 case 'r': /* Long double. */ 04321 case 'd': /* Double. */ 04322 case 'f': /* Float. */ 04323 realp = true; 04324 done = true; 04325 break; 04326 default: 04327 /* Assume it's a user defined integral type. */ 04328 integralp = true; 04329 done = true; 04330 break; 04331 } 04332 } 04333 04334 if (integralp) 04335 { 04336 if (**pp == 'm') 04337 ++*pp; 04338 while (isdigit ((unsigned char) **pp)) 04339 ++*pp; 04340 } 04341 else if (charp) 04342 { 04343 unsigned int val; 04344 04345 if (**pp == 'm') 04346 ++*pp; 04347 val = stab_demangle_count (pp); 04348 if (val == 0) 04349 { 04350 stab_bad_demangle (orig); 04351 return false; 04352 } 04353 } 04354 else if (boolp) 04355 { 04356 unsigned int val; 04357 04358 val = stab_demangle_count (pp); 04359 if (val != 0 && val != 1) 04360 { 04361 stab_bad_demangle (orig); 04362 return false; 04363 } 04364 } 04365 else if (realp) 04366 { 04367 if (**pp == 'm') 04368 ++*pp; 04369 while (isdigit ((unsigned char) **pp)) 04370 ++*pp; 04371 if (**pp == '.') 04372 { 04373 ++*pp; 04374 while (isdigit ((unsigned char) **pp)) 04375 ++*pp; 04376 } 04377 if (**pp == 'e') 04378 { 04379 ++*pp; 04380 while (isdigit ((unsigned char) **pp)) 04381 ++*pp; 04382 } 04383 } 04384 else if (pointerp) 04385 { 04386 unsigned int len; 04387 04388 if (! stab_demangle_get_count (pp, &len)) 04389 { 04390 stab_bad_demangle (orig); 04391 return false; 04392 } 04393 *pp += len; 04394 } 04395 } 04396 } 04397 04398 return true; 04399 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_demangle_type | ( | struct stab_demangle_info * | minfo, | |
| const char ** | pp, | |||
| debug_type * | ptype | |||
| ) | [static] |
Definition at line 4554 of file stabs.c.
References args, debug_find_named_type(), DEBUG_KIND_CLASS, debug_make_array_type(), debug_make_const_type(), debug_make_function_type(), debug_make_int_type(), debug_make_method_type(), debug_make_offset_type(), debug_make_pointer_type(), debug_make_reference_type(), DEBUG_TYPE_NULL, n, name, NULL, p, stab_bad_demangle(), stab_demangle_args(), stab_demangle_count(), stab_demangle_fund_type(), stab_demangle_get_count(), stab_demangle_qualified(), stab_find_tagged_type(), and strlen().
Referenced by stab_demangle_arg(), stab_demangle_function_name(), and stab_demangle_template().
04558 { 04559 const char *orig; 04560 04561 orig = *pp; 04562 04563 switch (**pp) 04564 { 04565 case 'P': 04566 case 'p': 04567 /* A pointer type. */ 04568 ++*pp; 04569 if (! stab_demangle_type (minfo, pp, ptype)) 04570 return false; 04571 if (ptype != NULL) 04572 *ptype = debug_make_pointer_type (minfo->dhandle, *ptype); 04573 break; 04574 04575 case 'R': 04576 /* A reference type. */ 04577 ++*pp; 04578 if (! stab_demangle_type (minfo, pp, ptype)) 04579 return false; 04580 if (ptype != NULL) 04581 *ptype = debug_make_reference_type (minfo->dhandle, *ptype); 04582 break; 04583 04584 case 'A': 04585 /* An array. */ 04586 { 04587 unsigned long high; 04588 04589 ++*pp; 04590 high = 0; 04591 while (**pp != '\0' && **pp != '_') 04592 { 04593 if (! isdigit ((unsigned char) **pp)) 04594 { 04595 stab_bad_demangle (orig); 04596 return false; 04597 } 04598 high *= 10; 04599 high += **pp - '0'; 04600 ++*pp; 04601 } 04602 if (**pp != '_') 04603 { 04604 stab_bad_demangle (orig); 04605 return false; 04606 } 04607 ++*pp; 04608 04609 if (! stab_demangle_type (minfo, pp, ptype)) 04610 return false; 04611 if (ptype != NULL) 04612 { 04613 debug_type int_type; 04614 04615 int_type = debug_find_named_type (minfo->dhandle, "int"); 04616 if (int_type == NULL) 04617 int_type = debug_make_int_type (minfo->dhandle, 4, false); 04618 *ptype = debug_make_array_type (minfo->dhandle, *ptype, int_type, 04619 0, high, false); 04620 } 04621 } 04622 break; 04623 04624 case 'T': 04625 /* A back reference to a remembered type. */ 04626 { 04627 unsigned int i; 04628 const char *p; 04629 04630 ++*pp; 04631 if (! stab_demangle_get_count (pp, &i)) 04632 { 04633 stab_bad_demangle (orig); 04634 return false; 04635 } 04636 if (i >= minfo->typestring_count) 04637 { 04638 stab_bad_demangle (orig); 04639 return false; 04640 } 04641 p = minfo->typestrings[i].typestring; 04642 if (! stab_demangle_type (minfo, &p, ptype)) 04643 return false; 04644 } 04645 break; 04646 04647 case 'F': 04648 /* A function. */ 04649 { 04650 debug_type *args; 04651 boolean varargs; 04652 04653 ++*pp; 04654 if (! stab_demangle_args (minfo, pp, 04655 (ptype == NULL 04656 ? (debug_type **) NULL 04657 : &args), 04658 (ptype == NULL 04659 ? (boolean *) NULL 04660 : &varargs))) 04661 return false; 04662 if (**pp != '_') 04663 { 04664 /* cplus_demangle will accept a function without a return 04665 type, but I don't know when that will happen, or what 04666 to do if it does. */ 04667 stab_bad_demangle (orig); 04668 return false; 04669 } 04670 ++*pp; 04671 if (! stab_demangle_type (minfo, pp, ptype)) 04672 return false; 04673 if (ptype != NULL) 04674 *ptype = debug_make_function_type (minfo->dhandle, *ptype, args, 04675 varargs); 04676 04677 } 04678 break; 04679 04680 case 'M': 04681 case 'O': 04682 { 04683 boolean memberp, constp, volatilep; 04684 debug_type *args; 04685 boolean varargs; 04686 unsigned int n; 04687 const char *name; 04688 04689 memberp = **pp == 'M'; 04690 constp = false; 04691 volatilep = false; 04692 args = NULL; 04693 varargs = false; 04694 04695 ++*pp; 04696 if (! isdigit ((unsigned char) **pp)) 04697 { 04698 stab_bad_demangle (orig); 04699 return false; 04700 } 04701 n = stab_demangle_count (pp); 04702 if (strlen (*pp) < n) 04703 { 04704 stab_bad_demangle (orig); 04705 return false; 04706 } 04707 name = *pp; 04708 *pp += n; 04709 04710 if (memberp) 04711 { 04712 if (**pp == 'C') 04713 { 04714 constp = true; 04715 ++*pp; 04716 } 04717 else if (**pp == 'V') 04718 { 04719 volatilep = true; 04720 ++*pp; 04721 } 04722 if (**pp != 'F') 04723 { 04724 stab_bad_demangle (orig); 04725 return false; 04726 } 04727 ++*pp; 04728 if (! stab_demangle_args (minfo, pp, 04729 (ptype == NULL 04730 ? (debug_type **) NULL 04731 : &args), 04732 (ptype == NULL 04733 ? (boolean *) NULL 04734 : &varargs))) 04735 return false; 04736 } 04737 04738 if (**pp != '_') 04739 { 04740 stab_bad_demangle (orig); 04741 return false; 04742 } 04743 ++*pp; 04744 04745 if (! stab_demangle_type (minfo, pp, ptype)) 04746 return false; 04747 04748 if (ptype != NULL) 04749 { 04750 debug_type class_type; 04751 04752 class_type = stab_find_tagged_type (minfo->dhandle, minfo->info, 04753 name, (int) n, 04754 DEBUG_KIND_CLASS); 04755 if (class_type == DEBUG_TYPE_NULL) 04756 return false; 04757 04758 if (! memberp) 04759 *ptype = debug_make_offset_type (minfo->dhandle, class_type, 04760 *ptype); 04761 else 04762 { 04763 /* FIXME: We have no way to record constp or 04764 volatilep. */ 04765 *ptype = debug_make_method_type (minfo->dhandle, *ptype, 04766 class_type, args, varargs); 04767 } 04768 } 04769 } 04770 break; 04771 04772 case 'G': 04773 ++*pp; 04774 if (! stab_demangle_type (minfo, pp, ptype)) 04775 return false; 04776 break; 04777 04778 case 'C': 04779 ++*pp; 04780 if (! stab_demangle_type (minfo, pp, ptype)) 04781 return false; 04782 if (ptype != NULL) 04783 *ptype = debug_make_const_type (minfo->dhandle, *ptype); 04784 break; 04785 04786 case 'Q': 04787 { 04788 const char *hold; 04789 04790 hold = *pp; 04791 if (! stab_demangle_qualified (minfo, pp, ptype)) 04792 return false; 04793 } 04794 break; 04795 04796 default: 04797 if (! stab_demangle_fund_type (minfo, pp, ptype)) 04798 return false; 04799 break; 04800 } 04801 04802 return true; 04803 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_emit_pending_vars | ( | PTR | dhandle, | |
| struct stab_handle * | info | |||
| ) | [static] |
Definition at line 3283 of file stabs.c.
References debug_record_variable(), free, stab_pending_var::kind, stab_pending_var::name, stab_pending_var::next, NULL, stab_handle::pending, stab_pending_var::type, and stab_pending_var::val.
Referenced by finish_stab(), and parse_stab().
03286 { 03287 struct stab_pending_var *v; 03288 03289 v = info->pending; 03290 while (v != NULL) 03291 { 03292 struct stab_pending_var *next; 03293 03294 if (! debug_record_variable (dhandle, v->name, v->type, v->kind, v->val)) 03295 return false; 03296 03297 next = v->next; 03298 free (v); 03299 v = next; 03300 } 03301 03302 info->pending = NULL; 03303 03304 return true; 03305 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type* stab_find_slot | ( | struct stab_handle * | info, | |
| const int * | typenums | |||
| ) | [static] |
Definition at line 3310 of file stabs.c.
References index(), memset, stab_types::next, NULL, STAB_TYPES_SLOTS, and xmalloc().
Referenced by parse_stab_type(), stab_find_type(), and stab_record_type().
03313 { 03314 int filenum; 03315 int index; 03316 struct stab_types **ps; 03317 03318 filenum = typenums[0]; 03319 index = typenums[1]; 03320 03321 if (filenum < 0 || (unsigned int) filenum >= info->files) 03322 { 03323 fprintf (stderr, "Type file number %d out of range\n", filenum); 03324 return NULL; 03325 } 03326 if (index < 0) 03327 { 03328 fprintf (stderr, "Type index number %d out of range\n", index); 03329 return NULL; 03330 } 03331 03332 ps = info->file_types + filenum; 03333 03334 while (index >= STAB_TYPES_SLOTS) 03335 { 03336 if (*ps == NULL) 03337 { 03338 *ps = (struct stab_types *) xmalloc (sizeof **ps); 03339 memset (*ps, 0, sizeof **ps); 03340 } 03341 ps = &(*ps)->next; 03342 index -= STAB_TYPES_SLOTS; 03343 } 03344 if (*ps == NULL) 03345 { 03346 *ps = (struct stab_types *) xmalloc (sizeof **ps); 03347 memset (*ps, 0, sizeof **ps); 03348 } 03349 03350 return (*ps)->types + index; 03351 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type stab_find_tagged_type | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char * | p, | |||
| int | len, | |||
| enum debug_type_kind | kind | |||
| ) | [static] |
Definition at line 3584 of file stabs.c.
References debug_find_tagged_type(), DEBUG_KIND_ILLEGAL, debug_make_indirect_type(), DEBUG_TYPE_NULL, free, stab_tag::kind, memset, stab_tag::name, name, stab_tag::next, NULL, savestring, strcmp(), stab_handle::tags, stab_tag::type, and xmalloc().
Referenced by parse_stab_type(), stab_demangle_fund_type(), stab_demangle_qualified(), and stab_demangle_type().
03590 { 03591 char *name; 03592 debug_type dtype; 03593 struct stab_tag *st; 03594 03595 name = savestring (p, len); 03596 03597 /* We pass DEBUG_KIND_ILLEGAL because we want all tags in the same 03598 namespace. This is right for C, and I don't know how to handle 03599 other languages. FIXME. */ 03600 dtype = debug_find_tagged_type (dhandle, name, DEBUG_KIND_ILLEGAL); 03601 if (dtype != DEBUG_TYPE_NULL) 03602 { 03603 free (name); 03604 return dtype; 03605 } 03606 03607 /* We need to allocate an entry on the undefined tag list. */ 03608 for (st = info->tags; st != NULL; st = st->next) 03609 { 03610 if (st->name[0] == name[0] 03611 && strcmp (st->name, name) == 0) 03612 { 03613 if (st->kind == DEBUG_KIND_ILLEGAL) 03614 st->kind = kind; 03615 free (name); 03616 break; 03617 } 03618 } 03619 if (st == NULL) 03620 { 03621 st = (struct stab_tag *) xmalloc (sizeof *st); 03622 memset (st, 0, sizeof *st); 03623 03624 st->next = info->tags; 03625 st->name = name; 03626 st->kind = kind; 03627 st->slot = DEBUG_TYPE_NULL; 03628 st->type = debug_make_indirect_type (dhandle, &st->slot, name); 03629 info->tags = st; 03630 } 03631 03632 return st->type; 03633 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type stab_find_type | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const int * | typenums | |||
| ) | [static] |
Definition at line 3357 of file stabs.c.
References debug_make_indirect_type(), DEBUG_TYPE_NULL, NULL, stab_find_slot(), and stab_xcoff_builtin_type().
Referenced by parse_stab_members(), parse_stab_range_type(), and parse_stab_type().
03361 { 03362 debug_type *slot; 03363 03364 if (typenums[0] == 0 && typenums[1] < 0) 03365 { 03366 /* A negative type number indicates an XCOFF builtin type. */ 03367 return stab_xcoff_builtin_type (dhandle, info, typenums[1]); 03368 } 03369 03370 slot = stab_find_slot (info, typenums); 03371 if (slot == NULL) 03372 return DEBUG_TYPE_NULL; 03373 03374 if (*slot == DEBUG_TYPE_NULL) 03375 return debug_make_indirect_type (dhandle, slot, (const char *) NULL); 03376 03377 return *slot; 03378 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_record_type | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const int * | typenums, | |||
| debug_type | type | |||
| ) | [static] |
Definition at line 3383 of file stabs.c.
References NULL, and stab_find_slot().
Referenced by parse_stab_type().
03388 { 03389 debug_type *slot; 03390 03391 slot = stab_find_slot (info, typenums); 03392 if (slot == NULL) 03393 return false; 03394 03395 /* gdb appears to ignore type redefinitions, so we do as well. */ 03396 03397 *slot = type; 03398 03399 return true; 03400 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static boolean stab_record_variable | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| const char * | name, | |||
| debug_type | type, | |||
| enum debug_var_kind | kind, | |||
| bfd_vma | val | |||
| ) | [static] |
Definition at line 3251 of file stabs.c.
References DEBUG_GLOBAL, debug_record_variable(), DEBUG_STATIC, stab_handle::gcc_compiled, debug_type::kind, memset, stab_handle::n_opt_found, stab_pending_var::name, stab_handle::pending, stab_pending_var::type, stab_handle::within_function, and xmalloc().
Referenced by parse_stab_string().
03258 { 03259 struct stab_pending_var *v; 03260 03261 if ((kind == DEBUG_GLOBAL || kind == DEBUG_STATIC) 03262 || ! info->within_function 03263 || (info->gcc_compiled == 0 && info->n_opt_found)) 03264 return debug_record_variable (dhandle, name, type, kind, val); 03265 03266 v = (struct stab_pending_var *) xmalloc (sizeof *v); 03267 memset (v, 0, sizeof *v); 03268 03269 v->next = info->pending; 03270 v->name = name; 03271 v->type = type; 03272 v->kind = kind; 03273 v->val = val; 03274 info->pending = v; 03275 03276 return true; 03277 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static debug_type stab_xcoff_builtin_type | ( | PTR | dhandle, | |
| struct stab_handle * | info, | |||
| int | typenum | |||
| ) | [static] |
Definition at line 3405 of file stabs.c.
References abort(), debug_make_bool_type(), debug_make_complex_type(), debug_make_float_type(), debug_make_int_type(), debug_make_void_type(), debug_name_type(), DEBUG_TYPE_NULL, name, NULL, XCOFF_TYPE_COUNT, and stab_handle::xcoff_types.
Referenced by stab_find_type().
03409 { 03410 debug_type rettype; 03411 const char *name; 03412 03413 if (typenum >= 0 || typenum < -XCOFF_TYPE_COUNT) 03414 { 03415 fprintf (stderr, "Unrecognized XCOFF type %d\n", typenum); 03416 return DEBUG_TYPE_NULL; 03417 } 03418 if (info->xcoff_types[-typenum] != NULL) 03419 return info->xcoff_types[-typenum]; 03420 03421 switch (-typenum) 03422 { 03423 case 1: 03424 /* The size of this and all the other types are fixed, defined 03425 by the debugging format. */ 03426 name = "int"; 03427 rettype = debug_make_int_type (dhandle, 4, false); 03428 break; 03429 case 2: 03430 name = "char"; 03431 rettype = debug_make_int_type (dhandle, 1, false); 03432 break; 03433 case 3: 03434 name = "short"; 03435 rettype = debug_make_int_type (dhandle, 2, false); 03436 break; 03437 case 4: 03438 name = "long"; 03439 rettype = debug_make_int_type (dhandle, 4, false); 03440 break; 03441 case 5: 03442 name = "unsigned char"; 03443 rettype = debug_make_int_type (dhandle, 1, true); 03444 break; 03445 case 6: 03446 name = "signed char"; 03447 rettype = debug_make_int_type (dhandle, 1, false); 03448 break; 03449 case 7: 03450 name = "unsigned short"; 03451 rettype = debug_make_int_type (dhandle, 2, true); 03452 break; 03453 case 8: 03454 name = "unsigned int"; 03455 rettype = debug_make_int_type (dhandle, 4, true); 03456 break; 03457 case 9: 03458 name = "unsigned"; 03459 rettype = debug_make_int_type (dhandle, 4, true); 03460 case 10: 03461 name = "unsigned long"; 03462 rettype = debug_make_int_type (dhandle, 4, true); 03463 break; 03464 case 11: 03465 name = "void"; 03466 rettype = debug_make_void_type (dhandle); 03467 break; 03468 case 12: 03469 /* IEEE single precision (32 bit). */ 03470 name = "float"; 03471 rettype = debug_make_float_type (dhandle, 4); 03472 break; 03473 case 13: 03474 /* IEEE double precision (64 bit). */ 03475 name = "double"; 03476 rettype = debug_make_float_type (dhandle, 8); 03477 break; 03478 case 14: 03479 /* This is an IEEE double on the RS/6000, and different machines 03480 with different sizes for "long double" should use different 03481 negative type numbers. See stabs.texinfo. */ 03482 name = "long double"; 03483 rettype = debug_make_float_type (dhandle, 8); 03484 break; 03485 case 15: 03486 name = "integer"; 03487 rettype = debug_make_int_type (dhandle, 4, false); 03488 break; 03489 case 16: 03490 name = "boolean"; 03491 rettype = debug_make_bool_type (dhandle, 4); 03492 break; 03493 case 17: 03494 name = "short real"; 03495 rettype = debug_make_float_type (dhandle, 4); 03496 break; 03497 case 18: 03498 name = "real"; 03499 rettype = debug_make_float_type (dhandle, 8); 03500 break; 03501 case 19: 03502 /* FIXME */ 03503 name = "stringptr"; 03504 rettype = NULL; 03505 break; 03506 case 20: 03507 /* FIXME */ 03508 name = "character"; 03509 rettype = debug_make_int_type (dhandle, 1, true); 03510 break; 03511 case 21: 03512 name = "logical*1"; 03513 rettype = debug_make_bool_type (dhandle, 1); 03514 break; 03515 case 22: 03516 name = "logical*2"; 03517 rettype = debug_make_bool_type (dhandle, 2); 03518 break; 03519 case 23: 03520 name = "logical*4"; 03521 rettype = debug_make_bool_type (dhandle, 4); 03522 break; 03523 case 24: 03524 name = "logical"; 03525 rettype = debug_make_bool_type (dhandle, 4); 03526 break; 03527 case 25: 03528 /* Complex type consisting of two IEEE single precision values. */ 03529 name = "complex"; 03530 rettype = debug_make_complex_type (dhandle, 8); 03531 break; 03532 case 26: 03533 /* Complex type consisting of two IEEE double precision values. */ 03534 name = "double complex"; 03535 rettype = debug_make_complex_type (dhandle, 16); 03536 break; 03537 case 27: 03538 name = "integer*1"; 03539 rettype = debug_make_int_type (dhandle, 1, false); 03540 break; 03541 case 28: 03542 name = "integer*2"; 03543 rettype = debug_make_int_type (dhandle, 2, false); 03544 break; 03545 case 29: 03546 name = "integer*4"; 03547 rettype = debug_make_int_type (dhandle, 4, false); 03548 break; 03549 case 30: 03550 /* FIXME */ 03551 name = "wchar"; 03552 rettype = debug_make_int_type (dhandle, 2, false); 03553 break; 03554 case 31: 03555 name = "long long"; 03556 rettype = debug_make_int_type (dhandle, 8, false); 03557 break; 03558 case 32: 03559 name = "unsigned long long"; 03560 rettype = debug_make_int_type (dhandle, 8, true); 03561 break; 03562 case 33: 03563 name = "logical*8"; 03564 rettype = debug_make_bool_type (dhandle, 8); 03565 break; 03566 case 34: 03567 name = "integer*8"; 03568 rettype = debug_make_int_type (dhandle, 8, false); 03569 break; 03570 default: 03571 abort (); 03572 } 03573 03574 rettype = debug_name_type (dhandle, name, rettype); 03575 03576 info->xcoff_types[-typenum] = rettype; 03577 03578 return rettype; 03579 }
Here is the call graph for this function:

Here is the caller graph for this function:

| PTR start_stab | ( | PTR | dhandle, | |
| bfd * | abfd, | |||
| boolean | sections, | |||
| asymbol ** | syms, | |||
| long | symcount | |||
| ) |
Definition at line 359 of file stabs.c.
References memset, NULL, and xmalloc().
Referenced by read_section_stabs_debugging_info(), and read_symbol_stabs_debugging_info().
00365 { 00366 struct stab_handle *ret; 00367 00368 ret = (struct stab_handle *) xmalloc (sizeof *ret); 00369 memset (ret, 0, sizeof *ret); 00370 ret->abfd = abfd; 00371 ret->sections = sections; 00372 ret->syms = syms; 00373 ret->symcount = symcount; 00374 ret->files = 1; 00375 ret->file_types = (struct stab_types **) xmalloc (sizeof *ret->file_types); 00376 ret->file_types[0] = NULL; 00377 ret->function_end = (bfd_vma) -1; 00378 return (PTR) ret; 00379 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void warn_stab | ( | char * | p, | |
| const char * | err | |||
| ) | const [static] |
Definition at line 348 of file stabs.c.
Referenced by find_excl(), parse_number(), parse_stab_baseclasses(), parse_stab_cpp_abbrev(), parse_stab_members(), parse_stab_one_struct_field(), parse_stab_range_type(), parse_stab_string(), and parse_stab_type().
00351 { 00352 fprintf (stderr, "Warning: %s: %s\n", err, p); 00353 }
Here is the caller graph for this function:

1.4.7

