blob: 9bc21b6a65e7339fa231d7b8a5e423ad153f4966 [file] [log] [blame]
//===- Report.h -------------------------------------------------*- C++ -*-===//
//
// The SAFECode Compiler Project
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file define the interfaces for reporting memory safety violation found
// by SAFECode.
// Implemenation can inherit from ViolationInfo to store more information.
//
//===----------------------------------------------------------------------===//
#ifndef _REPORT_H_
#define _REPORT_H_
#include "safecode/SAFECode.h"
#include <iosfwd>
NAMESPACE_SC_BEGIN
struct ViolationInfo {
enum {
FAULT_DANGLING_PTR,
FAULT_DOUBLE_FREE,
FAULT_INVALID_FREE,
FAULT_NOTHEAP_FREE,
FAULT_OUT_OF_BOUNDS,
FAULT_LOAD_STORE,
FAULT_ALIGN,
FAULT_WRITE_OUT_OF_BOUNDS,
FAULT_UNINIT,
FAULT_CSTDLIB
};
/// Type of violation
unsigned int type;
/// The program counter of the instruction generating the violations
const void * faultPC;
/// The pointer generating the violations
const void * faultPtr;
virtual void print(std::ostream & OS) const;
virtual ~ViolationInfo();
};
//
// Function: ReportMemoryViolation()
//
// Description:
// Report a memory violation
//
void
ReportMemoryViolation (const ViolationInfo * info);
NAMESPACE_SC_END
#endif