aboutsummaryrefslogtreecommitdiff
path: root/python/weenix
diff options
context:
space:
mode:
authorNathan Benavides-Luu <nate1299@me.com>2024-04-01 12:57:03 -0400
committerGitHub <noreply@github.com>2024-04-01 12:57:03 -0400
commit6ddcbbd59f0a04eee2b163930fc86d74dd2434ec (patch)
treeac055d6005ac81bde8100cec8842faf125db5b03 /python/weenix
parent7a684c5fb743d1e03d59db49fe283cfd4b0439a6 (diff)
S5 Fixes (#6)
* S5 Fixes * Remove #ifdef OLD * Fix comments for s5_get_disk_block * Add info for newp return parameter * Add stencil comment to s5_file_block_to_disk_block * Remove ifdefno --------- Co-authored-by: Ayma-n <aymanbt14@gmail.com>
Diffstat (limited to 'python/weenix')
-rw-r--r--python/weenix/userland_new.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/python/weenix/userland_new.py b/python/weenix/userland_new.py
new file mode 100644
index 0000000..7d4ff55
--- /dev/null
+++ b/python/weenix/userland_new.py
@@ -0,0 +1,41 @@
+import subprocess
+from os import path
+
+# Define the command and arguments
+command = [
+ "objdump",
+ "--headers",
+ "--section=.text",
+ "user/usr/bin/s5fstest.exec"
+]
+
+
+class NewUserland(gdb.Command):
+ def __init__(self):
+ super(NewUserland, self).__init__("new-userland", gdb.COMMAND_USER)
+
+ def invoke(self, arg, from_tty):
+ directory = 'user/usr/bin/'
+ filename = directory + arg + '.exec'
+ if not path.exists(filename):
+ filename = 'user/bin/' + arg + '.exec'
+ if arg == 'init':
+ filename = 'user/sbin/init.exec'
+
+
+ command = f"objdump --headers --section='.text' {filename} | grep .text | awk '{{print $4}}'"
+
+ result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True)
+
+ if result.returncode == 0:
+ print("VMA of the .text section:")
+ text_section = result.stdout.strip()
+
+ gdb.execute(f"add-symbol-file {filename} 0x{text_section}")
+ gdb.execute(f"break main")
+ else:
+ print("Command failed with error:")
+ print(result.stderr)
+
+
+NewUserland()