// vi:set ft=cpp: -*- Mode: C++ -*-
/**
 * \file
 * \brief   Debug interface
 */
/*
 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
 *               Alexander Warg <warg@os.inf.tu-dresden.de>
 *     economic rights: Technische Universität Dresden (Germany)
 *
 * License: see LICENSE.spdx (in this directory or the directories above)
 */
#pragma once

#include <l4/sys/capability>
#include <l4/re/protocols.h>
#include <l4/sys/cxx/ipc_iface>

namespace L4Re {
/**
 * \defgroup api_l4re_debug Debugging API
 * \ingroup api_l4re
 * \brief Debugging Interface
 *
 * The debugging interface can be provided to retrieve, or log debugging
 * information for an object.
 * Each class may realize the debug interface to provide debugging
 * functionality. For example, the region map objects provide a facility to
 * dump the currently established memory regions.
 *
 * \see L4::Debug_obj for more information.
 */

/**
 * \brief Debug interface.
 * \ingroup api_l4re_debug
 *
 * \see \link api_l4re_debug Debugging API \endlink.
 */
class L4_EXPORT Debug_obj :
  public L4::Kobject_t<Debug_obj, L4::Kobject, L4RE_PROTO_DEBUG>
{
public:

  /**
   * \brief Debug call.
   *
   * \param function Function to call.
   * \return - L4_EOK
   *         - IPC errors
   *
   * An object can provide a number of debug functions, each identified by some
   * integer. This method is used to fan out to these functions from a common
   * entry point.
   */
  L4_INLINE_RPC(long, debug, (unsigned long function));
  typedef L4::Typeid::Rpc_nocode<debug_t> Rpcs;
};

template<typename BASE>
class Debug_obj_t :
  public L4::Kobject_2t<Debug_obj_t<BASE>, BASE, Debug_obj, L4::PROTO_EMPTY>
{
  typedef L4::Typeid::Rpcs<> Rpcs;
};
}
