[PATCH] libgomp: Add OMPD Address Space Information functions.

Jakub Jelinek jakub@redhat.com
Wed Jul 8 20:42:23 GMT 2020


On Wed, Jul 08, 2020 at 03:30:35PM -0400, y2s1982 wrote:
> +ompd_rc_t
> +ompd_get_omp_version (ompd_address_space_handle_t *address_space,
> +		      ompd_word_t *omp_version)
> +{
> +  if (omp_version == NULL)
> +    return ompd_rc_bad_input;
> +  if (address_space == NULL)
> +    return ompd_rc_stale_handle;
> +
> +  /* _OPENMP macro is defined to have yyyymm integer.  */
> +  ompd_size_t macro_length = sizeof (int);
> +
> +  ompd_rc_t ret = ompd_rc_ok;
> +
> +  struct ompd_address_t addr;
> +  ret = gompd_callbacks.symbol_addr_lookup (address_space->context, NULL,
> +					    "openmp_version", &addr, NULL);

This can't be right.  There is no openmp_version variable in libgomp.so.1
(and I don't think we should add it).
As I said multiple times before, you should add one (read-only) data
variable to libgomp.so.1 that will encode a lot of information that OMPD
needs and the version should be in there.

> +ompd_rc_t
> +ompd_get_omp_version_string (ompd_address_space_handle_t *address_space,
> +			     const char **string)
> +{
> +  if (string == NULL)
> +    return ompd_rc_bad_input;
> +
> +  if (address_space == NULL)
> +    return ompd_rc_stale_handle;
> +
> +  ompd_word_t omp_version;
> +  ompd_rc_t ret = ompd_get_omp_version (address_space, &omp_version);
> +  if (ret != ompd_rc_ok)
> +    return ret;
> +
> +  char *tmp = "GNU OpenMP Runtime implementing OpenMP 5.0 "
> +	    ompd_stringify (omp_version);

This will append "omp_version" to the string literal, won't it?
That is not what you want in there, you instead want the value.

	Jakub



More information about the Gcc-patches mailing list