Skip to content

[BUG] Cygdb does not process positional BUILD_DIR argument as expected #6694

@avm19

Description

@avm19

Describe the bug

Cygdb CLI commands (e.g. cygdb /path/to/debug/info, cygdb --) do not process the BUILD_DIR argument
(aka "path_to_debug_info") as expected.

A number of user guides (Cython's, Pandas', @WillAyd's) expect that when a user types cygdb, Cygdb will import debug information from the current directory, which is currently broken. This is one example, see the table below for more. I believe this should be fixed in master asap, in order to keep Cygdb friendly to new users.

I assume that intended behaviour is described in the User Guide - Debugging (~15 years old), and that the only desired change
since 3.0.x is the addition of --build-dir /path/to/debug/info, which used to be positional (now deprecated).

Here is a summary of intended vs actual (current) behaviour for various CLI calls.

command 3.0.x intended 3.0.x actual master intended master actual
cygdb import curdir ✔ import curdir import curdir ❌ no import1
cygdb . import curdir ✔ import curdir import curdir ❌ no import1
cygdb /path/ import /path/ ❌ import curdir2 import /path/ ❌ no import1
cygdb -- no import ❌ import curdir2 no import ⚠ no import3
cygdb --build-dir . N/A ✔ error import curdir ✔ import curdir
cygdb --build-dir /path/ N/A ✔ error import /path/ ✔ import /path/

Code to reproduce the behaviour:

# example code

Expected behaviour

No response

OS

No response

Python version

3.10.16+

Cython version

master

Additional context

I propose the following.

  1. A "quick fix" PR for the master branch will be supplied in short time.
  2. If needed, I can produce another "quick fix" for related issues in 3.0.x branch.
    However, the broken behaviour seems to have been around for a while, so some users may actually rely on it.
  3. Discuss changes in cygdb command arguments to completely move away from positional arguments to keywords.
    In particular, cygdb -- could be deprecated by introducing --no-import key,
    as was initially proposed in Upgrade cygdb from optparse to argparse #5499 (but not included in the final version).

Footnotes

  1. These bugs were introduced in Upgrade cygdb from optparse to argparse #5499. 2 3

  2. These bugs were introduced in 60dff16 when moving from sys.argv to optparse.
    Unlike sys.argv, optparse and argparse do not regard -- as an argument in cygdb --. 2

  3. The correct behaviour is achieved by accident, the code is not doing what one might expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions