Bug 12550 - Strange behavior of doc for gdb.Parameter
Summary: Strange behavior of doc for gdb.Parameter
Status: RESOLVED DUPLICATE of bug 12175
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-07 13:06 UTC by Joachim Protze
Modified: 2011-03-16 10:29 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Protze 2011-03-07 13:06:07 UTC
(gdb) python
>class mynewparameter(gdb.Parameter):
>#  "01234567890123456789"
>  def __init__(self):
>#    self.set_doc="01234567890123456789"
>    self.show_doc="01234567890123456789"
>    super(mynewparameter, self).__init__('mynewparameter',
>         gdb.COMMAND_DATA, gdb.PARAM_UINTEGER)
>    self.value = 20
>mynewparameter()
>end
(gdb) show mynewparameter
567890123456789 is 20.
(gdb) help set mynewparameter
This command is not documented.
This command is not documented.

- for show_doc the first 5 character are skipped
- "help set parameter-name" evaluates both: the set_doc and the __doc__ string. If it is not set, "This command is not documented." appears - otherwise the corresponding string is printed. 


For c&p:

python
class mynewparameter(gdb.Parameter):
  "01234567890123456789"
  def __init__(self):
    self.set_doc="01234567890123456789"
    self.show_doc="01234567890123456789"
    super(mynewparameter, self).__init__('mynewparameter',
         gdb.COMMAND_DATA, gdb.PARAM_UINTEGER)
    self.value = 20
mynewparameter()
end
show mynewparameter
help set mynewparameter
Comment 1 Phil Muldoon 2011-03-16 10:29:45 UTC
I believe this to be a duplicate of 12175.  A patch recently went in that allows the user to write parameters using callbacks in a sub-classed parameter.  This gets around the legacy method of using strings.

*** This bug has been marked as a duplicate of bug 12175 ***