Skip to content

Commit

Permalink
Enhanced the "struct.member" display capability of the "struct",
Browse files Browse the repository at this point in the history
"union", "task", "list" and "tree" commands.  If a specified
structure member contains an embedded structure, the output may
be restricted to just the embedded structure by expressing the
.member argument as "member.member".  If a specified structure
member is an array, the output may be restricted to a single array
element by expressing the .member argument as "member[index]".
Furthermore, these embedded member specifications may extend beyond
one level deep, for example, by expressing the member argument as
"member.member.member", or "member[index].member".
([email protected], [email protected])
  • Loading branch information
Dave Anderson committed May 21, 2015
1 parent d4040e2 commit 042639e
Show file tree
Hide file tree
Showing 5 changed files with 429 additions and 56 deletions.
1 change: 1 addition & 0 deletions defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -4642,6 +4642,7 @@ struct struct_member_data {
long bitsize;
};
int fill_struct_member_data(struct struct_member_data *);
void parse_for_member_extended(struct datatype_member *, ulong);

/*
* memory.c
Expand Down
86 changes: 81 additions & 5 deletions help.c
Original file line number Diff line number Diff line change
Expand Up @@ -4024,7 +4024,12 @@ char *help_task[] = {
" pid a process PID.",
" taskp a hexadecimal task_struct pointer.",
" -R member a comma-separated list of one or more task_struct and/or",
" thread_info structure members.",
" thread_info structure members. If any member contains an embedded",
" structure, or is an array, the output may be restricted to the ",
" embedded structure or an array element by expressing the member",
" argument as \"member.member\" or \"member[index]\"; embedded member",
" specifications may extend beyond one level deep, by expressing the",
" member argument as \"member.member.member...\".",
" -x override default output format with hexadecimal format.",
" -d override default output format with decimal format.",
"\nEXAMPLES",
Expand Down Expand Up @@ -4075,10 +4080,25 @@ char *help_task[] = {
" groups = {504, 8, 9, 1000, 1007, 1006, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,",
" 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},",
" ",
" Display the embedded sched_entity structure's on_rq member:\n",
" %s> task -R se.on_rq",
" PID: 6529 TASK: ffff880116538790 CPU: 1 COMMAND: \"bash\"",
" se.on_rq = 1,",
" ",
" Display the 3rd pid_link structure in the embedded pids[] array:\n",
" %s> task -R pids[2]",
" PID: 6529 TASK: ffff880116538790 CPU: 0 COMMAND: \"bash\"",
" pids[2] = {",
" node = {",
" next = 0xffff8801165391b0,",
" pprev = 0xffff880209d011b0",
" },",
" pid = 0xffff8801f0876e00",
" }",
" ",
" NOTE: When this command is invoked directly (i.e., not from \"foreach\"), it",
" is not necessary to include the \"-R\" before the task_struct/thread_info",
" member name(s).",

NULL
};

Expand Down Expand Up @@ -4293,7 +4313,13 @@ char *help_struct[] = {
" is specified, the member's offset and definition are shown.\n",
" struct_name name of a C-code structure used by the kernel.",
" .member name of a structure member; to display multiple members of a",
" structure, use a comma-separated list of members.",
" structure, use a comma-separated list of members. If any",
" member contains an embedded structure, or the member is an ",
" array, the output may be restricted to just the embedded ",
" structure or an array element by expressing the member argument",
" as \"member.member\" or \"member[index]\"; embedded member",
" specifications may extend beyond one level deep, by expressing",
" the member argument as \"member.member.member...\".",
" -o show member offsets when displaying structure definitions; ",
" if used with an address or symbol argument, each member will",
" be preceded by its virtual address.",
Expand Down Expand Up @@ -4560,6 +4586,19 @@ char *help_struct[] = {
" [ffff8100145d20c8] struct prio_array *array;",
" ...",
" ",
" Display the embedded sched_entity structure's on_rq member and",
" the third pid_link structure in the embedded pids[] array of the",
" task_struct at ffff88011653e250:\n",
" %s> task_struct.se.on_rq,pids[2] ffff88011653e250",
" se.on_rq = 1,",
" pids[2] = {",
" node = {",
" next = 0xffff88011653aff0,",
" pprev = 0xffff88011653a860",
" },",
" pid = 0xffff88010d07ed00",
" }",
" ",
" For an example of displaying per-cpu variables, consider the",
" struct hd_struct.dkstats member, which is a percpu pointer to",
" a disk_stats structure:",
Expand Down Expand Up @@ -4641,7 +4680,13 @@ char *help_union[] = {
" is specified, the member's offset (always 0) and definition are shown.\n",
" union_name name of a C-code union used by the kernel.",
" .member name of a union member; to display multiple members of a",
" union, use a comma-separated list of members.",
" union, use a comma-separated list of members. If any member",
" contains an embedded structure, or the member is an array, the",
" output may be restricted to just the embedded structure or an",
" array element by expressing the argument as \"member.member\"",
" or \"member[index]\"; embedded member specifications may extend",
" beyond one level deep, by expressing the member argument as",
" \"member.member.member...\".",
" -o show member offsets when displaying union definitions; the",
" offset is always 0 unless used with an address or symbol",
" argument, in which case each member will be preceded by its",
Expand Down Expand Up @@ -5046,6 +5091,12 @@ char *help__list[] = {
" structure; use the \"struct.member\" format in order to display",
" a particular member of the structure. To display multiple",
" members of a structure, use a comma-separated list of members.",
" If any structure member contains an embedded structure or is an",
" array, the output may be restricted to the embedded structure",
" or an array element by expressing the struct argument as ",
" \"struct.member.member\" or \"struct.member[index]\"; embedded",
" member specifications may extend beyond one level deep by ",
" expressing the argument as \"struct.member.member.member...\".",
" -x Override the default output format with hexadecimal format.",
" -d Override the default output format with decimal format.",
" -r For a list linked with list_head structures, traverse the list",
Expand Down Expand Up @@ -5274,6 +5325,25 @@ char *help__list[] = {
" pid = 14138",
" ffff88012b8f4100",
" pid = 14183",
" ",
" Similar to the above, display the embedded sched_entity structure's on_rq",
" member from each task_struct in the system:\n",
" %s> list task_struct.tasks -s task_struct.se.on_rq -h ffff8800b66a0000",
" ffff8800b66a0000",
" se.on_rq = 1,",
" ffff8800b66a0ad0",
" se.on_rq = 0,",
" ffff8800b66a15a0",
" se.on_rq = 0,",
" ffff8800b66a2070",
" se.on_rq = 0,",
" ffff8800b66a2b40",
" se.on_rq = 0,",
" ffff8800b67315a0",
" se.on_rq = 0,",
" ffff8800b6732b40",
" se.on_rq = 0,",
" ...",
NULL
};

Expand Down Expand Up @@ -5303,7 +5373,13 @@ char *help_tree[] = {
" -s struct For each entry in a tree, format and print it as this type of data",
" structure; use the \"struct.member\" format in order to display a",
" particular member of the structure. To display multiple members",
" of a structure, use a comma-separated list of members.",
" of a structure, use a comma-separated list of members. If any",
" structure member contains an embedded structure or is an array, the",
" the output may be restricted to the embedded structure or an array",
" element by expressing the member argument as \"struct.member.member\"",
" or \"struct.member[index]\"; embedded member specifications may",
" extend beyond one level deep by expressing the struct argument as",
" \"struct.member.member.member...\".",
" -x Override default output format with hexadecimal format.",
" -d Override default output format with decimal format.",
" -p Display the node's position information, showing the relationship",
Expand Down
Loading

0 comments on commit 042639e

Please sign in to comment.