mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
gem5 eclipse save and restore config files
This commit is contained in:
@@ -14832,6 +14832,8 @@ To run and GDB step debug the executable, just copy the <<dry-run,full command l
|
||||
|
||||
and configure it into Eclipse as usual.
|
||||
|
||||
One downside of this setup is that if you want to nuke your build directory to get a clean build, then the Eclipse configuration files present in it might get deleted. Maybe it is possible to store configuration files outside of the directory, but we are now mitigating that by making a backup copy of those configuration files before removing the directory, and restoring it when you do `./build-gem --clean`.
|
||||
|
||||
==== gem5 Python C++ interaction
|
||||
|
||||
The interaction uses the Python C extension interface https://docs.python.org/2/extending/extending.html interface through the <<pybind11>> helper library: https://github.com/pybind/pybind11
|
||||
|
||||
15
build-gem5
15
build-gem5
@@ -3,6 +3,7 @@
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import common
|
||||
from shell_helpers import LF
|
||||
@@ -35,6 +36,7 @@ https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-t
|
||||
)
|
||||
self._add_argument('--ldflags')
|
||||
self._add_argument('extra_make_args')
|
||||
self.eclipse_tmpdir = None
|
||||
|
||||
def build(self):
|
||||
build_dir = self.get_build_dir()
|
||||
@@ -143,6 +145,19 @@ https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-t
|
||||
)
|
||||
return exit_status
|
||||
|
||||
def clean_pre(self, builddir):
|
||||
if os.path.exists(self.env['gem5_eclipse_cproject_path']):
|
||||
self.eclipse_tmpdir = tempfile.mkdtemp()
|
||||
self.sh.mv(self.env['gem5_eclipse_cproject_path'], self.eclipse_tmpdir)
|
||||
self.sh.mv(self.env['gem5_eclipse_project_path'], self.eclipse_tmpdir)
|
||||
|
||||
def clean_post(self, builddir):
|
||||
if self.eclipse_tmpdir is not None:
|
||||
self.sh.mkdir_p(self.env['gem5_build_build_dir'])
|
||||
self.sh.mv(os.path.join(self.eclipse_tmpdir, self.env['gem5_eclipse_cproject_basename']), self.env['gem5_build_build_dir'])
|
||||
self.sh.mv(os.path.join(self.eclipse_tmpdir, self.env['gem5_eclipse_project_basename']), self.env['gem5_build_build_dir'])
|
||||
self.sh.rmrf(self.eclipse_tmpdir)
|
||||
|
||||
def get_build_dir(self):
|
||||
return self.env['gem5_build_dir']
|
||||
|
||||
|
||||
15
common.py
15
common.py
@@ -891,6 +891,13 @@ Incompatible archs are skipped.
|
||||
env['gem5_test_binaries_dir'] = join(env['gem5_out_dir'], 'test_binaries')
|
||||
env['gem5_m5term'] = join(env['gem5_build_dir'], 'm5term')
|
||||
env['gem5_build_build_dir'] = join(env['gem5_build_dir'], 'build')
|
||||
|
||||
# https://cirosantilli.com/linux-kernel-module-cheat#gem5-eclipse-configuration
|
||||
env['gem5_eclipse_cproject_basename'] = '.cproject'
|
||||
env['gem5_eclipse_project_basename'] = '.project'
|
||||
env['gem5_eclipse_cproject_path'] = join(env['gem5_build_build_dir'], env['gem5_eclipse_cproject_basename'])
|
||||
env['gem5_eclipse_project_path'] = join(env['gem5_build_build_dir'], env['gem5_eclipse_project_basename'])
|
||||
|
||||
env['gem5_executable_dir'] = join(env['gem5_build_build_dir'], env['gem5_arch'])
|
||||
env['gem5_executable_suffix'] = '.{}'.format(env['gem5_build_type'])
|
||||
env['gem5_executable'] = self.get_gem5_target_path(env, 'gem5')
|
||||
@@ -1963,10 +1970,18 @@ after configure, e.g. SCons. Usually contains specific targets or other build fl
|
||||
)
|
||||
return ret
|
||||
|
||||
def clean_pre(self):
|
||||
pass
|
||||
|
||||
def clean(self):
|
||||
build_dir = self.get_build_dir()
|
||||
self.clean_pre(build_dir)
|
||||
if build_dir is not None:
|
||||
self.sh.rmrf(build_dir)
|
||||
self.clean_post(build_dir)
|
||||
|
||||
def clean_post(self):
|
||||
pass
|
||||
|
||||
def build(self):
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user