)]}'
{
  "commit": "16c8122639ca0948f56fce125b3ad46e122d1edc",
  "tree": "3d195c2ba019781cb3aac4df99285a9130bfdf82",
  "parents": [
    "6109320673fe30163b5d00d9e3a7f4e77befb22a"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Tue May 09 12:13:02 2023 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Wed May 10 14:53:41 2023 +0100"
  },
  "message": "gdb/rust: fix crash for expression debug with strings\n\nWhile working on another patch I did this:\n\n  (gdb) set debug expression 1\n  (gdb) set language rust\n  (gdb) p \"foo\"\n  Operation: OP_AGGREGATE\n   Type: \u0026str\n\n  Fatal signal: Segmentation fault\n  ... etc ...\n\nThe problem is that the second field of the rust_aggregate_operation\nis created as a nullptr, this can be seen in rust-parse.c. in the\nfunction rust_parser::parse_string().\n\nHowever, in expop.h, in the function dump_for_expression, we make the\nassumption that the expressions will never be nullptr.\n\nI did consider moving the nullptr handling into a new function\nrust_aggregate_operation::dump, however, as the expression debug\ndumping code is not exercised as much as it might be, I would rather\nthat this code be hardened and able to handle a nullptr without\ncrashing, so I propose that we add nullptr handling into the general\ndump_for_expression function.  The behaviour is now:\n\n  (gdb) set debug expression 1\n  (gdb) set language rust\n  (gdb) p \"foo\"\n  Operation: OP_AGGREGATE\n   Type: \u0026str\n   nullptr\n   Vector:\n    String: data_ptr\n    Operation: UNOP_ADDR\n     Operation: OP_STRING\n      String: foo\n    String: length\n    Operation: OP_LONG\n     Type: usize\n     Constant: 3\n  evaluation of this expression requires the target program to be active\n  (gdb)\n\nThere\u0027s a new test to check for this case.\n\nReviewed-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "854945c86880dd260401c0826a1630ef502d942d",
      "old_mode": 33188,
      "old_path": "gdb/expop.h",
      "new_id": "a9da11cc70d31c075383508da01b2a90101b1d15",
      "new_mode": 33188,
      "new_path": "gdb/expop.h"
    },
    {
      "type": "modify",
      "old_id": "908d1a3680b0929233465783962ae7c465b19c47",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.rust/expr.exp",
      "new_id": "ce2cce2677cf626cdab92de065719c2433d5232e",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.rust/expr.exp"
    }
  ]
}
