
    h1                         S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKr\R                  " \
5      r  SS jrS rg)a  
The Cython debugger

The current directory should contain a directory named 'cython_debug', or a
path to the cython project directory should be given (the parent directory of
cython_debug).

Additional gdb args can be provided only if a path to the project directory is
given.
    Nc                    U(       dt  [         R                  R                  U SS5      n[        R                  " U5      nU(       d6  [        R
                  " S[         R                  R                  U 5      -  5        [        R                  " 5       u  pg[         R                  " US5      n UR                  U5        UR                  [        R                  " S[        [        5      -   S-   5      5        U(       a  OU(       da  [         R                  R                  U SS5      n	[        U	5      n
 U
R!                  5       nU
R#                  5         UR                  SU-  5        UR                  S	R                  S
 W 5       5      5        U(       d+  UR                  [        R                  " SW-   S-   5      5        UR                  S5        UR#                  5         U$ ! U
R#                  5         f = f! UR#                  5         f = f)Ncython_debugzcython_debug_info_*z1No cython debug files were found in %s. Aborting.wa              # This is a gdb command file
            # See https://sourceware.org/gdb/onlinedocs/gdb/Command-Files.html

            set breakpoint pending on
            set print pretty on

            python
            try:
                # Activate virtualenv, if we were launched from one
                import os
                virtualenv = os.getenv('VIRTUAL_ENV')
                if virtualenv:
                    path_to_activate_this_py = os.path.join(virtualenv, 'bin', 'activate_this.py')
                    print("gdb command file: Activating virtualenv: %s; path_to_activate_this_py: %s" % (
                        virtualenv, path_to_activate_this_py))
                    with open(path_to_activate_this_py) as f:
                        exec(f.read(), dict(__file__=path_to_activate_this_py))
                from Cython.Debugger import libcython, libpython
            except Exception as ex:
                from traceback import print_exc
                print("There was an error in Python code originating from the file z")
                print("It used the Python interpreter " + str(sys.executable))
                print_exc()
                exit(1)
            end
            interpreterzfile %s

c              3   ,   #    U  H
  nS U-  v   M     g7f)zcy import %s
N ).0fns     O/var/www/fran/franai/venv/lib/python3.13/site-packages/Cython/Debugger/Cygdb.py	<genexpr>$make_command_file.<locals>.<genexpr>V   s     Jk.3ks   a%                      python
                    import sys
                    # Check if the Python executable provides a symbol table.
                    if not hasattr(gdb.selected_inferior().progspace, "symbol_file"):
                        sys.stderr.write(
                            "z was not compiled with debug symbols (or it was "
                            "stripped). Some functionality may not work (properly).\n")
                    end
                zsource .cygdbinit
)ospathjoinglobsysexitabspathtempfilemkstempfdopenwritetextwrapdedentstr__file__openreadclose)path_to_debug_infoprefix_code	no_importskip_interpreterpatterndebug_filesfdtempfilenamefr   interpreter_filer   s               r   make_command_filer+      s   '',,1-46 ii(HHH#%77??3E#FH I  '')B
		"cA>		 !W* Z]]eYf+!g*j+!  	8  # ww||$6V#': -"2"7"7"9K$**,k12GGDIIJkJJK# )! $/)/2	) 	 	 GG)*		+ %**,& 	
	s&   +BG5 0G   BG5  G22G5 5Hc            	         [         R                  " SSS9n U R                  SSSS9  U R                  SS	S
SS9  U R                  SSSSS9  U R                  SSSSSSS9  U R                  SSSSSS9  U R                  5       nUR                  nUR
                  nUS
L nUR                  ce  U(       a^  [        R                  R                  US   5      (       a7  SS
K	nUR
                  SS
 nUR
                  S   nUR                  SU S35        [        R                  nUR                  S:X  a  [        R                  nUR                  S :  a  [        R                  n[        R                   " US!9  UR"                  n[$        R'                  S"U5        [)        UUUS#9n[$        R+                  S$UR,                  X5        [/        U5       n	[$        R'                  S%XR0                  " 5       5        [$        R+                  S&UR,                  5        [2        R4                  " UR,                  S'U/U-   5      n
[$        R+                  S(UR,                  U
R6                  5          [$        R'                  S)U
R6                  5        U
R9                  5       n[$        R'                  S*U
R6                  U5         [$        R'                  S+U	R<                  " 5       5        S
S
S
5        [$        R'                  S,U5        [        R>                  " U5        [$        R'                  S-U5        g
! [:         a     Of = fM  ! , (       d  f       Nc= f).z
Start the Cython debugger. This tells gdb to import the Cython and Python
extensions (libcython.py and libpython.py) and it enables gdb's pending
breakpoints.
cygdbzCython debugger)progdescriptiongdb_argv*z/Arguments to forward to gdb; specified after --)nargshelpz--build-dir	build_dirNz(Directory containing cython_build/ files)destdefaultr3   z--gdb-executablegdbz$gdb executable to use [default: gdb]z	--verbosez-v	verbositycountr   z8Verbose mode. Multiple -v options increase the verbosity)r5   actionr6   r3   z--skip-interpreterr$   F
store_truez]Do not automatically point GDB to the same interpreter used to generate debugging information)r5   r6   r:   r3      zPUsing deprecated positional parameter to find build directory. Use "--build-dir z" argument instead.   )levelzoptions = %r)r#   r$   z3Launching %s with command file: %s and gdb_argv: %sz%Command file (%s) contains: """
%s"""zSpawning %s...z-commandzSpawned %s (pid %d)z#Waiting for gdb (pid %d) to exit...z3Wait for gdb (pid %d) to exit is done. Returned: %rz%Closing temp command file with fd: %szRemoving temp command file: %szRemoved temp command file: %s) argparseArgumentParseradd_argument
parse_argsr4   r0   r   r   isdirwarningswarnloggingWARNr8   INFODEBUGbasicConfigr$   loggerdebugr+   infor7   r   r   
subprocessPopenpidwaitKeyboardInterruptfilenoremove)parseroptionsr!   r0   r#   rD   logging_levelr$   r(   r   prets               r   mainrZ   k   s    $$%F 
#N  P
KG  I
*E3  5 T!G  I ,-u\D  E
 !G **H"d*I X"''--2L2L##AB'$--a0hi{h|  }P  Q  	RLLMAAm,//
LL)$%7/86FHL KKE\-	l	x=|]]_]$gkk2gkk:|DxOP)7;;>BAEEJffhRTUTYTY[^_ <hoo>OP 
 LL1<@IIl
LL0,? %   
	s2   BL:&AL(7&L:(
L52L:4L55L::
M) FF)__doc__r   r   r   r   r   rN   r?   rF   	getLogger__name__rK   r+   rZ   r	       r   <module>r`      sJ   	 
 
      			8	$ 798=NbD@r_   