Fwd: [PATCH 2/4] covoar: Use DWARF to map addresses to source files and lines.

Chris Johns chrisj at rtems.org
Mon May 7 20:58:36 UTC 2018


On 08/05/2018 03:56, Joel Sherrill wrote:
> 
> I have attached a workaround.

Looks like a solution to me.

> It seems that libgen.h has this:
> 
> ========================================================
> /* Return final component of PATH.
> 
>    This is the weird XPG version of this function.  It sometimes will
>    modify its argument.  Therefore we normally use the GNU version (in
>    <string.h>) and only if this header is included make the XPG
>    version available under the real name.  */
> extern char *__xpg_basename (char *__path) __THROW;
> #define basename        __xpg_basename
> ========================================================
>

Oh yuck, who would ever work in standards. ;)

Is this function allowed to be redefined as a macro?

> Chris has used basename as a method name and even though that should
> be perfectly acceptable, the macro above gets expanded, the name 
> gets changed (in some places) to rld::path::__xpg_basename()
> 
>       r.lowSourceLine = rld::path::basename (location);
> 
> IMO the fix is to add dirname to rld-files, use rld basename and dirname
> exclusively, and avoid libgen.h at all costs.

Wouldn't the world be so much simpler if there was only Linux? ;)

> I didn't do that much work. I got lucky in a couple of files by removing the
> include of libgen.h since it wasn't needed but I had to leave it in one place.
> 
> $ grep dirname *.cc
> GcovData.cc:    dirname( path );
> 
> Hopefully this lets you all proceed with Chris' patches and my slight hack
> in place.
> 
> Ultimate solution is probably simple. We just need to hear from Chris.

This is fine. I am slowing move covoar to use more and more of the rtemstoolkit.

I will merge these changes into a v2 patch set.

Chris


More information about the devel mailing list