48#include "gdbsupport/gdb_obstack.h"
63#include "coff/ecoff.h"
66#include "aout/aout64.h"
67#include "aout/stab_gnu.h"
77#define ECOFF_IN_ELF(bfd) (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
78 && bfd_get_section_by_name (bfd, ".mdebug") != NULL)
105#define PST_PRIVATE(p) ((struct md_symloc *)(p)->read_symtab_private)
106#define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx)
107#define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd)
108#define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap)
109#define DEBUG_INFO(p) (PST_PRIVATE(p)->debug_info)
110#define PENDING_LIST(p) (PST_PRIVATE(p)->pending_list)
112#define SC_IS_TEXT(sc) ((sc) == scText \
113 || (sc) == scRConst \
116#define SC_IS_DATA(sc) ((sc) == scData \
121#define SC_IS_COMMON(sc) ((sc) == scCommon || (sc) == scSCommon)
122#define SC_IS_BSS(sc) ((sc) == scBss)
123#define SC_IS_SBSS(sc) ((sc) == scSBss)
124#define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
130 complaint (_(
"bad aux index at symbol %s"), arg1);
136 complaint (_(
"unknown external symbol %s"), arg1);
142 complaint (_(
"cannot map ECOFF basic type 0x%x for %s"),
149 complaint (_(
"guessed tag type of %s incorrectly"), arg1);
155 complaint (_(
"bad rfd entry for %s: file %d, index %d"),
162 complaint (_(
"unexpected type code for %s"), arg1);
169#define MIN_GLEVEL GLEVEL_0
170#define compare_glevel(a,b) \
171 (((a) == GLEVEL_3) ? ((b) < GLEVEL_3) : \
172 ((b) == GLEVEL_3) ? -1 : (int)((b) - (a)))
231 const char **,
int,
const char *);
248static struct type *
parse_type (
int,
union aux_ext *,
unsigned int,
int *,
272 FDR *,
int, CORE_ADDR);
323 return "<stripped file>";
336 const struct ecoff_debug_swap *swap,
337 struct ecoff_debug_info *info)
348 if (info->fdr == NULL)
355 info->symbolic_header.ifdMax);
356 fdr_src = (
char *) info->external_fdr;
358 + info->symbolic_header.ifdMax * swap->external_fdr_size);
360 for (; fdr_src < fdr_end; fdr_src += swap->external_fdr_size, fdr_ptr++)
361 (*swap->swap_fdr_in) (
objfile->
obfd.get (), fdr_src, fdr_ptr);
376 "debugging support is limited.\n"),
378 gdb_printf (_(
"You should compile with -g2 or "
379 "-g3 for best debugging support.\n"));
521 complaint (_(
"bad register number %d (max %d) in symbol %s"),
522 regnum, num_regs - 1, sym);
563 struct symbol *s,
int aclass_index,
struct block *b,
572 || sh->sc == scNil || sh->index == indexNil)
584 const bfd_size_type external_sym_size =
debug_swap->external_sym_size;
585 void (*
const swap_sym_in) (bfd *,
void *, SYMR *) =
debug_swap->swap_sym_in;
593 long svalue = sh->value;
601 int section_index = -1;
611 if (sh->st != stEnd && sh->st != stBlock)
627 if (section_index != -1)
667 if (sh->sc == scRegister)
730 if (sh->st == stProc && sh->sc != scText)
732 char *ext_tsym = ext_sh;
733 int keep_counting = 1;
736 while (keep_counting)
738 ext_tsym += external_sym_size;
739 (*swap_sym_in) (
cur_bfd, ext_tsym, &tsym);
749 complaint (_(
"unknown symbol type 0x%x"), sh->st);
765 if (strcmp (
name,
"malloc") == 0
766 && t->
code () == TYPE_CODE_VOID)
781 if (sh->st == stProc)
840 goto structured_common;
844 goto structured_common;
848 goto structured_common;
852 goto case_stBlock_code;
867 for (ext_tsym = ext_sh + external_sym_size;
869 ext_tsym += external_sym_size)
873 (*swap_sym_in) (
cur_bfd, ext_tsym, &tsym);
895 if (tsym.iss == issNull
911 if (tsym.index == indexNil
912 || (tsym.index == 0 && sh->value == 0))
917 &ax[tsym.index].a_ti,
919 if ((tir.bt == btNil || tir.bt == btVoid
920 || (tir.bt == btEnum && sh->value == 0))
926 if (tsym.value > max_value)
927 max_value = tsym.value;
938 if (tsym.sc == scVariant);
947 + ((
cur_fdr->isymBase + tsym.index - 1)
948 * external_sym_size));
968 complaint (_(
"declaration block contains "
969 "unhandled symbol type %d"),
1010 if (nfields > 1 && max_value == 0)
1029 if (sh->iss == 0 ||
name[0] ==
'.' ||
name[0] ==
'\0')
1033 name, (
char *) NULL));
1042 int unsigned_enum = 1;
1057 for (ext_tsym = ext_sh + external_sym_size;
1059 ext_tsym += external_sym_size)
1064 (*swap_sym_in) (
cur_bfd, ext_tsym, &tsym);
1066 if (tsym.st != stMember)
1069 f->set_loc_enumval (tsym.value);
1151 else if (sh->sc == scText &&
1174 e->
pdr.framereg = -1;
1181 if (b_bad->superblock () == cblock
1185 b_bad->set_start (cblock->
start ());
1186 b_bad->set_end (cblock->
end ());
1204 if (iparams == nparams)
1207 if (sym->is_argument ())
1237 complaint (_(
"stEnd with storage class %d not handled"), sh->sc);
1247 f->set_loc_bitpos (sh->value);
1309 || (s->
type ()->
code () != TYPE_CODE_STRUCT
1310 && s->
type ()->
code () != TYPE_CODE_UNION)))
1312 if (s->
type ()->
code () == TYPE_CODE_PTR
1313 || s->
type ()->
code () == TYPE_CODE_FUNC)
1352 complaint (_(
"unknown symbol type 0x%x"), sh->st);
1362 gdb::noop_deleter<struct type *>>
1378 btMax,
struct type *);
1458 tp = alloc.
new_type (TYPE_CODE_ERROR,
1465 tp = alloc.
new_type (TYPE_CODE_STRING, TARGET_CHAR_BIT,
"string");
1516parse_type (
int fd,
union aux_ext *ax,
unsigned int aux_index,
int *bs,
1517 int bigend,
const char *sym_name)
1520 struct type *tp = 0;
1524 if (aux_index == indexNil)
1528 if (aux_index >= (
debug_info->fdr + fd)->caux)
1536 (*
debug_swap->swap_tir_in) (bigend, &ax->a_ti, t);
1581 int width = AUX_GET_WIDTH (bigend, ax);
1589 if (t->bt == btShort && width == 8)
1591 else if (t->bt == btUShort && width == 8)
1593 else if (t->bt == btEnum)
1596 complaint (_(
"can't handle TIR fBitfield for %s"),
1606 if (t->bt == btIndirect)
1613 (*
debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, rn);
1615 if (rn->rfd == 0xfff)
1617 rf = AUX_GET_ISYM (bigend, ax);
1625 complaint (_(
"unable to cross ref btIndirect for %s"), sym_name);
1631 rn->index, NULL, xref_fh->fBigendian, sym_name);
1637 if (t->bt == btStruct ||
1654 while (tp->
code () == TYPE_CODE_PTR
1655 || tp->
code () == TYPE_CODE_ARRAY)
1661 if (tp->
code () != TYPE_CODE_STRUCT
1662 && tp->
code () != TYPE_CODE_UNION
1663 && tp->
code () != TYPE_CODE_ENUM)
1673 if ((tp->
code () == TYPE_CODE_ENUM
1675 || (tp->
code () != TYPE_CODE_ENUM
1688 if (
name[0] ==
'.' ||
name[0] ==
'\0')
1690 else if (tp->
name () == NULL
1691 || strcmp (tp->
name (),
name) != 0)
1701 if (t->bt == btRange)
1713 if (tp->
code () != TYPE_CODE_RANGE)
1726 if (tp->
name () == NULL
1727 || strcmp (tp->
name (),
name) != 0)
1732 if (t->bt == btTypedef)
1740 complaint (_(
"unable to cross ref btTypedef for %s"), sym_name);
1746 if (t->bt == btRange)
1762#define PARSE_TQ(tq) \
1763 if (t->tq != tqNil) \
1764 ax += upgrade_type(fd, &tp, t->tq, ax, bigend, sym_name); \
1780 (*
debug_swap->swap_tir_in) (bigend, &ax->a_ti, t);
1786 complaint (_(
"illegal TIR continued for %s"), sym_name);
1800 const char *sym_name)
1829 (*
debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, &rndx);
1835 rf = AUX_GET_ISYM (bigend, ax);
1842 id, NULL, bigend, sym_name);
1846 if (indx->
code () != TYPE_CODE_INT)
1848 complaint (_(
"illegal array index type for %s, assuming int"),
1855 lower = AUX_GET_DNLOW (bigend, ax);
1857 upper = AUX_GET_DNHIGH (bigend, ax);
1859 rf = AUX_GET_WIDTH (bigend, ax);
1883 if ((*tpp)->length () == 0)
1898 complaint (_(
"unknown type qualifier 0x%x"), tq);
1920 const struct block *b;
1930 complaint (_(
"can't handle PDR for static proc at 0x%lx"),
1931 (
unsigned long) pr->adr);
1954 + ((
cur_fdr->isymBase + pr->isym)
1960 if (search_symtab != NULL)
1992 complaint (_(
"PDR for %s, but no symbol"), sh_name);
2006 SYMBOL_BLOCK_VALUE (s) = b;
2007 BLOCK_FUNCTION (b) = s;
2008 BLOCK_START (b) = pr->adr;
2011 BLOCK_END (b) = bound;
2071 if (es->ifd != ifdNil)
2084 if (
SC_IS_UNDEF (es->asym.sc) || es->asym.sc == scNil)
2087 switch (es->asym.st)
2113 gdb_printf (_(
"Warning: %s `%s' is undefined (in %s)\n"),
2119 switch (es->asym.st)
2158 CORE_ADDR lowest_pdr_addr)
2160 unsigned char *base;
2162 int delta, count, lineno = 0;
2164 if (fh->cbLine == 0)
2169 for (j = 0; j < fh->cpd; j++, pr++)
2173 unsigned char *halt;
2176 if (pr->iline == ilineNil ||
2177 pr->lnLow == -1 || pr->lnHigh == -1)
2183 if (j != (fh->cpd - 1))
2184 halt = base + pr[1].cbLineOffset;
2186 halt = base + fh->cbLine;
2187 base += pr->cbLineOffset;
2189 adr = pr->adr - lowest_pdr_addr;
2192 for (lineno = pr->lnLow; base < halt;)
2194 count = *base & 0x0f;
2195 delta = *base++ >> 4;
2200 delta = (base[0] << 8) | base[1];
2201 if (delta >= 0x8000)
2209 if (
lt->nitems >= maxlines)
2211 complaint (_(
"guessed size of linetable for %s incorrectly"),
2224 complaint (_(
"function `%s' appears to be defined "
2225 "outside of all compilation units"),
2234 const char *
name,
const unrelocated_addr address,
2240 switch (storage_class)
2302 const bfd_size_type external_sym_size =
debug_swap->external_sym_size;
2303 const bfd_size_type external_rfd_size =
debug_swap->external_rfd_size;
2304 const bfd_size_type external_ext_size =
debug_swap->external_ext_size;
2305 void (*
const swap_ext_in) (bfd *,
void *, EXTR *) =
debug_swap->swap_ext_in;
2306 void (*
const swap_sym_in) (bfd *,
void *, SYMR *) =
debug_swap->swap_sym_in;
2307 void (*
const swap_rfd_in) (bfd *,
void *, RFDT *) =
debug_swap->swap_rfd_in;
2318 int textlow_not_set = 1;
2321 const char **psymtab_include_list;
2322 int includes_allocated;
2328 int dependencies_used, dependencies_allocated;
2331 asection *text_sect;
2332 int relocatable = 0;
2340 text_sect = bfd_get_section_by_name (
cur_bfd,
".text");
2341 if (text_sect != NULL
2342 && (bfd_section_flags (text_sect) & SEC_RELOC))
2347 includes_allocated = 30;
2349 psymtab_include_list = (
const char **) alloca (includes_allocated *
2350 sizeof (
const char *));
2353 dependencies_allocated = 30;
2354 dependencies_used = 0;
2376 std::vector<struct pst_map> fdr_to_pst_holder (hdr->ifdMax + 1);
2377 fdr_to_pst = fdr_to_pst_holder.data ();
2382 fdr_to_pst[-1].
pst = new_pst;
2393 gdb::def_vector<EXTR> ext_block (hdr->iextMax);
2396 ext_out_end = ext_out + hdr->iextMax * external_ext_size;
2397 ext_in = ext_block.data ();
2398 for (; ext_out < ext_out_end; ext_out += external_ext_size, ext_in++)
2399 (*swap_ext_in) (
cur_bfd, ext_out, ext_in);
2402 ext_in = ext_block.data ();
2403 ext_in_end = ext_in + hdr->iextMax;
2404 for (; ext_in < ext_in_end; ext_in++)
2407 if (ext_in->ifd >= -1
2408 && ext_in->ifd < hdr->ifdMax
2409 && ext_in->asym.iss >= 0
2410 && ext_in->asym.iss < hdr->issExtMax)
2416 for (f_idx = -1; f_idx < hdr->ifdMax; f_idx++)
2455 ext_in = ext_block.data ();
2456 ext_in_end = ext_in + hdr->iextMax;
2457 for (; ext_in < ext_in_end; ext_in++)
2460 unrelocated_addr svalue = unrelocated_addr (ext_in->asym.value);
2464 if (ext_in->ifd < -1 || ext_in->ifd >= hdr->ifdMax)
2466 complaint (_(
"bad ifd for external symbol: %d (max %ld)"),
2467 ext_in->ifd, hdr->ifdMax);
2470 if (ext_in->asym.iss < 0 || ext_in->asym.iss >= hdr->issExtMax)
2472 complaint (_(
"bad iss for external symbol: %ld (max %ld)"),
2473 ext_in->asym.iss, hdr->issExtMax);
2478 + fdr_to_pst[ext_in->ifd].
n_globals++] = *ext_in;
2481 if (
SC_IS_UNDEF (ext_in->asym.sc) || ext_in->asym.sc == scNil)
2489 switch (ext_in->asym.st)
2568 if (sbss_sect_index == -1)
2596 for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++)
2600 unrelocated_addr textlow;
2606 fdr_to_pst[f_idx].
pst = NULL;
2613 textlow = unrelocated_addr (fh->adr);
2615 textlow = unrelocated_addr (0);
2647 case langCplusplusV2:
2671 + (fh->isymBase + 1) * external_sym_size),
2673 if (strcmp (
debug_info->ss + fh->issBase + sh.iss,
2683 const char *namestring;
2687 + (fh->isymBase +
cur_sdx) * external_sym_size),
2689 type_code = ECOFF_UNMARK_STAB (sh.index);
2690 if (!ECOFF_IS_STAB (&sh))
2692 if (sh.st == stProc || sh.st == stStaticProc)
2694 unrelocated_addr procaddr;
2697 if (sh.st == stStaticProc)
2699 namestring =
debug_info->ss + fh->issBase + sh.iss;
2701 unrelocated_addr (sh.value),
2705 procaddr = unrelocated_addr (sh.value);
2707 isym = AUX_GET_ISYM (fh->fBigendian,
2713 + ((fh->isymBase + isym - 1)
2714 * external_sym_size)),
2718 unrelocated_addr high
2719 = unrelocated_addr (CORE_ADDR (procaddr)
2725 || procaddr < pst->unrelocated_text_low ()))
2731 else if (sh.st == stStatic)
2746 namestring =
debug_info->ss + fh->issBase + sh.iss;
2748 unrelocated_addr (sh.value),
2756 namestring =
debug_info->ss + fh->issBase + sh.iss;
2758 unrelocated_addr (sh.value),
2768 char *stabstring =
debug_info->ss + fh->issBase + sh.iss;
2771 gdb::unique_xmalloc_ptr<char> stabstring_storage;
2772 int len = strlen (stabstring);
2774 while (stabstring[len - 1] ==
'\\')
2777 char *stabstring1 = stabstring;
2789 * external_sym_size),
2791 stabstring2 =
debug_info->ss + fh->issBase + sh2.iss;
2792 len2 = strlen (stabstring2);
2795 if (stabstring_storage !=
nullptr)
2797 stabstring_storage.reset
2798 ((
char *)
xrealloc (stabstring_storage.release (),
2800 stabstring = stabstring_storage.get ();
2804 stabstring_storage.reset
2805 ((
char *)
xmalloc (len + len2 + 1));
2806 stabstring = stabstring_storage.get ();
2807 strcpy (stabstring, stabstring1);
2809 strcpy (stabstring + len, stabstring2);
2819 case N_TEXT | N_EXT:
2820 case N_NBTEXT | N_EXT:
2823 case N_DATA | N_EXT:
2824 case N_NBDATA | N_EXT:
2829 case N_NBBSS | N_EXT:
2830 case N_SETV | N_EXT:
2855 case N_UNDF | N_EXT:
2874 case N_INDR | N_EXT:
2876 case N_SETA | N_EXT:
2878 case N_SETT | N_EXT:
2880 case N_SETD | N_EXT:
2882 case N_SETB | N_EXT:
2892 static int prev_so_symnum = -10;
2893 const char *basename;
2901 textlow_not_set = 1;
2903 textlow_not_set = 0;
2905 if (prev_so_symnum !=
symnum - 1)
2911 dependencies_used = 0;
2921 namestring = stabstring;
2925 if (*namestring ==
'\000')
2933 basename = lbasename (namestring);
2934 if (basename != namestring && *basename ==
'\000')
2958 namestring = stabstring;
2991 for (i = 0; i < includes_used; i++)
2992 if (filename_cmp (namestring,
2993 psymtab_include_list[i]) == 0)
3002 psymtab_include_list[includes_used++] = namestring;
3003 if (includes_used >= includes_allocated)
3005 const char **orig = psymtab_include_list;
3007 psymtab_include_list = (
const char **)
3008 alloca ((includes_allocated *= 2) *
3009 sizeof (
const char *));
3010 memcpy (psymtab_include_list, orig,
3011 includes_used *
sizeof (
const char *));
3035 namestring = stabstring;
3036 p = (
char *) strchr (namestring,
':');
3058 unrelocated_addr (sh.value),
3071 unrelocated_addr (sh.value),
3083 if (p >= namestring + 2
3084 || (p == namestring + 1
3085 && namestring[0] !=
' '))
3088 (gdb::string_view (namestring, p - namestring),
3091 unrelocated_addr (0),
3098 (gdb::string_view (namestring,
3102 unrelocated_addr (0),
3110 if (p != namestring)
3114 (gdb::string_view (namestring,
3118 unrelocated_addr (0),
3141 while ((*p >=
'0' && *p <=
'9')
3142 || *p ==
'(' || *p ==
',' || *p ==
')'
3165 while (*p && *p !=
';' && *p !=
',')
3171 if (*p ==
'\\' || (*p ==
'?' && p[1] ==
'\0'))
3176 for (q = p; *q && *q !=
':'; q++)
3186 unrelocated_addr (0),
3192 while (*p && *p !=
',')
3206 unrelocated_addr (0),
3214 std::string copy (namestring, p);
3223 unrelocated_addr (sh.value),
3235 std::string copy (namestring, p);
3244 unrelocated_addr (sh.value),
3289 complaint (_(
"unknown symbol descriptor `%c'"), p[1]);
3310 dependencies_used = 0;
3316 unrelocated_addr unrel_value
3317 = unrelocated_addr (sh.value);
3371 unrelocated_addr minsym_value;
3377 * external_sym_size)),
3380 if (ECOFF_IS_STAB (&sh))
3388 || (sh.index == indexNil
3389 && (sh.st != stStatic || sh.sc == scAbs)))
3396 sym_name =
debug_info->ss + fh->issBase + sh.iss;
3398 minsym_value = unrelocated_addr (sh.value);
3424 unrelocated_addr high;
3425 unrelocated_addr procaddr;
3437 if (sh.index >= hdr->iauxMax)
3445 new_sdx = AUX_GET_ISYM (fh->fBigendian,
3453 complaint (_(
"bad proc end in aux found from symbol %s"),
3465 if (sh.st == stProc && sh.sc != scText)
3479 if (sh.st == stProc)
3484 unrelocated_addr (sh.value),
3492 unrelocated_addr (sh.value),
3496 procaddr = unrelocated_addr (sh.value);
3501 + ((fh->isymBase +
cur_sdx - 1)
3502 * external_sym_size)),
3510 || procaddr < pst->unrelocated_text_low ()))
3513 high = unrelocated_addr (CORE_ADDR (procaddr) + sh.value);
3552 if ((sh.sc == scInfo
3560 unrelocated_addr (0),
3565 pst, fh, sh.st, sh.value);
3572 complaint (_(
"bad aux index at block symbol %s"),
3593 complaint (_(
"unknown local symbol %s"),
3603 unrelocated_addr (sh.value),
3612 cur_sdx = fdr_to_pst[f_idx].n_globals;
3622 gdb_assert (
ext_ptr->ifd == f_idx);
3630 svalue = psh->value;
3679 char *sym_name =
debug_info->ssext + psh->iss;
3684 unrelocated_addr (svalue),
3692 fdr_to_pst[f_idx].
pst
3694 psymtab_include_list, includes_used,
3696 dependency_list, dependencies_used,
3699 dependencies_used = 0;
3703 for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++)
3706 pst = fdr_to_pst[f_idx].
pst;
3720 for (s_idx = 1; s_idx < fh->crfd; s_idx++)
3726 + (fh->rfdBase + s_idx) * external_rfd_size),
3728 if (rh < 0 || rh >= hdr->ifdMax)
3730 complaint (_(
"bad file number %ld"), rh);
3739 if (fdr_to_pst[rh].
pst == NULL)
3742 = fdr_to_pst[rh].
pst;
3749 if (pst_del->
next == NULL
3751 && pst_del->
empty ())
3762 FDR *fh,
int stype, CORE_ADDR svalue)
3764 const bfd_size_type external_sym_size =
debug_swap->external_sym_size;
3765 void (*
const swap_sym_in) (bfd *,
void *, SYMR *) =
debug_swap->swap_sym_in;
3766 char *ext_sym = ((
char *)
debug_info->external_sym
3767 + ((fh->isymBase +
cur_sdx + 1) * external_sym_size));
3784 (*swap_sym_in) (
cur_bfd, ext_sym, &sh);
3785 if (sh.st != stMember)
3788 if (sh.index == indexNil
3789 || (sh.index == 0 && svalue == 0))
3793 + fh->iauxBase + sh.index)->a_ti,
3795 if ((tir.bt != btNil
3797 && (tir.bt != btEnum || svalue != 0))
3798 || tir.tq0 != tqNil)
3810 (*swap_sym_in) (
cur_bfd, ext_sym, &sh);
3811 if (sh.st != stMember)
3820 unrelocated_addr (0),
3822 ext_sym += external_sym_size;
3855 bfd_size_type external_sym_size;
3856 bfd_size_type external_pdr_size;
3857 void (*swap_sym_in) (bfd *,
void *, SYMR *);
3858 void (*swap_pdr_in) (bfd *,
void *, PDR *);
3863 CORE_ADDR lowest_pdr_addr = 0;
3864 int last_symtab_ended = 0;
3887 external_sym_size =
debug_swap->external_sym_size;
3888 external_pdr_size =
debug_swap->external_pdr_size;
3900 if (fh != NULL && fh->csym >= 2)
3906 + (fh->isymBase + 1) * external_sym_size),
3908 if (strcmp (
debug_info->ss + fh->issBase + sh.iss,
3938 + (fh->isymBase +
cur_sdx) * external_sym_size),
3943 if (ECOFF_IS_STAB (&sh) || (
name[0] ==
'#'))
3945 int type_code = ECOFF_UNMARK_STAB (sh.index);
3967 last_symtab_ended = 1;
3971 last_symtab_ended = 0;
3977 else if (
name[0] ==
'#')
3995 e->
pdr.framereg = -1;
3999 else if (sh.st == stLabel)
4001 if (sh.index == indexNil)
4016 else if (sh.st == stProc || sh.st == stStaticProc
4017 || sh.st == stStatic || sh.st == stEnd)
4024 if (! last_symtab_ended)
4044 gdb::def_vector<PDR> pr_block (fh->cpd);
4047 + fh->ipdFirst * external_pdr_size);
4048 pdr_end = pdr_ptr + fh->cpd * external_pdr_size;
4049 pdr_in = pr_block.data ();
4052 pdr_ptr += external_pdr_size, pdr_in++)
4054 (*swap_pdr_in) (
cur_bfd, pdr_ptr, pdr_in);
4058 if (pdr_in == pr_block.data ())
4059 lowest_pdr_addr = pdr_in->adr;
4060 else if (pdr_in->adr < lowest_pdr_addr)
4061 lowest_pdr_addr = pdr_in->adr;
4064 pdr_in = pr_block.data ();
4065 pdr_in_end = pdr_in + fh->cpd;
4066 for (; pdr_in < pdr_in_end; pdr_in++)
4084 maxlines = 2 * fh->cline;
4120 + fh->isymBase * external_sym_size);
4121 sym_end = sym_ptr + fh->csym * external_sym_size;
4122 while (sym_ptr < sym_end)
4127 (*swap_sym_in) (
cur_bfd, sym_ptr, &sh);
4130 sym_ptr, fh->fBigendian,
4132 sym_ptr += c * external_sym_size;
4145 gdb::def_vector<PDR> pr_block (fh->cpd);
4148 + fh->ipdFirst * external_pdr_size);
4149 pdr_end = pdr_ptr + fh->cpd * external_pdr_size;
4150 pdr_in = pr_block.data ();
4153 pdr_ptr += external_pdr_size, pdr_in++)
4155 (*swap_pdr_in) (
cur_bfd, pdr_ptr, pdr_in);
4159 if (pdr_in == pr_block.data ())
4160 lowest_pdr_addr = pdr_in->adr;
4161 else if (pdr_in->adr < lowest_pdr_addr)
4162 lowest_pdr_addr = pdr_in->adr;
4165 parse_lines (fh, pr_block.data (), lines, maxlines,
4167 if (lines->
nitems < fh->cline)
4171 pdr_in = pr_block.data ();
4172 pdr_in_end = pdr_in + fh->cpd;
4173 for (; pdr_in < pdr_in_end; pdr_in++)
4206 gdb_printf (_(
"File %s contains %d unresolved references:"),
4211 "procedures\n\t%4d labels\n",
4240 if (sh->index == indexNil)
4243 ax =
debug_info->external_aux + fh->iauxBase + sh->index;
4244 (*
debug_swap->swap_tir_in) (fh->fBigendian, &ax->a_ti, &tir);
4245 if (tir.bt != btStruct && tir.bt != btUnion && tir.bt != btEnum)
4249 (*
debug_swap->swap_rndx_in) (fh->fBigendian, &ax->a_rndx, rn);
4250 if (rn->rfd == 0xfff)
4251 rf = AUX_GET_ISYM (fh->fBigendian, ax + 1);
4268 const char **pname,
int bigend,
const char *sym_name)
4281 (*
debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, rn);
4284 if (rn->rfd == 0xfff)
4287 rf = AUX_GET_ISYM (bigend, ax + 1);
4301 *pname =
"<undefined>";
4310 if (rn->rfd == 0xfff && rn->index == 0)
4312 *pname =
"<undefined>";
4320 if (rn->index >= fh->csym)
4323 *pname =
"<illegal>";
4335 + ((fh->isymBase + rn->index)
4340 if ((sh.sc != scInfo
4341 || (sh.st != stBlock && sh.st != stTypedef && sh.st != stIndirect
4342 && sh.st != stStruct && sh.st != stUnion
4343 && sh.st != stEnum))
4347 *pname =
"<illegal>";
4352 *pname =
debug_info->ss + fh->issBase + sh.iss;
4361 if ((sh.iss == 0 && sh.st == stTypedef) || sh.st == stIndirect)
4381 + fh->iauxBase + sh.index)->a_ti,
4383 if (tir.tq0 != tqNil)
4384 complaint (_(
"illegal tq0 in forward typedef for %s"), sym_name);
4389 *pname =
"<undefined>";
4397 + fh->iauxBase + sh.index + 1),
4399 fh->fBigendian, sym_name);
4420 complaint (_(
"illegal bt %d in forward typedef for %s"), tir.bt,
4427 else if (sh.st == stTypedef)
4472 if (sym->linkage_name ()[0] == inc
4473 && sym->domain () ==
domain
4474 && sym->aclass () == theclass
4475 && strcmp (sym->linkage_name (),
name) == 0)
4508 *
sizeof (
struct block)));
4544 lt->item[
lt->nitems].line = lineno;
4545 lt->item[
lt->nitems++].set_unrelocated_pc (unrelocated_addr (adr << 2));
4556 CORE_ADDR start1 = b1->
start ();
4557 CORE_ADDR start2 = b2->
start ();
4559 if (start1 != start2)
4560 return start1 < start2;
4562 return (b2->
end ()) < (b1->
end ());
4594 gdb::array_view<block *> blocks_view = bv->
blocks ();
4605 if (high < bv->
block (i)->end ())
4701 * sizeof (
lt->item))));
4724static struct block *
4771 const struct ecoff_debug_swap *swap, asection *sec)
4774 struct ecoff_debug_info *info;
4784 if (!(*swap->read_debug_info) (abfd, sec, info))
4785 error (_(
"Error reading ECOFF debugging information: %s"),
4786 bfd_errmsg (bfd_get_error ()));
void * xrealloc(void *ptr, size_t size)
iterator_range< block_iterator_wrapper > block_iterator_range
struct subfile * get_current_subfile()
void set_last_source_file(const char *name)
struct compunit_symtab * end_compunit_symtab(CORE_ADDR end_addr)
void record_line(struct subfile *subfile, int line, unrelocated_addr pc)
const char * get_last_source_file()
struct pending ** get_local_symbols()
void add_symbol_to_list(struct symbol *symbol, struct pending **listhead)
void record_with_info(const char *name, unrelocated_addr address, enum minimal_symbol_type ms_type, int section)
struct partial_symtab * psymtabs
void discard_psymtab(struct partial_symtab *pst)
struct partial_symtab ** allocate_dependencies(int number)
void set(unsigned key, void *datum)
#define complaint(FMT,...)
void free_header_files(void)
void init_header_files(void)
legacy_psymtab * dbx_end_psymtab(struct objfile *objfile, psymtab_storage *partial_symtabs, legacy_psymtab *pst, const char **include_list, int num_includes, int capping_symbol_offset, unrelocated_addr capping_text, legacy_psymtab **dependency_list, int number_dependencies, int textlow_not_set)
void process_one_symbol(int type, int desc, CORE_ADDR valu, const char *name, const section_offsets §ion_offsets, struct objfile *objfile, enum language language)
struct multidictionary * mdict_create_hashed_expandable(enum language language)
struct multidictionary * mdict_create_linear_expandable(enum language language)
void mdict_add_symbol(struct multidictionary *mdict, struct symbol *sym)
bool is_cplus_marker(int c)
int gdbarch_sofun_address_maybe_missing(struct gdbarch *gdbarch)
int gdbarch_ecoff_reg_to_regnum(struct gdbarch *gdbarch, int ecoff_regnr)
int gdbarch_int_bit(struct gdbarch *gdbarch)
int gdbarch_float_bit(struct gdbarch *gdbarch)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
const struct floatformat ** gdbarch_double_format(struct gdbarch *gdbarch)
CORE_ADDR gdbarch_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
const struct floatformat ** gdbarch_float_format(struct gdbarch *gdbarch)
int gdbarch_double_bit(struct gdbarch *gdbarch)
static int gdbarch_num_cooked_regs(gdbarch *arch)
struct type * make_pointer_type(struct type *type, struct type **typeptr)
struct type * lookup_pointer_type(struct type *type)
struct type * init_integer_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * create_static_range_type(type_allocator &alloc, struct type *index_type, LONGEST low_bound, LONGEST high_bound)
struct type * lookup_function_type(struct type *type)
struct type * init_pointer_type(type_allocator &alloc, int bit, const char *name, struct type *target_type)
struct type * init_float_type(type_allocator &alloc, int bit, const char *name, const struct floatformat **floatformats, enum bfd_endian byte_order)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct type * create_array_type(type_allocator &alloc, struct type *element_type, struct type *range_type)
struct type * init_complex_type(const char *name, struct type *target_type)
#define TYPE_ZALLOC(t, size)
#define INIT_CPLUS_SPECIFIC(type)
static const char * range
static struct linetable * new_linetable(int)
static struct linetable * shrink_linetable(struct linetable *)
static void add_block(struct block *, struct symtab *)
static int found_ecoff_debugging_info
static struct block * new_block(struct objfile *objfile, enum block_type, enum language)
static void unknown_ext_complaint(const char *arg1)
static void bad_rfd_entry_complaint(const char *arg1, int arg2, int arg3)
static struct ecoff_debug_info * debug_info
static int upgrade_type(int, struct type **, int, union aux_ext *, int, const char *)
static void index_complaint(const char *arg1)
static const struct ecoff_debug_swap * debug_swap
static struct objfile * mdebugread_objfile
static struct parse_stack * top_stack
static int mdebug_register_index
static struct blockvector * new_bvect(int)
static void record_minimal_symbol(minimal_symbol_reader &reader, const char *name, const unrelocated_addr address, enum minimal_symbol_type ms_type, int storage_class, struct objfile *objfile)
static char stabs_symbol[]
static void bad_tag_guess_complaint(const char *arg1)
static struct symbol * mylookup_symbol(const char *, const struct block *, domain_enum, enum address_class)
static struct type * basic_type(int bt, struct objfile *objfile)
static void parse_lines(FDR *fh, PDR *pr, struct linetable *lt, int maxlines, CORE_ADDR lowest_pdr_addr)
static void push_parse_stack(void)
static struct mdebug_pending * is_pending_symbol(FDR *fh, char *sh)
static FDR * get_rfd(int cf, int rf)
static enum language psymtab_language
static struct mdebug_pending ** pending_list
void _initialize_mdebugread()
static void parse_partial_symbols(minimal_symbol_reader &, psymtab_storage *, struct objfile *)
static void mdebug_expand_psymtab(legacy_psymtab *pst, struct objfile *objfile)
static void add_symbol(struct symbol *, struct symtab *, struct block *)
static int mdebug_regparm_index
static void parse_procedure(PDR *pr, struct compunit_symtab *search_symtab, legacy_psymtab *pst)
#define ECOFF_IN_ELF(bfd)
void mdebug_build_psymtabs(minimal_symbol_reader &reader, struct objfile *objfile, const struct ecoff_debug_swap *swap, struct ecoff_debug_info *info)
static void basic_type_complaint(int arg1, const char *arg2)
static int mdebug_reg_to_regnum(struct symbol *sym, struct gdbarch *gdbarch)
static void mdebug_read_symtab(legacy_psymtab *self, struct objfile *objfile)
static legacy_psymtab * new_psymtab(const char *, psymtab_storage *, struct objfile *)
static int add_line(struct linetable *, int, CORE_ADDR, int)
static void sort_blocks(struct symtab *)
static int parse_symbol(SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, const section_offsets §ion_offsets, struct objfile *objfile)
static struct type * new_type(char *)
static void unexpected_type_code_complaint(const char *arg1)
static int n_undef_labels
static void add_pending(FDR *fh, char *sh, struct type *t)
static int n_undef_symbols
static int has_opaque_xref(FDR *, SYMR *)
static void reg_value_complaint(int regnum, int num_regs, const char *sym)
static const registry< objfile >::key< struct type *, gdb::noop_deleter< struct type * > > basic_type_data
static const struct symbol_register_ops mdebug_register_funcs
static struct symbol * new_symbol(const char *)
static void function_outside_compilation_unit_complaint(const char *arg1)
static int cross_ref(int, union aux_ext *, struct type **, enum type_code, const char **, int, const char *)
static bool block_is_less_than(const struct block *b1, const struct block *b2)
static void parse_external(EXTR *es, int bigend, const section_offsets §ion_offsets, struct objfile *objfile)
#define compare_glevel(a, b)
static void handle_psymbol_enumerators(struct objfile *, psymtab_storage *, partial_symtab *, FDR *, int, CORE_ADDR)
static struct compunit_symtab * new_symtab(const char *, int, struct objfile *)
static void add_data_symbol(SYMR *sh, union aux_ext *ax, int bigend, struct symbol *s, int aclass_index, struct block *b, struct objfile *objfile, const char *name)
static const char * fdr_name(FDR *f)
void elfmdebug_build_psymtabs(struct objfile *objfile, const struct ecoff_debug_swap *swap, asection *sec)
static const char * mdebug_next_symbol_text(struct objfile *)
static void pop_parse_stack(void)
#define MDEBUG_EFI_SYMBOL_NAME
#define SECT_OFF_BSS(objfile)
#define SECT_OFF_DATA(objfile)
#define SECT_OFF_TEXT(objfile)
const char * symtab_to_filename_for_display(struct symtab *symtab)
struct symbol * global_sym_chain[HASHSIZE]
void stabsread_new_init(void)
int hashname(const char *name)
void scan_file_globals(struct objfile *objfile)
const char *(* next_symbol_text_func)(struct objfile *)
unsigned char processing_gcc_compilation
#define next_symbol_text(objfile)
const block * superblock() const
multidictionary * multidict() const
void set_start(CORE_ADDR start)
void set_multidict(multidictionary *multidict)
void set_end(CORE_ADDR end)
void set_superblock(const block *superblock)
void set_function(symbol *function)
struct block * block(size_t i)
struct block * static_block()
gdb::array_view< struct block * > blocks()
void set_block(int i, struct block *block)
struct block * global_block()
void set_num_blocks(int num_blocks)
struct type * builtin_int
struct type * builtin_void
struct type * nodebug_text_symbol
symtab * primary_filetab() const
enum language language() const
void set_blockvector(struct blockvector *blockvector)
struct blockvector * blockvector()
void set_debugformat(const char *debugformat)
void set_const_val(LONGEST const_val)
void set_type(struct type *type)
void set_is_artificial(bool is_artificial)
unsigned int bitsize() const
void set_section_index(short idx)
const char * print_name() const
void compute_and_set_names(gdb::string_view linkage_name, bool copy_name, struct objfile_per_bfd_storage *per_bfd, gdb::optional< hashval_t > hash=gdb::optional< hashval_t >())
enum language language() const
void set_language(enum language language, struct obstack *obstack)
const char * linkage_name() const
void set_linkage_name(const char *linkage_name)
void expand_psymtab(struct objfile *objf) override
void * read_symtab_private
void(* legacy_expand_psymtab)(legacy_psymtab *, struct objfile *)
void(* legacy_read_symtab)(legacy_psymtab *, struct objfile *)
struct linetable_entry item[1]
const struct ecoff_debug_swap * debug_swap
struct ecoff_debug_info * debug_info
struct mdebug_pending ** pending_list
enum language pst_language
struct mdebug_pending * next
struct gdbarch * arch() const
struct objfile_per_bfd_storage * per_bfd
auto_obstack objfile_obstack
std::forward_list< quick_symbol_functions_up > qf
::section_offsets section_offsets
struct parse_stack * prev
struct parse_stack * next
struct partial_symtab ** dependencies
unsigned int text_low_valid
unrelocated_addr unrelocated_text_low() const
unsigned int text_high_valid
unrelocated_addr unrelocated_text_high() const
void set_text_high(unrelocated_addr addr)
int number_of_dependencies
struct partial_symtab * next
CORE_ADDR text_high(struct objfile *objfile) const
void expand_dependencies(struct objfile *)
void set_text_low(unrelocated_addr addr)
void add_psymbol(gdb::string_view name, bool copy_name, domain_enum domain, enum address_class theclass, short section, psymbol_placement where, unrelocated_addr coreaddr, enum language language, psymtab_storage *partial_symtabs, struct objfile *objfile)
CORE_ADDR text_low(struct objfile *objfile) const
const std::shared_ptr< psymtab_storage > & get_partial_symtabs() const
struct compunit_symtab * compunit_symtab
const block * value_block() const
struct type * type() const
void set_value_block(const block *block)
domain_enum domain() const
void set_aclass_index(unsigned int aclass_index)
LONGEST value_longest() const
const gdb_byte * value_bytes() const
void set_type(struct type *type)
void set_is_argument(bool is_argument)
void set_value_address(CORE_ADDR address)
void set_value_bytes(const gdb_byte *bytes)
void set_value_longest(LONGEST value)
void set_value_chain(symbol *sym)
void set_domain(domain_enum domain)
void set_symtab(struct symtab *symtab)
enum language language() const
void set_linetable(const struct linetable *linetable)
struct compunit_symtab * compunit() const
void set_language(enum language language)
const struct linetable * linetable() const
struct type * target_type() const
void set_is_prototyped(bool is_prototyped)
void set_code(type_code code)
struct field & field(int idx) const
void set_has_no_signedness(bool has_no_signedness)
void set_is_unsigned(bool is_unsigned)
void set_is_stub(bool is_stub)
void set_bounds(range_bounds *bounds)
void set_num_fields(unsigned int num_fields)
unsigned int num_fields() const
void set_name(const char *name)
void alloc_fields(unsigned int nfields, bool init=true)
void set_length(ULONGEST length)
struct field * fields() const
range_bounds * bounds() const
const char * name() const
void set_target_is_stub(bool target_is_stub)
enum language deduce_language_from_filename(const char *filename)
int get_section_index(struct objfile *objfile, const char *section_name)
void add_compunit_symtab_to_objfile(struct compunit_symtab *cu)
struct symtab * allocate_symtab(struct compunit_symtab *cust, const char *filename, const char *filename_for_id)
struct compunit_symtab * allocate_compunit_symtab(struct objfile *objfile, const char *name)
int register_symbol_register_impl(enum address_class aclass, const struct symbol_register_ops *ops)
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
std::vector< CORE_ADDR > section_offsets
void gdb_printf(struct ui_file *stream, const char *format,...)