)]}'
{
  "commit": "2465b9e4131514bdb42365076ef65ef6ad0e3f6c",
  "tree": "9651dfe117bfc3978be397975448affa025d9748",
  "parents": [
    "961a038a825be3154062c62aebac4e8db26728f0"
  ],
  "author": {
    "name": "Ijaz, Abdul B",
    "email": "abdul.b.ijaz@intel.com",
    "time": "Fri Sep 15 15:12:10 2023 +0200"
  },
  "committer": {
    "name": "Abdul Basit Ijaz",
    "email": "abdul.b.ijaz@intel.com",
    "time": "Fri Jul 17 19:36:18 2026 +0200"
  },
  "message": "gdb: add annotation in \u0027info locals\u0027 command for variables shadowing case\n\nFor C/C++/Fortran/Ada languages GDB prints same name variable multiple\ntimes in case of variable shadowing and it is confusing for user to identify\nwhich variable belongs to the current scope.  So for such cases add location\ninfo to the innermost listed variables and for super block variables add\n\"shadowed\" annotation in the form of \"\u003cfile.c:line, shadowed\u003e\".\n\nSuppose we have\n\n1:int x \u003d 3;\n2:  {\n3:    int x \u003d 4;\n4:    int y \u003d 52;\n5:    x \u003d 99; /* break here */\n6:  }\n\nCurrently:\n\n(gdb) info locals\nx \u003d 4\ny \u003d 52\nx \u003d 3\n\nAfter applying this patch, we obtain:\n\n(gdb) info locals\nx \u003d 4  \u003cfile.c:3\u003e\ny \u003d 52\nx \u003d 3  \u003cfile.c:1, shadowed\u003e\n\nThe patch adds the location annotations by keeping track of inner block\nand already printed variables to identify shadowing.  So, GDB now prints\n\"\u003cfile.c:line, shadowed\u003e\" for shadowed super-block variables and\n\"\u003cfile.c:line\u003e\" for innermost declarations of such variables only.\n\nThe location annotations are printed for shadowed variables in case of\nC/C++/Fortran/Ada languages.  In Rust, it is possible to declare a\nvariable with the same name many times.  So in this case, just the first\ninstance of the variable is printed.  RUST language test \"var_reuse.exp\"\nfails with rustc compiler version \u003e\u003d 1.73 so XFAIL is added accordingly.\n\nFix regex expression in the gdb.opt/inline-locals.exp test according to\nthis change.  The test update is only required due to the existing gdb\nknown ticket gdb/25695 where this issue is seen with 7.5.0 version on\nsles15sp6 but it is not seen anymore on the newer gcc versions e.g.\ngcc-11.4.0.\n\nThe symtab()/filename() nullptr check was added specifically to avoid\nthe crash seen in gdb.dwarf2/missing-type-name-for-templates.exp where\ntemplate symbols may have no associated source file.\n\nReviewed-By: Guinevere Larsen \u003cguinevere@redhat.com\u003e\nReviewed-By: Eli Zaretskii \u003celiz@gnu.org\u003e\nCo-Authored-By: Andrew Burgess \u003caburgess@redhat.com\u003e\nApproved-By: Andrew Burgess \u003caburgess@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ec9b5a33787c81e207eb18574749e0e345cc16a3",
      "old_mode": 33188,
      "old_path": "gdb/NEWS",
      "new_id": "5410acc830325f5a5243d7038640bd94a26e76d1",
      "new_mode": 33188,
      "new_path": "gdb/NEWS"
    },
    {
      "type": "modify",
      "old_id": "aaace85aa29c6da376b4bf88a66c534e04765a08",
      "old_mode": 33188,
      "old_path": "gdb/c-typeprint.c",
      "new_id": "1168464a9f9f71cc5aa3a9c05509dd253b79fa52",
      "new_mode": 33188,
      "new_path": "gdb/c-typeprint.c"
    },
    {
      "type": "modify",
      "old_id": "04d761c904ca250462084f7bdf6bff60a9613774",
      "old_mode": 33188,
      "old_path": "gdb/doc/gdb.texinfo",
      "new_id": "d2fbe61d8fca8a13451afc2a189992c3a9f280d4",
      "new_mode": 33188,
      "new_path": "gdb/doc/gdb.texinfo"
    },
    {
      "type": "modify",
      "old_id": "3e3be66a6768a3973a89e606837e58881b77029d",
      "old_mode": 33188,
      "old_path": "gdb/language.c",
      "new_id": "972018e8f7b710f3e943aabf41f1aede058e5867",
      "new_mode": 33188,
      "new_path": "gdb/language.c"
    },
    {
      "type": "modify",
      "old_id": "62827ffe02cc99d1295c6ad8b611de90105d0828",
      "old_mode": 33188,
      "old_path": "gdb/language.h",
      "new_id": "fb070edaa54d94473fff607302ee79989ca033c0",
      "new_mode": 33188,
      "new_path": "gdb/language.h"
    },
    {
      "type": "modify",
      "old_id": "662f43fbef895d20308f04bf415fce1719592306",
      "old_mode": 33188,
      "old_path": "gdb/printcmd.c",
      "new_id": "15c086a92845ca7ecc13b67695f4d4f85992faed",
      "new_mode": 33188,
      "new_path": "gdb/printcmd.c"
    },
    {
      "type": "modify",
      "old_id": "e084976eabfaf20344d6594ee755a31b168a705e",
      "old_mode": 33188,
      "old_path": "gdb/stack.c",
      "new_id": "f41f818cebb0b71e00db3e6061bfc4bb3d0603b9",
      "new_mode": 33188,
      "new_path": "gdb/stack.c"
    },
    {
      "type": "modify",
      "old_id": "48096a29286c50f4e9f9d4f0d8c362e33355b51a",
      "old_mode": 33188,
      "old_path": "gdb/stack.h",
      "new_id": "4f7c223f47fd573119e60167c6b2ecf5823d47a5",
      "new_mode": 33188,
      "new_path": "gdb/stack.h"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ffa96b049cf19334a6ce4ba8912f8a0f3b7b71bd",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.ada/var_shadowing.exp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "27983388555d6fc813459315b34864bcbf9ea165",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.ada/var_shadowing/var_shadowing.adb"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "7886ea31aecd86d48aa081dfb0ee39880de07287",
      "new_mode": 33261,
      "new_path": "gdb/testsuite/gdb.base/var-shadowing.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "119b8c39d4a3311700e99393b9111ebe7208c178",
      "new_mode": 33261,
      "new_path": "gdb/testsuite/gdb.base/var-shadowing.exp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "d70fcd3bdd5edb62e0d2753916fddfc432f38879",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/var-shadowing2.c"
    },
    {
      "type": "modify",
      "old_id": "2c3a9f71c2fb1472b6670f4c8577c198c9f0a776",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.opt/inline-locals.exp",
      "new_id": "6af398e5cf4f242cd9a9ce371cd60e1547a84b2b",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.opt/inline-locals.exp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "dcba42b554d99a97ef8a050866954c2ef8d2e9be",
      "new_mode": 33261,
      "new_path": "gdb/testsuite/gdb.rust/var_reuse.exp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "70101a043c5a9c490508f7782916f3d99dff8b5a",
      "new_mode": 33261,
      "new_path": "gdb/testsuite/gdb.rust/var_reuse.rs"
    },
    {
      "type": "modify",
      "old_id": "e94c69e49d355867a8eb270a14ce372cbff7425f",
      "old_mode": 33188,
      "old_path": "gdb/value.h",
      "new_id": "4cc0d7d0902baef52bfa2b12fb0f5012d00a1e28",
      "new_mode": 33188,
      "new_path": "gdb/value.h"
    }
  ]
}
