hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/scripts/gdb/linux/proc.py
....@@ -29,6 +29,7 @@
2929 def invoke(self, arg, from_tty):
3030 gdb.write(gdb.parse_and_eval("saved_command_line").string() + "\n")
3131
32
+
3233 LxCmdLine()
3334
3435
....@@ -42,6 +43,7 @@
4243 def invoke(self, arg, from_tty):
4344 # linux_banner should contain a newline
4445 gdb.write(gdb.parse_and_eval("(char *)linux_banner").string())
46
+
4547
4648 LxVersion()
4749
....@@ -86,6 +88,7 @@
8688 def invoke(self, arg, from_tty):
8789 return show_lx_resources("iomem_resource")
8890
91
+
8992 LxIOMem()
9093
9194
....@@ -99,6 +102,7 @@
99102
100103 def invoke(self, arg, from_tty):
101104 return show_lx_resources("ioport_resource")
105
+
102106
103107 LxIOPorts()
104108
....@@ -114,11 +118,11 @@
114118 return opts
115119
116120
117
-FS_INFO = {constants.LX_MS_SYNCHRONOUS: ",sync",
118
- constants.LX_MS_MANDLOCK: ",mand",
119
- constants.LX_MS_DIRSYNC: ",dirsync",
120
- constants.LX_MS_NOATIME: ",noatime",
121
- constants.LX_MS_NODIRATIME: ",nodiratime"}
121
+FS_INFO = {constants.LX_SB_SYNCHRONOUS: ",sync",
122
+ constants.LX_SB_MANDLOCK: ",mand",
123
+ constants.LX_SB_DIRSYNC: ",dirsync",
124
+ constants.LX_SB_NOATIME: ",noatime",
125
+ constants.LX_SB_NODIRATIME: ",nodiratime"}
122126
123127 MNT_INFO = {constants.LX_MNT_NOSUID: ",nosuid",
124128 constants.LX_MNT_NODEV: ",nodev",
....@@ -149,7 +153,7 @@
149153 if len(argv) >= 1:
150154 try:
151155 pid = int(argv[0])
152
- except:
156
+ except gdb.error:
153157 raise gdb.GdbError("Provide a PID as integer value")
154158 else:
155159 pid = 1
....@@ -162,6 +166,9 @@
162166 namespace = task['nsproxy']['mnt_ns']
163167 if not namespace:
164168 raise gdb.GdbError("No namespace for current process")
169
+
170
+ gdb.write("{:^18} {:^15} {:>9} {} {} options\n".format(
171
+ "mount", "super_block", "devname", "pathname", "fstype"))
165172
166173 for vfs in lists.list_for_each_entry(namespace['list'],
167174 mount_ptr_type, "mnt_list"):
....@@ -184,16 +191,13 @@
184191 fstype = superblock['s_type']['name'].string()
185192 s_flags = int(superblock['s_flags'])
186193 m_flags = int(vfs['mnt']['mnt_flags'])
187
- rd = "ro" if (s_flags & constants.LX_MS_RDONLY) else "rw"
194
+ rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw"
188195
189
- gdb.write(
190
- "{} {} {} {}{}{} 0 0\n"
191
- .format(devname,
192
- pathname,
193
- fstype,
194
- rd,
195
- info_opts(FS_INFO, s_flags),
196
- info_opts(MNT_INFO, m_flags)))
196
+ gdb.write("{} {} {} {} {} {}{}{} 0 0\n".format(
197
+ vfs.format_string(), superblock.format_string(), devname,
198
+ pathname, fstype, rd, info_opts(FS_INFO, s_flags),
199
+ info_opts(MNT_INFO, m_flags)))
200
+
197201
198202 LxMounts()
199203
....@@ -259,7 +263,7 @@
259263
260264 try:
261265 f = open(filename, 'wb')
262
- except:
266
+ except gdb.error:
263267 raise gdb.GdbError("Could not open file to dump fdt")
264268
265269 f.write(fdt_buf)
....@@ -267,4 +271,5 @@
267271
268272 gdb.write("Dumped fdt blob to " + filename + "\n")
269273
274
+
270275 LxFdtDump()