Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright notices
[simgrid.git] / src / mc / mc_memory_map.h
index 12da85f..1a52bff 100644 (file)
@@ -1,49 +1,49 @@
-/* Copyright (c) 2007-2014. The SimGrid Team.
+/* Copyright (c) 2007-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef MC_MEMORY_MAP_H
-#define MC_MEMORY_MAP_H
+#ifndef SIMGRID_MC_MEMORY_MAP_H
+#define SIMGRID_MC_MEMORY_MAP_H
 
-#include <sys/types.h>
+#include <cstdint>
 
-#include <simgrid_config.h>
-#include "mc_forward.h"
+#include <string>
+#include <vector>
 
-SG_BEGIN_DECL()
+#include <sys/types.h>
 
-/** \file
- *   These functions and data structures implements a binary interface for
- *   the proc maps ascii interface                                           */
+#include <xbt/base.h>
 
-/* Each field is defined as documented in proc's manual page  */
-struct s_map_region {
+#include <simgrid_config.h>
+#include "mc_forward.hpp"
 
-  void *start_addr;             /* Start address of the map */
-  void *end_addr;               /* End address of the map */
+namespace simgrid {
+namespace mc {
+
+/** An virtual memory map entry from /proc/$pid/maps */
+struct VmMap {
+  std::uint64_t start_addr, end_addr;
   int prot;                     /* Memory protection */
   int flags;                    /* Additional memory flags */
-  void *offset;                 /* Offset in the file/whatever */
+  std::uint64_t offset;         /* Offset in the file/whatever */
   char dev_major;               /* Major of the device */
   char dev_minor;               /* Minor of the device */
   unsigned long inode;          /* Inode in the device */
-  char *pathname;               /* Path name of the mapped file */
-
+  std::string pathname;         /* Path name of the mapped file */
 };
-typedef struct s_map_region s_map_region_t, *map_region_t;
 
-struct s_memory_map {
+std::vector<VmMap> get_memory_map(pid_t pid);
 
-  s_map_region_t *regions;      /* Pointer to an array of regions */
-  int mapsize;                  /* Number of regions in the memory */
+}
+}
 
-};
+extern "C" {
 
-memory_map_t MC_get_memory_map(pid_t pid);
-void MC_free_memory_map(memory_map_t map);
+XBT_INTERNAL void MC_find_object_address(
+  std::vector<simgrid::mc::VmMap> const& maps, simgrid::mc::ObjectInformation* result);
 
-SG_END_DECL()
+}
 
 #endif