diff options
author | Tom Jones <thj@freebsd.org> | 2024-01-26 15:16:57 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2024-02-13 16:24:45 +0000 |
commit | 7d2978dab920b86b28f2f7f1c8823a4b28e68dd1 (patch) | |
tree | dec0584ca7f8414a2ce1befc4c48e4be388f2cfc /src/vppinfra/unix-formats.c | |
parent | 249f0dcdf6d0f1656a1a5d4178c3315b8ea520c0 (diff) |
vppinfra: Make program counter printing more portable
Finding the program counter in the ucontext struct is platform and
architecture specific, place the Linux checks inside an #ifdef and add a
look up for the FreeBSD amd64 specific naming.
Type: improvement
Change-Id: I42fcef5f20227c23d84acee336e37c4870146bb4
Signed-off-by: Tom Jones <thj@freebsd.org>
Diffstat (limited to 'src/vppinfra/unix-formats.c')
-rw-r--r-- | src/vppinfra/unix-formats.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vppinfra/unix-formats.c b/src/vppinfra/unix-formats.c index d46b00a450c..297a3fdb8c2 100644 --- a/src/vppinfra/unix-formats.c +++ b/src/vppinfra/unix-formats.c @@ -432,6 +432,7 @@ u8 * format_ucontext_pc (u8 * s, va_list * args) uc = va_arg (*args, ucontext_t *); +#ifdef __linux__ #if defined (powerpc) regs = &uc->uc_mcontext.uc_regs->gregs[0]; #elif defined (powerpc64) @@ -454,6 +455,13 @@ u8 * format_ucontext_pc (u8 * s, va_list * args) reg_no = 0; regs = 0; #endif +#elif __FreeBSD__ +#if defined(__amd64__) + reg_no = 0; + regs = (void *) &uc->uc_mcontext.mc_rip; +#else +#endif /* __amd64__ */ +#endif /* __linux__ */ if (! regs) return format (s, "unsupported"); |