diff options
author | SeongJae Park <sj38.park@gmail.com> | 2024-03-17 11:23:38 -0700 |
---|---|---|
committer | SeongJae Park <sj38.park@gmail.com> | 2024-03-17 11:23:38 -0700 |
commit | b6b2fd08a53e5a8585324ef841e8a181d40585fd (patch) | |
tree | 5b02eb7f631fe7d40f66b782cc1580c3b15110da | |
parent | 86ff2e45b09b1ade138d549ab982912b13797e56 (diff) | |
download | damo-b6b2fd08a53e5a8585324ef841e8a181d40585fd.tar.gz |
_damon_dbgfs: Implement an interactive version for target writing
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
-rw-r--r-- | _damon_dbgfs.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/_damon_dbgfs.py b/_damon_dbgfs.py index fe5f492f..d4addc28 100644 --- a/_damon_dbgfs.py +++ b/_damon_dbgfs.py @@ -213,6 +213,33 @@ def write_schemes(dir_path, schemes, intervals): err = _damo_fs.write_file( os.path.join(dir_path, 'schemes'), scheme_file_input) +def write_target(dir_path, target, target_has_pid): + if target_has_pid: + err = _damo_fs.write_file( + os.path.join(dir_path, 'target_ids'), '%s' % target.pid) + if err is not None: + return err + tid = target.pid + else: + if not feature_supported('paddr'): + raise Exception('paddr is not supported') + err = _damo_fs.write_file( + os.path.join(dir_path, 'target_ids'), 'paddr\n') + if err is not None: + return err + tid = 42 + if feature_supported('init_regions_target_idx'): + tid = 0 + + if feature_supported('init_regions'): + string = ' '.join(['%s %d %d' % (tid, r.start, r.end) for r in + target.regions]) + err = _damo_fs.write_file( + os.path.join(dir_path, 'init_regions'), string) + if err is not None: + return err + return None + def stage_kdamonds(kdamonds): '''Return error''' if _damon.any_kdamond_running(): |