tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / bin / debug / strace / Context.h
blobf8ba3bfbebc9e4f82ce88759f7b078c231a533e4
1 /*
2 * Copyright 2007, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Hugo Santos <hugosantos@gmail.com>
7 * Ingo Weinhold <bonefish@cs.tu-berlin.de>
8 */
9 #ifndef STRACE_CONTEXT_H
10 #define STRACE_CONTEXT_H
12 #include "Syscall.h"
14 class Context {
15 public:
16 enum {
17 STRINGS = 1 << 0,
18 ENUMERATIONS = 1 << 1,
19 SIMPLE_STRUCTS = 1 << 2,
20 COMPLEX_STRUCTS = 1 << 3,
21 POINTER_VALUES = 1 << 4,
22 ALL = 0xffffffff
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;
47 private:
48 Syscall *fSyscall;
49 char *fData;
50 MemoryReader &fReader;
51 uint32 fFlags;
52 bool fDecimal;
55 #endif // STRACE_CONTEXT_H