object_file.cc (2665:a124942bacb8) | object_file.cc (3584:8c3cdb2c001c) |
---|---|
1/* 2 * Copyright (c) 2002-2004 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 31 unchanged lines hidden (view full) --- 40 41#include "base/cprintf.hh" 42#include "base/loader/object_file.hh" 43#include "base/loader/symtab.hh" 44 45#include "base/loader/ecoff_object.hh" 46#include "base/loader/aout_object.hh" 47#include "base/loader/elf_object.hh" | 1/* 2 * Copyright (c) 2002-2004 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 31 unchanged lines hidden (view full) --- 40 41#include "base/cprintf.hh" 42#include "base/loader/object_file.hh" 43#include "base/loader/symtab.hh" 44 45#include "base/loader/ecoff_object.hh" 46#include "base/loader/aout_object.hh" 47#include "base/loader/elf_object.hh" |
48#include "base/loader/raw_object.hh" |
|
48 49#include "mem/translating_port.hh" 50 51using namespace std; 52 53ObjectFile::ObjectFile(const string &_filename, int _fd, 54 size_t _len, uint8_t *_data, 55 Arch _arch, OpSys _opSys) --- 46 unchanged lines hidden (view full) --- 102 if (fileData) { 103 ::munmap(fileData, len); 104 fileData = NULL; 105 } 106} 107 108 109ObjectFile * | 49 50#include "mem/translating_port.hh" 51 52using namespace std; 53 54ObjectFile::ObjectFile(const string &_filename, int _fd, 55 size_t _len, uint8_t *_data, 56 Arch _arch, OpSys _opSys) --- 46 unchanged lines hidden (view full) --- 103 if (fileData) { 104 ::munmap(fileData, len); 105 fileData = NULL; 106 } 107} 108 109 110ObjectFile * |
110createObjectFile(const string &fname) | 111createObjectFile(const string &fname, bool raw) |
111{ 112 // open the file 113 int fd = open(fname.c_str(), O_RDONLY); 114 if (fd < 0) { 115 return NULL; 116 } 117 118 // find the length of the file by seeking to the end --- 17 unchanged lines hidden (view full) --- 136 if ((fileObj = AoutObject::tryFile(fname, fd, len, fileData)) != NULL) { 137 return fileObj; 138 } 139 140 if ((fileObj = ElfObject::tryFile(fname, fd, len, fileData)) != NULL) { 141 return fileObj; 142 } 143 | 112{ 113 // open the file 114 int fd = open(fname.c_str(), O_RDONLY); 115 if (fd < 0) { 116 return NULL; 117 } 118 119 // find the length of the file by seeking to the end --- 17 unchanged lines hidden (view full) --- 137 if ((fileObj = AoutObject::tryFile(fname, fd, len, fileData)) != NULL) { 138 return fileObj; 139 } 140 141 if ((fileObj = ElfObject::tryFile(fname, fd, len, fileData)) != NULL) { 142 return fileObj; 143 } 144 |
145 if (raw) 146 return RawObject::tryFile(fname, fd, len, fileData); 147 |
|
144 // don't know what it is 145 close(fd); 146 munmap(fileData, len); 147 return NULL; 148} | 148 // don't know what it is 149 close(fd); 150 munmap(fileData, len); 151 return NULL; 152} |