From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2103) id 949493849AF7; Fri, 19 Apr 2024 15:51:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 949493849AF7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713541899; bh=j0FhnYtpGKR8UnOGQvqIDmTwkqY/hZ042IMotkObF6w=; h=From:To:Subject:Date:From; b=ModFsmdL3sQzAmAvUykYzrKsmS56W5uLwcnhCEyAnqV/+2roMAAeEf6nsUWzEY+j1 xz+YqZllKO2AKSIR5Rx5qXmoeOEZjOCzcDhn5geeOgbxj+um6x+Z6Vd60pmEJ0HQ+q T1aYwsEPlBsuKXHQZbNb/kG+CdFRiSinD/wOwIRw= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nick Alcock To: binutils-cvs@sourceware.org Subject: [binutils-gdb] libctf: rename ctf_dict.ctf_{symtab,strtab} X-Act-Checkin: binutils-gdb X-Git-Author: Nick Alcock X-Git-Refname: refs/heads/master X-Git-Oldrev: bb2a9a465e02e8cee00736351d10bde914f50758 X-Git-Newrev: 629acbe4a32fc2a53e448ce2c704e788f9fbad9f Message-Id: <20240419155139.949493849AF7@sourceware.org> Date: Fri, 19 Apr 2024 15:51:39 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D629acbe4a32f= c2a53e448ce2c704e788f9fbad9f commit 629acbe4a32fc2a53e448ce2c704e788f9fbad9f Author: Nick Alcock Date: Fri Jan 5 12:17:27 2024 +0000 libctf: rename ctf_dict.ctf_{symtab,strtab} =20 These two fields are constantly confusing because CTF dicts contain both a symtypetab and strtab, but these fields are not that: they are the symtab and strtab from the ELF file. We have enough string tables now (internal, external, synthetic external, dynamic) that we need to at least name them better than this to avoid getting totally confused. Rename them to ctf_ext_symtab and ctf_ext_strtab. =20 libctf/ =20 * ctf-dump.c (ctf_dump_objts): Rename ctf_symtab -> ctf_ext_sym= tab. * ctf-impl.h (struct ctf_dict.ctf_symtab): Rename to... (struct ctf_dict.ctf_ext_strtab): ... this. (struct ctf_dict.ctf_strtab): Rename to... (struct ctf_dict.ctf_ext_strtab): ... this. * ctf-lookup.c (ctf_lookup_symbol_name): Adapt. (ctf_lookup_symbol_idx): Adapt. (ctf_lookup_by_sym_or_name): Adapt. * ctf-open.c (ctf_bufopen_internal): Adapt. (ctf_dict_close): Adapt. (ctf_getsymsect): Adapt. (ctf_getstrsect): Adapt. (ctf_symsect_endianness): Adapt. Diff: --- libctf/ctf-dump.c | 2 +- libctf/ctf-impl.h | 6 +++--- libctf/ctf-lookup.c | 6 +++--- libctf/ctf-open.c | 36 ++++++++++++++++++------------------ 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index 11179a61386..474c4e00cea 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -441,7 +441,7 @@ ctf_dump_objts (ctf_dict_t *fp, ctf_dump_state_t *state= , int functions) if ((functions && fp->ctf_funcidx_names) || (!functions && fp->ctf_objtidx_names)) str =3D str_append (str, _("Section is indexed.\n")); - else if (fp->ctf_symtab.cts_data =3D=3D NULL) + else if (fp->ctf_ext_symtab.cts_data =3D=3D NULL) str =3D str_append (str, _("No symbol table.\n")); =20 while ((id =3D ctf_symbol_next (fp, &i, &name, functions)) !=3D CTF_ERR) diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index b7123317c98..8ce489a55ba 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -366,9 +366,9 @@ struct ctf_dict struct ctf_header *ctf_header; /* The header from this CTF dict. */ unsigned char ctf_openflags; /* Flags the dict had when opened. */ ctf_sect_t ctf_data; /* CTF data from object file. */ - ctf_sect_t ctf_symtab; /* Symbol table from object file. */ - ctf_sect_t ctf_strtab; /* String table from object file. */ - int ctf_symsect_little_endian; /* Endianness of the ctf_symtab. */ + ctf_sect_t ctf_ext_symtab; /* Symbol table from object file. */ + ctf_sect_t ctf_ext_strtab; /* String table from object file. */ + int ctf_symsect_little_endian; /* Endianness of the ctf_ext_symtab. = */ ctf_dynhash_t *ctf_symhash_func; /* (partial) hash, symsect name -> idx= . */ ctf_dynhash_t *ctf_symhash_objt; /* ditto, for object symbols. */ size_t ctf_symhash_latest; /* Amount of symsect scanned so far. */ diff --git a/libctf/ctf-lookup.c b/libctf/ctf-lookup.c index 1fcbebee2d1..aa251bafb89 100644 --- a/libctf/ctf-lookup.c +++ b/libctf/ctf-lookup.c @@ -469,7 +469,7 @@ ctf_symidx_sort (ctf_dict_t *fp, uint32_t *idx, size_t = *nidx, static const char * ctf_lookup_symbol_name (ctf_dict_t *fp, unsigned long symidx) { - const ctf_sect_t *sp =3D &fp->ctf_symtab; + const ctf_sect_t *sp =3D &fp->ctf_ext_symtab; ctf_link_sym_t sym; int err; =20 @@ -540,7 +540,7 @@ static unsigned long ctf_lookup_symbol_idx (ctf_dict_t *fp, const char *symname, int try_parent, int is_function) { - const ctf_sect_t *sp =3D &fp->ctf_symtab; + const ctf_sect_t *sp =3D &fp->ctf_ext_symtab; ctf_link_sym_t sym; void *known_idx; int err; @@ -973,7 +973,7 @@ ctf_lookup_by_sym_or_name (ctf_dict_t *fp, unsigned lon= g symidx, const char *symname, int try_parent, int is_function) { - const ctf_sect_t *sp =3D &fp->ctf_symtab; + const ctf_sect_t *sp =3D &fp->ctf_ext_symtab; ctf_id_t type =3D 0; int err =3D 0; =20 diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index f80bf5476a7..22475465fa8 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -1626,8 +1626,8 @@ ctf_bufopen_internal (const ctf_sect_t *ctfsect, cons= t ctf_sect_t *symsect, =20 if (symsect !=3D NULL) { - memcpy (&fp->ctf_symtab, symsect, sizeof (ctf_sect_t)); - memcpy (&fp->ctf_strtab, strsect, sizeof (ctf_sect_t)); + memcpy (&fp->ctf_ext_symtab, symsect, sizeof (ctf_sect_t)); + memcpy (&fp->ctf_ext_strtab, strsect, sizeof (ctf_sect_t)); } =20 if (fp->ctf_data.cts_name !=3D NULL) @@ -1636,14 +1636,14 @@ ctf_bufopen_internal (const ctf_sect_t *ctfsect, co= nst ctf_sect_t *symsect, err =3D ENOMEM; goto bad; } - if (fp->ctf_symtab.cts_name !=3D NULL) - if ((fp->ctf_symtab.cts_name =3D strdup (fp->ctf_symtab.cts_name)) =3D= =3D NULL) + if (fp->ctf_ext_symtab.cts_name !=3D NULL) + if ((fp->ctf_ext_symtab.cts_name =3D strdup (fp->ctf_ext_symtab.cts_na= me)) =3D=3D NULL) { err =3D ENOMEM; goto bad; } - if (fp->ctf_strtab.cts_name !=3D NULL) - if ((fp->ctf_strtab.cts_name =3D strdup (fp->ctf_strtab.cts_name)) =3D= =3D NULL) + if (fp->ctf_ext_strtab.cts_name !=3D NULL) + if ((fp->ctf_ext_strtab.cts_name =3D strdup (fp->ctf_ext_strtab.cts_na= me)) =3D=3D NULL) { err =3D ENOMEM; goto bad; @@ -1651,10 +1651,10 @@ ctf_bufopen_internal (const ctf_sect_t *ctfsect, co= nst ctf_sect_t *symsect, =20 if (fp->ctf_data.cts_name =3D=3D NULL) fp->ctf_data.cts_name =3D _CTF_NULLSTR; - if (fp->ctf_symtab.cts_name =3D=3D NULL) - fp->ctf_symtab.cts_name =3D _CTF_NULLSTR; - if (fp->ctf_strtab.cts_name =3D=3D NULL) - fp->ctf_strtab.cts_name =3D _CTF_NULLSTR; + if (fp->ctf_ext_symtab.cts_name =3D=3D NULL) + fp->ctf_ext_symtab.cts_name =3D _CTF_NULLSTR; + if (fp->ctf_ext_strtab.cts_name =3D=3D NULL) + fp->ctf_ext_strtab.cts_name =3D _CTF_NULLSTR; =20 if (strsect !=3D NULL) { @@ -1836,11 +1836,11 @@ ctf_dict_close (ctf_dict_t *fp) if (fp->ctf_data.cts_name !=3D _CTF_NULLSTR) free ((char *) fp->ctf_data.cts_name); =20 - if (fp->ctf_symtab.cts_name !=3D _CTF_NULLSTR) - free ((char *) fp->ctf_symtab.cts_name); + if (fp->ctf_ext_symtab.cts_name !=3D _CTF_NULLSTR) + free ((char *) fp->ctf_ext_symtab.cts_name); =20 - if (fp->ctf_strtab.cts_name !=3D _CTF_NULLSTR) - free ((char *) fp->ctf_strtab.cts_name); + if (fp->ctf_ext_strtab.cts_name !=3D _CTF_NULLSTR) + free ((char *) fp->ctf_ext_strtab.cts_name); else if (fp->ctf_data_mmapped) ctf_munmap (fp->ctf_data_mmapped, fp->ctf_data_mmapped_len); =20 @@ -1909,13 +1909,13 @@ ctf_getdatasect (const ctf_dict_t *fp) ctf_sect_t ctf_getsymsect (const ctf_dict_t *fp) { - return fp->ctf_symtab; + return fp->ctf_ext_symtab; } =20 ctf_sect_t ctf_getstrsect (const ctf_dict_t *fp) { - return fp->ctf_strtab; + return fp->ctf_ext_strtab; } =20 /* Set the endianness of the symbol table attached to FP. */ @@ -1930,8 +1930,8 @@ ctf_symsect_endianness (ctf_dict_t *fp, int little_en= dian) our idea of the endianness has changed. */ =20 if (old_endianness !=3D fp->ctf_symsect_little_endian - && fp->ctf_sxlate !=3D NULL && fp->ctf_symtab.cts_data !=3D NULL) - assert (init_symtab (fp, fp->ctf_header, &fp->ctf_symtab) =3D=3D 0); + && fp->ctf_sxlate !=3D NULL && fp->ctf_ext_symtab.cts_data !=3D NULL) + assert (init_symtab (fp, fp->ctf_header, &fp->ctf_ext_symtab) =3D=3D 0= ); } =20 /* Return the CTF handle for the parent CTF dict, if one exists. Otherwise