)]}'
{
  "commit": "8a38bd64a3bb4334ee4e696116eba8988f344e31",
  "tree": "5193904460f181c5104ed160078be200600ab462",
  "parents": [
    "4b68d4ac98aec7cb73a4b276ac7dd38d112786b4"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Sat Apr 12 14:19:20 2025 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Tue May 13 14:53:57 2025 +0100"
  },
  "message": "gdb/guile: improve auto-generated strings for parameters\n\nConsider this user defined parameter created in Python:\n\n  class test_param(gdb.Parameter):\n     def __init__(self, name):\n        super ().__init__(name, gdb.COMMAND_NONE, gdb.PARAM_BOOLEAN)\n        self.value \u003d True\n\n  test_param(\u0027print test\u0027)\n\nIf this is loaded into GDB, then we observe the following behaviour:\n\n  (gdb) show print test\n  The current value of \u0027print test\u0027 is \"on\".\n  (gdb) help show print test\n  Show the current value of \u0027print test\u0027.\n  This command is not documented.\n  (gdb) help set print test\n  Set the current value of \u0027print test\u0027.\n  This command is not documented.\n  (gdb)\n\nIf we now define the same parameter using Guile:\n\n  (use-modules (gdb))\n  (register-parameter! (make-parameter\n                        \"print test\"\n                        #:command-class COMMAND_NONE\n                        #:parameter-type PARAM_BOOLEAN))\n\nAnd load this into a fresh GDB session, we see the following:\n\n  (gdb) show print test\n  Command is not documented is off.\n  (gdb) help show print test\n  This command is not documented.\n  (gdb) help set print test\n  This command is not documented.\n  (gdb)\n\nThe output of \u0027show print test\u0027 doesn\u0027t make much sense, and is\ncertainly worse than the Python equivalent.  For both the \u0027help\u0027\ncommands it appears as if the first line is missing, but what is\nactually happening is that the first line has become \u0027This command is\nnot documented.\u0027, and the second line is then missing.\n\nThe problems can all be traced back to \u0027get_doc_string\u0027 in\nguile/scm-param.c.  This is the guile version of this function.  There\nis a similar function in python/py-param.c, however, the Python\nversion returns one of three different strings depending on the use\ncase.  In contrast, the Guile version just returns \u0027This command is\nnot documented.\u0027 in all cases.\n\nThe three cases that the Python code handles are, the \u0027set\u0027 string,\nthe \u0027show\u0027 string, and the general \u0027description\u0027 string.\n\nRight now the Guile get_doc_string only returns the general\n\u0027description\u0027 string, which is funny, because, in\ngdbscm_make_parameter, where get_doc_string is used, the one case that\nwe currently don\u0027t need is the general \u0027description\u0027 string.  Instead,\nright now, the general \u0027description\u0027 string is used for both the \u0027set\u0027\nand \u0027show\u0027 cases.\n\nIn this commit I plan to bring the Guile API a little more inline with\nthe Python API.  I will update get_doc_string (in scm-param.c) to\nreturn either a \u0027set\u0027 or \u0027show\u0027 string, and gdbscm_make_parameter will\nmake use of these strings.\n\nThe changes to the Guile get_doc_string are modelled on the Python\nversion of this function.  It is also worth checking out the next\ncommit, which is related, and helps motivate how the changes have been\nimplemented in this commit.\n\nAfter this commit, the same Guile parameter description shown above,\nnow gives this behaviour:\n\n  (gdb) show print test\n  The current value of \u0027print test\u0027 is off.\n  (gdb) help show print test\n  Show the current value of \u0027print test\u0027.\n  (gdb) help set print test\n  Set the current value of \u0027print test\u0027.\n  (gdb)\n\nThe \u0027show print test\u0027 output now matches the Python behaviour, and is\nmuch more descriptive.  The set and show \u0027help\u0027 output are now missing\nthe second line when compared to the Python output, but the first line\nis now correct, and I think this is better than the previous Guile\noutput.\n\nIn the next commit I\u0027ll address the problem of the missing second\nline.\n\nExisting tests have been updated to expect the new output.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "65226ec4d10e6ec88cbb61ee6250f465ee387b5c",
      "old_mode": 33188,
      "old_path": "gdb/guile/scm-param.c",
      "new_id": "bc6c605b59c97145294e4fa46572388aa6239395",
      "new_mode": 33188,
      "new_path": "gdb/guile/scm-param.c"
    },
    {
      "type": "modify",
      "old_id": "94db5a7a12ff34e0bc08a8904c0b1389638731d9",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.guile/scm-parameter.exp",
      "new_id": "a1bb374d4ad2b443b2f845128ba3253473976e09",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.guile/scm-parameter.exp"
    }
  ]
}
