From 4b05be4265c0ffacfce26d7db7644ffbf9037696 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Tue, 26 Jun 2018 11:47:15 +0200 Subject: [PATCH] linux: fix ARM snapshot context traits build. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On GCC with libstdc++, ContextTraits fail to build because of the missing declaration of offsetof (should include cstddef) and for aliasing a type with the same name overriding previous declaration. Change-Id: Ic497238122bcb430f14f9234644c483a8e27e3b6 Reviewed-on: https://chromium-review.googlesource.com/1114606 Reviewed-by: Robert Sesek Commit-Queue: José Dapena Paz --- snapshot/linux/exception_snapshot_linux.cc | 4 ++-- snapshot/linux/signal_context.h | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/snapshot/linux/exception_snapshot_linux.cc b/snapshot/linux/exception_snapshot_linux.cc index 6e2a9275..c57e072e 100644 --- a/snapshot/linux/exception_snapshot_linux.cc +++ b/snapshot/linux/exception_snapshot_linux.cc @@ -130,7 +130,7 @@ bool ExceptionSnapshotLinux::ReadContext( LinuxVMAddress gprs_address = context_address + offsetof(UContext, mcontext32) + - offsetof(MContext32, gprs); + offsetof(ContextTraits32::MContext32, gprs); SignalThreadContext32 thread_context; if (!memory->Read(gprs_address, sizeof(thread_context), &thread_context)) { @@ -207,7 +207,7 @@ bool ExceptionSnapshotLinux::ReadContext( LinuxVMAddress gprs_address = context_address + offsetof(UContext, mcontext64) + - offsetof(MContext64, gprs); + offsetof(ContextTraits64::MContext64, gprs); ThreadContext::t64_t thread_context; if (!memory->Read(gprs_address, sizeof(thread_context), &thread_context)) { diff --git a/snapshot/linux/signal_context.h b/snapshot/linux/signal_context.h index f9d2cb9d..98844151 100644 --- a/snapshot/linux/signal_context.h +++ b/snapshot/linux/signal_context.h @@ -19,6 +19,7 @@ #include #include +#include #include #include "build/build_config.h" @@ -244,7 +245,7 @@ struct SignalThreadContext32 { using SignalThreadContext64 = ThreadContext::t64_t; -struct MContext32 { +struct MContext32Data { uint32_t trap_no; uint32_t error_code; uint32_t oldmask; @@ -252,19 +253,19 @@ struct MContext32 { uint32_t fault_address; }; -struct MContext64 { +struct MContext64Data { uint64_t fault_address; SignalThreadContext64 gprs; }; struct ContextTraits32 : public Traits32 { - using MContext32 = MContext32; + using MContext32 = MContext32Data; using MContext64 = Nothing; }; struct ContextTraits64 : public Traits64 { using MContext32 = Nothing; - using MContext64 = MContext64; + using MContext64 = MContext64Data; }; template