linux: fix ARM snapshot context traits build.

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 <rsesek@chromium.org>
Commit-Queue: José Dapena Paz <jose.dapena@lge.com>
This commit is contained in:
Jose Dapena Paz 2018-06-26 11:47:15 +02:00 committed by Commit Bot
parent 17dff19b21
commit 4b05be4265
2 changed files with 7 additions and 6 deletions

View File

@ -130,7 +130,7 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
LinuxVMAddress gprs_address =
context_address + offsetof(UContext<ContextTraits32>, 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<ContextTraits64>(
LinuxVMAddress gprs_address =
context_address + offsetof(UContext<ContextTraits64>, mcontext64) +
offsetof(MContext64, gprs);
offsetof(ContextTraits64::MContext64, gprs);
ThreadContext::t64_t thread_context;
if (!memory->Read(gprs_address, sizeof(thread_context), &thread_context)) {

View File

@ -19,6 +19,7 @@
#include <stdint.h>
#include <sys/types.h>
#include <cstddef>
#include <type_traits>
#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 <typename Traits>