https://bugs.kde.org/show_bug.cgi?id=477630

            Bug ID: 477630
           Summary: Include ucontext.h rather than sys/ucontext.h in
                    Solaris sources
    Classification: Developer tools
           Product: valgrind
           Version: 3.21.0
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: kulik...@gmail.com
  Target Milestone: ---

Created attachment 163547
  --> https://bugs.kde.org/attachment.cgi?id=163547&action=edit
ucontext patch

Recently, Oracle Solaris introduced some changes to "ucontext.h" and
"sys/ucontext.h" headers, which made short register names on 32bit Solaris no
longer available in "sys/ucontext.h", resulting in the following Valgrind build
failures:

/builds/valgrind/valgrind-3.21.0/include/vki/vki-solaris.h:1398:17: error:
'EIP' undeclared (first use in this function); did you mean 'EIO'?
 1398 | #define VKI_EIP EIP
      |                 ^~~
m_signals.c:632:74: note: in expansion of macro 'VKI_EIP'
  632 | #  define VG_UCONTEXT_INSTR_PTR(uc)      
((Addr)(uc)->uc_mcontext.gregs[VKI_EIP])
      | 

They are still available when "ucontext.h" is included, which (as I was told by
more knowledgeable people internally) is the header that should be included
anyway (sys/ucontext.h is not part of the ABI).

And so, in the attached patch, I changed all includes from "sys/ucontext.h" to
"ucontext.h" in all Solaris related source files.
(In theory, only a few header files needed this change to build Valgrind, but I
don't see any harm in changing all of them to "more correct" one).

I did a test on Illumos/OpenIndiana that changing all "sys/ucontext.h" includes
to "ucontext.h" didn't break anything there (as this doesn't affect OpenSolaris
distros).


Side note:
Internally, I initially solved it by replacing all short names with long ones:
https://github.com/oracle/solaris-userland/blob/ef7a00bf2fb7f6a16a451d57c477778007aee2ee/components/valgrind/patches/02-registers.patch
but that might not work cross platform - the attached patch should work
everywhere.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to