AdaCore / AdaCore/gnatstudio

GNAT Stub invocation issue (2026.2).

Open
#204 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
531
Forks
65
PR merge metrics
No merged PRs in 30d

Description

Thank you for the latest Gnat Studio improvements and release schedule.

Error with the invocation of GNAT Stub with GS 2026.2:

gnatstub -P/Users/me/Tests/tests_gnat.gpr -XBUILD_MODE=Debugging /Users/me/Tests/2024/test_20241227_abstract_ic.ads /Users/me/Tests/2024/
Traceback (most recent call last):
  File "/Users/me/xnadalib-2026/share/gnatstudio/support/core/gnatstub.py", line 38, in on_exit
    if GPS.current_context().file() == self.file:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GPS.Unexpected_Exception: unexpected internal exception raised GNATCOLL.SCRIPTS.NO_SUCH_PARAMETER :  2

The actual value of GPS.current_context().file() is None.

A naive workaround is:

--- ./share/gnatstudio/support/core/gnatstub.py@0	2026-04-08 03:21:21
+++ ./share/gnatstudio/support/core/gnatstub.py	2026-06-21 16:45:28
@@ -35,8 +35,11 @@
             # We were not given a location when launching gnatstub:
             # if we are still on the original file, then go to the
             # body of this file.
-            if GPS.current_context().file() == self.file:
-                GPS.execute_action("goto other file")
+            print("GPS:", GPS.current_context().file())
+            print("Self:", self.file)
+            if GPS.current_context().file():
+                if GPS.current_context().file() == self.file:
+                    GPS.execute_action("goto other file")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in share/gnatstudio/support/core/gnatstub.py, especially on_exit and its GPS.current_context().file() check. Reproduce with the shown gnatstub command and verify that a None context file no longer raises GPS.Unexpected_Exception while the existing navigation behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.