Add support for passing defines to mig [crashpad/crashpad : main]

10 views
Skip to first unread message

Justin Cohen (Gerrit)

unread,
Nov 26, 2025, 7:51:10 AMNov 26
to Mark Mentovai, crashp...@chromium.org
Attention needed from Mark Mentovai

Justin Cohen voted and added 1 comment

Votes added by Justin Cohen

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Justin Cohen . resolved

ptal!

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Mentovai
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: If9c09e75cdb5b71c1be4e6969ec726e9cfcf9177
Gerrit-Change-Number: 7206936
Gerrit-PatchSet: 1
Gerrit-Owner: Justin Cohen <justi...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Wed, 26 Nov 2025 12:51:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
Nov 26, 2025, 9:56:37 AMNov 26
to Justin Cohen, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Justin Cohen

Mark Mentovai added 4 comments

File util/mach/mig.py
Line 76, Patchset 1 (Latest): # Python 3: use tempfile.TempDirectory instead
Mark Mentovai . unresolved

Can do this now (but not in this change).

File util/mach/mig_gen.py
Line 84, Patchset 1 (Latest): parser.add_argument('--defines',
Mark Mentovai . unresolved

This is the only comment that you should address in this change:

Since you can only give `--defines` a single define, it should be named `--define` (and the `help=` string should be edited accordingly).

Line 87, Patchset 1 (Latest): help='Additional defines (may appear multiple times)')
Mark Mentovai . unresolved

There are two ways that I’m not in love with how this works anymore.

1. A lot of these add_argument things are completely passive, and it could make more sense to not build in any special knowledge of them but, rather, just allow this to be invoked as `mig_gen.py --clang-path=… --mig-path=… …/mach_exc.defs …/mach_excUser.c …/mach_excServer.c …/mach_exc.h …/mach_excServer.h -- -I… -I…/compat/mac -I…/compat/ios -DMACH_EXC_SERVER_TASKIDTOKEN -DMACH_EXC_SERVER_TASKIDTOKEN_STATE`. You see that `--` in there? It’d help keep this passive, without having to plumb everything that we need it to pass. \
\
I’m not _entirely_ sure that this will be an improvement, because it’s possible that this code can only avoid having special knowledge of `--include` and `--define`, and will probably need knowledge of at least some of the rest (at least `--arch`, it seems). But it’d _probably_ be better for `--include` and `--define` at least, and there may further code reduction in some of the others from this strategy.

and

Line 100, Patchset 1 (Latest): generate_interface(parsed.defs, interface, parsed.include, parsed.defines,
parsed.sdk, parsed.clang_path, parsed.mig_path,
parsed.migcom_path, parsed.arch)
Mark Mentovai . unresolved

(continued)

2. This is unwieldy. Most of these should be keyword-only arguments, many with default values.

But you’re just following the status quo, so I don’t think you should make either of these changes here. If you wanted some follow-up cleanup for a slow day, though…

Open in Gerrit

Related details

