mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
Compare commits
4 Commits
binutils-2
...
users/nalc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11bacd955a | ||
|
|
ee42b0ad05 | ||
|
|
70edb89629 | ||
|
|
ed6eed44b8 |
@@ -788,7 +788,7 @@ ctf_add_struct_sized (ctf_dict_t *fp, uint32_t flag, const char *name,
|
||||
size_t initial_vlen = sizeof (ctf_lmember_t) * INITIAL_VLEN;
|
||||
|
||||
/* Promote root-visible forwards to structs. */
|
||||
if (name != NULL)
|
||||
if (name != NULL && flag == CTF_ADD_ROOT)
|
||||
type = ctf_lookup_by_rawname (fp, CTF_K_STRUCT, name);
|
||||
|
||||
/* Prohibit promotion if this type was ctf_open()ed. */
|
||||
@@ -832,7 +832,7 @@ ctf_add_union_sized (ctf_dict_t *fp, uint32_t flag, const char *name,
|
||||
size_t initial_vlen = sizeof (ctf_lmember_t) * INITIAL_VLEN;
|
||||
|
||||
/* Promote root-visible forwards to unions. */
|
||||
if (name != NULL)
|
||||
if (name != NULL && flag == CTF_ADD_ROOT)
|
||||
type = ctf_lookup_by_rawname (fp, CTF_K_UNION, name);
|
||||
|
||||
/* Prohibit promotion if this type was ctf_open()ed. */
|
||||
@@ -875,7 +875,7 @@ ctf_add_enum (ctf_dict_t *fp, uint32_t flag, const char *name)
|
||||
size_t initial_vlen = sizeof (ctf_enum_t) * INITIAL_VLEN;
|
||||
|
||||
/* Promote root-visible forwards to enums. */
|
||||
if (name != NULL)
|
||||
if (name != NULL && flag == CTF_ADD_ROOT)
|
||||
type = ctf_lookup_by_rawname (fp, CTF_K_ENUM, name);
|
||||
|
||||
/* Prohibit promotion if this type was ctf_open()ed. */
|
||||
@@ -1073,7 +1073,7 @@ ctf_add_enumerator (ctf_dict_t *fp, ctf_id_t enid, const char *name,
|
||||
/* Enumeration constant names are only added, and only checked for duplicates,
|
||||
if the enum they are part of is a root-visible type. */
|
||||
|
||||
if (root == CTF_ADD_ROOT && ctf_dynhash_lookup (fp->ctf_names, name))
|
||||
if (root && ctf_dynhash_lookup (fp->ctf_names, name))
|
||||
{
|
||||
if (fp->ctf_flags & LCTF_STRICT_NO_DUP_ENUMERATORS)
|
||||
return (ctf_set_errno (ofp, ECTF_DUPLICATE));
|
||||
|
||||
@@ -829,7 +829,7 @@ of kind @code{CTF_K_UNKNOWN}.
|
||||
|
||||
@item 4
|
||||
@tab @code{CTF_K_ARRAY}
|
||||
@tab An array. @xref{Arrays}.
|
||||
@tab An array or SIMD vector. @xref{Arrays}.
|
||||
|
||||
@item 5
|
||||
@tab @code{CTF_K_FUNCTION}
|
||||
@@ -1064,7 +1064,7 @@ unused and will become used in future.
|
||||
@tindex CTF_FP_LDCPLX
|
||||
@item 6
|
||||
@tab @code{CTF_FP_LDOUBLE}
|
||||
@tab This is a @code{long double}.
|
||||
@tab This is a @code{long double}, or quad-precision IEEE 754-2008 @code{__float128}.
|
||||
@tindex CTF_FP_LDOUBLE
|
||||
@item 7
|
||||
@tab @code{CTF_FP_INTRVL}
|
||||
@@ -1232,6 +1232,13 @@ Arrays are encoded as types of kind @code{CTF_K_ARRAY} in a @code{ctf_stype_t}.
|
||||
Both size and kind for arrays are zero. The variable-length data is a
|
||||
@code{ctf_array_t}: @code{vlen} in the info word should be disregarded and is
|
||||
always zero.
|
||||
@c In CTFv4 and BTF, the @code{kind_flag} member of @{ctf_array_t} is not set.
|
||||
|
||||
SIMD vectors are also encoded as types of kind @code{CTF_K_ARRAY} in a
|
||||
@code{ctf_stype_t}. Both size and kind for arrays are zero. The
|
||||
variable-length data is a @code{ctf_array_t}: @code{vlen} in the info word
|
||||
should be disregarded and is always zero.
|
||||
@c In CTFv4 and BTF, the @code{kind_flag} member of @{ctf_array_t} is set.
|
||||
|
||||
@verbatim
|
||||
typedef struct ctf_array
|
||||
|
||||
38
libctf/testsuite/libctf-writable/ctf-nonroot-addition.c
Normal file
38
libctf/testsuite/libctf-writable/ctf-nonroot-addition.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* Make sure adding a non-root-visible type after adding a root-visible forward
|
||||
adds a new type rather than promoting and returning the existing one. */
|
||||
|
||||
#include <ctf-api.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
ctf_dict_t *fp;
|
||||
ctf_id_t root, nonroot;
|
||||
int err;
|
||||
|
||||
if ((fp = ctf_create (&err)) == NULL)
|
||||
{
|
||||
fprintf (stderr, "Cannot create: %s\n", ctf_errmsg (err));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((root = ctf_add_forward (fp, CTF_ADD_ROOT, "foo", CTF_K_ENUM)) == CTF_ERR)
|
||||
goto add_err;
|
||||
|
||||
if ((nonroot = ctf_add_enum (fp, CTF_ADD_NONROOT, "foo")) == CTF_ERR)
|
||||
goto add_err;
|
||||
|
||||
if (nonroot == root)
|
||||
fprintf (stderr, "Non-root addition should not promote root-visible forwards\n");
|
||||
else
|
||||
printf ("All done.\n");
|
||||
|
||||
ctf_dict_close (fp);
|
||||
return 0;
|
||||
|
||||
add_err:
|
||||
fprintf (stderr, "Cannot add: %s\n", ctf_errmsg (ctf_errno (fp)));
|
||||
}
|
||||
1
libctf/testsuite/libctf-writable/ctf-nonroot-addition.lk
Normal file
1
libctf/testsuite/libctf-writable/ctf-nonroot-addition.lk
Normal file
@@ -0,0 +1 @@
|
||||
All done.
|
||||
Reference in New Issue
Block a user