* Context got its own source and header files. * Syscall::GetSyscall() had little to do with the Syscall class itself; it's get_syscall() now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20424 a95241bf-73f2-0310-859d-f6bbb57e9c96
53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
/*
|
|
* Copyright 2007, Haiku Inc. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* Hugo Santos <[email protected]>
|
|
* Ingo Weinhold <[email protected]>
|
|
*/
|
|
#ifndef STRACE_CONTEXT_H
|
|
#define STRACE_CONTEXT_H
|
|
|
|
#include "Syscall.h"
|
|
|
|
class Context {
|
|
public:
|
|
enum {
|
|
STRINGS = 1 << 0,
|
|
ENUMERATIONS = 1 << 1,
|
|
SIMPLE_STRUCTS = 1 << 2,
|
|
COMPLEX_STRUCTS = 1 << 3,
|
|
ALL = 0xffffffff
|
|
};
|
|
|
|
Context(Syscall *sc, char *data, MemoryReader &reader,
|
|
uint32 flags, bool decimal)
|
|
: fSyscall(sc), fData(data), fReader(reader),
|
|
fFlags(flags), fDecimal(decimal) {}
|
|
|
|
Parameter *GetSibling(int32 index) const {
|
|
return fSyscall->ParameterAt(index);
|
|
}
|
|
|
|
const void *GetValue(Parameter *param) const {
|
|
return fData + param->Offset();
|
|
}
|
|
|
|
MemoryReader &Reader() { return fReader; }
|
|
bool GetContents(uint32 what) const { return fFlags & what; }
|
|
|
|
string FormatSigned(int64 value, const char *modifier = "ll") const;
|
|
string FormatUnsigned(uint64 value) const;
|
|
string FormatFlags(uint64 value) const;
|
|
|
|
private:
|
|
Syscall *fSyscall;
|
|
char *fData;
|
|
MemoryReader &fReader;
|
|
uint32 fFlags;
|
|
bool fDecimal;
|
|
};
|
|
|
|
#endif // STRACE_CONTEXT_H
|