* [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts
@ 2020-08-18 9:34 Ritesh Harjani
2020-08-18 9:35 ` [PATCHv2 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command Ritesh Harjani
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ritesh Harjani @ 2020-08-18 9:34 UTC (permalink / raw)
To: Jan Kiszka, Kieran Bingham; +Cc: linux-kernel, Ritesh Harjani
I was using these structs info internally in my gdb scripts.
So sending it out for merge to upstream.
Patch-2 is just adding some headers and improves spacing.
--
2.25.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCHv2 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command
2020-08-18 9:34 [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts Ritesh Harjani
@ 2020-08-18 9:35 ` Ritesh Harjani
2020-08-18 9:35 ` [PATCHv2 2/2] tasks: Add headers and improve spacing format Ritesh Harjani
2020-08-18 9:51 ` [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts Jan Kiszka
2 siblings, 0 replies; 4+ messages in thread
From: Ritesh Harjani @ 2020-08-18 9:35 UTC (permalink / raw)
To: Jan Kiszka, Kieran Bingham; +Cc: linux-kernel, Ritesh Harjani
This is many times found useful while debugging some FS related
issue.
<e.g. output>
mount super_block devname pathname fstype options
0xffff888a0bfa4b40 0xffff888a0bfc1000 none / rootfs rw 0 0
0xffff888a033f75c0 0xffff8889fcf65000 /dev/root / ext4 rw,relatime 0 0
0xffff8889fc8ce040 0xffff888a0bb51000 devtmpfs /dev devtmpfs rw,relatime 0 0
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
scripts/gdb/linux/proc.py | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py
index 6a56bba233a9..09cd871925a5 100644
--- a/scripts/gdb/linux/proc.py
+++ b/scripts/gdb/linux/proc.py
@@ -167,6 +167,9 @@ values of that process namespace"""
if not namespace:
raise gdb.GdbError("No namespace for current process")
+ gdb.write("{:^18} {:^15} {:>9} {} {} options\n".format(
+ "mount", "super_block", "devname", "pathname", "fstype"))
+
for vfs in lists.list_for_each_entry(namespace['list'],
mount_ptr_type, "mnt_list"):
devname = vfs['mnt_devname'].string()
@@ -190,14 +193,10 @@ values of that process namespace"""
m_flags = int(vfs['mnt']['mnt_flags'])
rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw"
- gdb.write(
- "{} {} {} {}{}{} 0 0\n"
- .format(devname,
- pathname,
- fstype,
- rd,
- info_opts(FS_INFO, s_flags),
- info_opts(MNT_INFO, m_flags)))
+ gdb.write("{} {} {} {} {} {}{}{} 0 0\n".format(
+ vfs.format_string(), superblock.format_string(), devname,
+ pathname, fstype, rd, info_opts(FS_INFO, s_flags),
+ info_opts(MNT_INFO, m_flags)))
LxMounts()
--
2.25.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv2 2/2] tasks: Add headers and improve spacing format
2020-08-18 9:34 [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts Ritesh Harjani
2020-08-18 9:35 ` [PATCHv2 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command Ritesh Harjani
@ 2020-08-18 9:35 ` Ritesh Harjani
2020-08-18 9:51 ` [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts Jan Kiszka
2 siblings, 0 replies; 4+ messages in thread
From: Ritesh Harjani @ 2020-08-18 9:35 UTC (permalink / raw)
To: Jan Kiszka, Kieran Bingham; +Cc: linux-kernel, Ritesh Harjani
With the patch.
<e.g. o/p>
TASK PID COMM
0xffffffff82c2b8c0 0 swapper/0
0xffff888a0ba20040 1 systemd
0xffff888a0ba24040 2 kthreadd
0xffff888a0ba28040 3 rcu_gp
w/o
0xffffffff82c2b8c0 <init_task> 0 swapper/0
0xffff888a0ba20040 1 systemd
0xffff888a0ba24040 2 kthreadd
0xffff888a0ba28040 3 rcu_gp
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
scripts/gdb/linux/tasks.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
index 0301dc1e0138..17ec19e9b5bf 100644
--- a/scripts/gdb/linux/tasks.py
+++ b/scripts/gdb/linux/tasks.py
@@ -73,11 +73,12 @@ class LxPs(gdb.Command):
super(LxPs, self).__init__("lx-ps", gdb.COMMAND_DATA)
def invoke(self, arg, from_tty):
+ gdb.write("{:>10} {:>12} {:>7}\n".format("TASK", "PID", "COMM"))
for task in task_lists():
- gdb.write("{address} {pid} {comm}\n".format(
- address=task,
- pid=task["pid"],
- comm=task["comm"].string()))
+ gdb.write("{} {:^5} {}\n".format(
+ task.format_string().split()[0],
+ task["pid"].format_string(),
+ task["comm"].string()))
LxPs()
--
2.25.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts
2020-08-18 9:34 [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts Ritesh Harjani
2020-08-18 9:35 ` [PATCHv2 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command Ritesh Harjani
2020-08-18 9:35 ` [PATCHv2 2/2] tasks: Add headers and improve spacing format Ritesh Harjani
@ 2020-08-18 9:51 ` Jan Kiszka
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2020-08-18 9:51 UTC (permalink / raw)
To: Ritesh Harjani, Kieran Bingham, Andrew Morton; +Cc: linux-kernel
On 18.08.20 11:34, Ritesh Harjani wrote:
> I was using these structs info internally in my gdb scripts.
> So sending it out for merge to upstream.
> Patch-2 is just adding some headers and improves spacing.
>
Both patches
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-18 9:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 9:34 [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts Ritesh Harjani
2020-08-18 9:35 ` [PATCHv2 1/2] proc: Add struct mount & struct super_block addr in lx-mounts command Ritesh Harjani
2020-08-18 9:35 ` [PATCHv2 2/2] tasks: Add headers and improve spacing format Ritesh Harjani
2020-08-18 9:51 ` [PATCHv2 0/2] scripts:gdb: Add few structs info in gdb scripts Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).