2 * Copyright 2007, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Hugo Santos <hugosantos@gmail.com>
7 * Ingo Weinhold <bonefish@cs.tu-berlin.de>
9 #ifndef STRACE_CONTEXT_H
10 #define STRACE_CONTEXT_H
18 ENUMERATIONS
= 1 << 1,
19 SIMPLE_STRUCTS
= 1 << 2,
20 COMPLEX_STRUCTS
= 1 << 3,
21 POINTER_VALUES
= 1 << 4,
25 Context(Syscall
*sc
, char *data
, MemoryReader
&reader
,
26 uint32 flags
, bool decimal
)
27 : fSyscall(sc
), fData(data
), fReader(reader
),
28 fFlags(flags
), fDecimal(decimal
) {}
30 Parameter
*GetSibling(int32 index
) const {
31 return fSyscall
->ParameterAt(index
);
34 const void *GetValue(Parameter
*param
) const {
35 return fData
+ param
->Offset();
38 MemoryReader
&Reader() { return fReader
; }
39 bool GetContents(uint32 what
) const { return fFlags
& what
; }
41 string
FormatSigned(int64 value
, int bytes
= 8) const;
42 string
FormatUnsigned(uint64 value
) const;
43 string
FormatFlags(uint64 value
) const;
45 string
FormatPointer(const void *address
) const;
50 MemoryReader
&fReader
;
55 #endif // STRACE_CONTEXT_H