After tested under windows.
[dyninst.git] / patchAPI / src / AddrSpace.C
1 /* Public Interface */
2
3 #include "AddrSpace.h"
4 #include "PatchObject.h"
5
6 using Dyninst::PatchAPI::AddrSpace;
7 using Dyninst::PatchAPI::AddrSpacePtr;
8 using Dyninst::PatchAPI::PatchObject;
9
10 /* Use an PatchObject (a.out) to initialize the AddrSpace */
11
12 bool
13 AddrSpace::init(PatchObject* obj) {
14   first_object_ = obj;
15   loadObject(obj);
16   return true;
17 }
18
19 AddrSpacePtr
20 AddrSpace::create(PatchObject* obj) {
21   AddrSpacePtr ret = AddrSpacePtr(new AddrSpace());
22   if (!ret) return AddrSpacePtr();
23   ret->init(obj);
24   return ret;
25 }
26
27 bool
28 AddrSpace::loadObject(PatchObject* obj) {
29   obj_set_.insert(obj);
30   obj->setAddrSpace(shared_from_this());
31   return true;
32 }
33
34 AddrSpace::~AddrSpace() {
35   for (ObjSet::iterator i = obj_set_.begin(); i != obj_set_.end(); i++) {
36     PatchObject* obj = *i;
37     delete obj;
38   }
39 }
40
41 bool AddrSpace::write(PatchObject* /*obj*/, Address /*to*/,
42                       Address /*from*/, size_t /*size*/)
43 {  return false; }
44
45 Address AddrSpace::malloc(PatchObject* /*obj*/, size_t /*size*/,
46                           Address /*near*/)
47 {  return false; }
48
49 bool AddrSpace::realloc(PatchObject* /*obj*/, Address /*orig*/,
50                         size_t /*size*/)
51 {  return false; }
52
53 bool AddrSpace::free(PatchObject* /*obj*/, Address /*orig*/)
54 {  return false; }