Attention is currently required from:
  • Justin Cohen
Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: If9c09e75cdb5b71c1be4e6969ec726e9cfcf9177
    Gerrit-Change-Number: 7206936
    Gerrit-PatchSet: 1
    Gerrit-Owner: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@chromium.org>
    Gerrit-Comment-Date: Wed, 26 Nov 2025 14:56:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin Cohen (Gerrit)

    unread,
    Nov 26, 2025, 11:28:50 AMNov 26
    to Crashpad LUCI CQ, Mark Mentovai, crashp...@chromium.org
    Attention needed from Mark Mentovai

    Justin Cohen added 5 comments

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    Justin Cohen . resolved

    Will collect and do the rest in a followup. Only change here is s/defines/define.

    ptal!

    File util/mach/mig.py
    Line 76, Patchset 1: # Python 3: use tempfile.TempDirectory instead
    Mark Mentovai . resolved

    Can do this now (but not in this change).

    Justin Cohen

    will do with other followup work!

    File util/mach/mig_gen.py
    Line 84, Patchset 1: parser.add_argument('--defines',
    Mark Mentovai . resolved

    This is the only comment that you should address in this change:

    Since you can only give `--defines` a single define, it should be named `--define` (and the `help=` string should be edited accordingly).

    Justin Cohen

    Done

    Line 87, Patchset 1: help='Additional defines (may appear multiple times)')
    Mark Mentovai . resolved

    There are two ways that I’m not in love with how this works anymore.

    1. A lot of these add_argument things are completely passive, and it could make more sense to not build in any special knowledge of them but, rather, just allow this to be invoked as `mig_gen.py --clang-path=… --mig-path=… …/mach_exc.defs …/mach_excUser.c …/mach_excServer.c …/mach_exc.h …/mach_excServer.h -- -I… -I…/compat/mac -I…/compat/ios -DMACH_EXC_SERVER_TASKIDTOKEN -DMACH_EXC_SERVER_TASKIDTOKEN_STATE`. You see that `--` in there? It’d help keep this passive, without having to plumb everything that we need it to pass. \
    \
    I’m not _entirely_ sure that this will be an improvement, because it’s possible that this code can only avoid having special knowledge of `--include` and `--define`, and will probably need knowledge of at least some of the rest (at least `--arch`, it seems). But it’d _probably_ be better for `--include` and `--define` at least, and there may further code reduction in some of the others from this strategy.

    and

    Justin Cohen

    will do in a followup

    Line 100, Patchset 1: generate_interface(parsed.defs, interface, parsed.include, parsed.defines,

    parsed.sdk, parsed.clang_path, parsed.mig_path,
    parsed.migcom_path, parsed.arch)
    Mark Mentovai . resolved

    (continued)

    2. This is unwieldy. Most of these should be keyword-only arguments, many with default values.

    But you’re just following the status quo, so I don’t think you should make either of these changes here. If you wanted some follow-up cleanup for a slow day, though…

    Justin Cohen

    will do in a followup!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mark Mentovai
    Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: If9c09e75cdb5b71c1be4e6969ec726e9cfcf9177
      Gerrit-Change-Number: 7206936
      Gerrit-PatchSet: 2
      Gerrit-Owner: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
      Gerrit-Comment-Date: Wed, 26 Nov 2025 16:28:47 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Mark Mentovai (Gerrit)

      unread,
      Nov 26, 2025, 11:36:05 AMNov 26
      to Justin Cohen, Crashpad LUCI CQ, crashp...@chromium.org
      Attention needed from Justin Cohen

      Mark Mentovai voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Justin Cohen
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: If9c09e75cdb5b71c1be4e6969ec726e9cfcf9177
      Gerrit-Change-Number: 7206936
      Gerrit-PatchSet: 2
      Gerrit-Owner: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Attention: Justin Cohen <justi...@chromium.org>
      Gerrit-Comment-Date: Wed, 26 Nov 2025 16:36:03 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Justin Cohen (Gerrit)

      unread,
      Nov 26, 2025, 4:09:50 PMNov 26
      to Mark Mentovai, Crashpad LUCI CQ, crashp...@chromium.org

      Justin Cohen voted Commit-Queue+2

      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: If9c09e75cdb5b71c1be4e6969ec726e9cfcf9177
      Gerrit-Change-Number: 7206936
      Gerrit-PatchSet: 2
      Gerrit-Owner: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Comment-Date: Wed, 26 Nov 2025 21:09:48 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Crashpad LUCI CQ (Gerrit)

      unread,
      Nov 26, 2025, 4:21:21 PMNov 26
      to Justin Cohen, Mark Mentovai, crashp...@chromium.org

      Crashpad LUCI CQ submitted the change

      Change information

      Commit message:
      Add support for passing defines to mig

      This change updates the `mig.py` wrapper to accept `--define`
      arguments, which are passed as `-D` options to the underlying `mig`
      tool.

      This is used to define `MACH_EXC_SERVER_TASKIDTOKEN` and
      `MACH_EXC_SERVER_TASKIDTOKEN_STATE` when building the Mach exception
      server on iOS. These definitions are required to generate stubs for
      `mach_exception_raise_identity_protected` and
      `mach_exception_raise_state_identity_protected`.
      Change-Id: If9c09e75cdb5b71c1be4e6969ec726e9cfcf9177
      Commit-Queue: Justin Cohen <justi...@chromium.org>
      Reviewed-by: Mark Mentovai <ma...@chromium.org>
      Files:
      • M util/BUILD.gn
      • M util/mach/mig.py
      • M util/mach/mig_gen.py
      Change size: S
      Delta: 3 files changed, 22 insertions(+), 9 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Mark Mentovai
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: If9c09e75cdb5b71c1be4e6969ec726e9cfcf9177
      Gerrit-Change-Number: 7206936
      Gerrit-PatchSet: 3
      Gerrit-Owner: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Crashpad LUCI CQ <crashpa...@luci-project-accounts.iam.gserviceaccount.com>
      open
      diffy
      satisfied_requirement

      Justin Cohen (Gerrit)

      unread,
      Nov 26, 2025, 5:08:09 PMNov 26
      to Crashpad LUCI CQ, Mark Mentovai, crashp...@chromium.org

      Justin Cohen added 1 comment

      File util/mach/mig_gen.py
      Line 100, Patchset 1: generate_interface(parsed.defs, interface, parsed.include, parsed.defines,
      parsed.sdk, parsed.clang_path, parsed.mig_path,
      parsed.migcom_path, parsed.arch)
      Mark Mentovai . resolved

      (continued)

      2. This is unwieldy. Most of these should be keyword-only arguments, many with default values.

      But you’re just following the status quo, so I don’t think you should make either of these changes here. If you wanted some follow-up cleanup for a slow day, though…

      Justin Cohen

      will do in a followup!

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: If9c09e75cdb5b71c1be4e6969ec726e9cfcf9177
      Gerrit-Change-Number: 7206936
      Gerrit-PatchSet: 3
      Gerrit-Owner: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Crashpad LUCI CQ <crashpa...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Justin Cohen <justi...@chromium.org>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Comment-Date: Wed, 26 Nov 2025 22:08:07 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
      Comment-In-Reply-To: Justin Cohen <justi...@chromium.org>
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages