This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Add the "-info-os" command to MI

On 12.06.2012 05:13, Stan Shebs wrote:
On 6/8/12 3:58 PM, Stan Shebs wrote:
On 6/1/12 3:09 AM, Vladimir Prus wrote:
On 23/05/12 18:38, Stan Shebs wrote:
+body=[item=@{col0="processes",col1="Listing of all processes"@},
+      item=@{col0="procgroups",col1="Listing of all process groups"@},
+      item=@{col0="threads",col1="Listing of all threads"@},
+      item=@{col0="files",col1="Listing of all file descriptors"@},
+      item=@{col0="sockets",col1="Listing of all internet-domain sockets"@},
+      item=@{col0="shm",col1="Listing of all shared-memory regions"@},
+      item=@{col0="semaphores",col1="Listing of all semaphores"@},
+      item=@{col0="msg",col1="Listing of all message queues"@},
+      item=@{col0="modules",col1="Listing of all loaded kernel


I am afraid this output is not really good enough. From MI consumer standpoint, we need a clear
and concise labels for each resource type. Unfortunately, "shm" is not acceptable at all.
"Listing of all shared-memory regions" is unacceptably long. Besides, this would make a good title
for a table with output, but not really good title for a menu used to specify what to show. For
the record, here's the labels I have to use in actual UI code:

    ResourceClassContributionItem_10=Shared memory regions
    ResourceClassContributionItem_14=Message queues
    ResourceClassContributionItem_16=Kernel modules
    ResourceClassContributionItem_2=Process groups

Could GDB be made to output such labels?

Thinking about this a bit, it would work to add a third column to the types listing, call it "Title", and define it as something like "short distinctive phrase using whole words" or something like that, and with a note in the manual that the title would ideally be phrased to be suitable for a menu of types. This lets it occupy a middle ground between the ultra-short string that is suitable for a subcommand in the CLI, and the fully description that is suitable to head up a listing of objects.

I'll work up a patch along these lines.  In keeping with the apparent tradition of numbered columns in the listing of types :-), I'll
supply titles as "col2".

There is an unfortunate unexpected consequence to this, namely that CLI "info os" also puts out the titles (because both MI and CLI use the same code to format tables of data), and because of the way formatting works, the CLI output runs description and title together to create gems like "Listing of all process groups Process groups". It's not unusable, just confusing.

The hack workaround is to use ui_out_is_mi_like_p, but that's only for absolutely necessary situations.  I'll look around a bit for other
ideas, and welcome anybody's suggestions.

I suggest not let perfect be the enemy of the good. ui_out_is_mi_like_p is perfectly acceptable solution.

The only alternative way I see would to be have the same titles for MI and CLI -- for example "Process groups". I should note that "Listing of all" prefix for every row of "info os" output is just as content free as it is content free in MI output, so it would be reasonable to only show that long form in output of "info os whatever" and not "info os".

- Volodya

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]