)]}'
{
  "commit": "b2682eade4db993bc8231007ba94aec4e4728c61",
  "tree": "fab3f6098344cbdea331fabf92734d1ed66e9445",
  "parents": [
    "a3011beced048e66d200921b2a11c836fae31abf"
  ],
  "author": {
    "name": "Hannes Domani",
    "email": "ssbssa@yahoo.de",
    "time": "Fri Dec 06 14:04:00 2024 +0100"
  },
  "committer": {
    "name": "Hannes Domani",
    "email": "ssbssa@yahoo.de",
    "time": "Fri Dec 06 14:04:04 2024 +0100"
  },
  "message": "Reduce WOW64 code duplication\n\nCurrently we have duplicate code for each place where\nwindows_thread_info::context is touched, since for WOW64 processes\nit has to do the equivalent with wow64_context instead.\n\nFor example this code...:\n\n #ifdef __x86_64__\n   if (windows_process.wow64_process)\n     {\n       th-\u003ewow64_context.ContextFlags \u003d WOW64_CONTEXT_ALL;\n       CHECK (Wow64GetThreadContext (th-\u003eh, \u0026th-\u003ewow64_context));\n       ...\n     }\n   else\n #endif\n     {\n       th-\u003econtext.ContextFlags \u003d CONTEXT_DEBUGGER_DR;\n       CHECK (GetThreadContext (th-\u003eh, \u0026th-\u003econtext));\n       ...\n     }\n\n...changes to look like this instead:\n\n   windows_process.with_context (th, [\u0026] (auto *context)\n     {\n       context-\u003eContextFlags \u003d WindowsContext\u003cdecltype(context)\u003e::all;\n       CHECK (get_thread_context (th-\u003eh, context));\n       ...\n     }\n\nThe actual choice if context or wow64_context are used, is handled by\nthis new function in windows_process_info:\n\n   template\u003ctypename Function\u003e\n   auto with_context (windows_thread_info *th, Function function)\n   {\n #ifdef __x86_64__\n     if (wow64_process)\n       return function (th !\u003d nullptr ? th-\u003ewow64_context : nullptr);\n     else\n #endif\n       return function (th !\u003d nullptr ? th-\u003econtext : nullptr);\n   }\n\nThe other parts to make this work are the templated WindowsContext class\nwhich give the appropriate ContextFlags for both types.\nAnd there are also overloaded helper functions, like in the case of\nget_thread_context here, call either GetThreadContext or\nWow64GetThreadContext.\n\nAccording git log --stat, this results in 120 lines less code.\n\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f9f6848861d3543cf794b1a77b74b78927faddef",
      "old_mode": 33188,
      "old_path": "gdb/nat/windows-nat.c",
      "new_id": "6f1ce81c59b44efc01a2ae39a137dd3acb8fc6ae",
      "new_mode": 33188,
      "new_path": "gdb/nat/windows-nat.c"
    },
    {
      "type": "modify",
      "old_id": "f2b5d777016cd817bb20157bd083176995feba23",
      "old_mode": 33188,
      "old_path": "gdb/nat/windows-nat.h",
      "new_id": "dc637d4ed048b8d7affa240c633e0a4ac71832d9",
      "new_mode": 33188,
      "new_path": "gdb/nat/windows-nat.h"
    },
    {
      "type": "modify",
      "old_id": "abacafe7af8e48e7c7cb98a464b6314feb0c7f34",
      "old_mode": 33188,
      "old_path": "gdb/windows-nat.c",
      "new_id": "f2d0633b32fdb359053ba5971f82db94da7c1350",
      "new_mode": 33188,
      "new_path": "gdb/windows-nat.c"
    },
    {
      "type": "modify",
      "old_id": "4d031d4ab57147fcae4436170303e395e853f6cc",
      "old_mode": 33188,
      "old_path": "gdbserver/win32-i386-low.cc",
      "new_id": "b3e68781fcca15b105b95af24f2bb7290b969292",
      "new_mode": 33188,
      "new_path": "gdbserver/win32-i386-low.cc"
    },
    {
      "type": "modify",
      "old_id": "c3115ea826c83468cc26b6ed5786b263dcd3024e",
      "old_mode": 33188,
      "old_path": "gdbserver/win32-low.cc",
      "new_id": "dab57f7256b2ab9e89494c0efbaa4deac033034f",
      "new_mode": 33188,
      "new_path": "gdbserver/win32-low.cc"
    }
  ]
}
