File: //usr/share/gdb/python/gdb/command/__pycache__/unwinders.cpython-310.pyc
o
̴6b � @ sx d dl Z d dlZdd� Zdd� ZG dd� de j�Zdd � Zd
d� ZG dd
� d
e j�ZG dd� de j�Z dd� Z
e
� dS )� Nc C s, zt �| �W S ty td|| f ��w )NzInvalid %s regexp: %s.)�re�compile�SyntaxError)�exp�idstring� r �./usr/share/gdb/python/gdb/command/unwinders.py�validate_regexp s
�r c C s^ t �| �}t|�}|dkrtd��d}d}|dkr%|d }|dkr%|d }t|d�t|d�fS )a$ Internal utility to parse unwinder command argv.
Arguments:
arg: The arguments to the command. The format is:
[locus-regexp [name-regexp]]
Returns:
A 2-tuple of compiled regular expressions.
Raises:
SyntaxError: an error processing ARG
� zToo many arguments.� � r �locus�unwinder)�gdb�string_to_argv�lenr r )�arg�argv�argc�locus_regexp�name_regexpr r r �parse_unwinder_command_args s
�r c s0 e Zd ZdZ� fdd�Zdd� Zdd� Z� ZS )�InfoUnwindera6 GDB command to list unwinders.
Usage: info unwinder [LOCUS-REGEXP [NAME-REGEXP]]
LOCUS-REGEXP is a regular expression matching the location of the
unwinder. If it is omitted, all registered unwinders from all
loci are listed. A locus can be 'global', 'progspace' to list
the unwinders from the current progspace, or a regular expression
matching filenames of objfiles.
NAME-REGEXP is a regular expression to filter unwinder names. If
this omitted for a specified locus, then all registered unwinders
in the locus are listed.c � t t| ��dtj� d S )Nz
info unwinder)�superr �__init__r �
COMMAND_STACK��self�� __class__r r r I � zInfoUnwinder.__init__c C sF |sdS t |� |D ]}|�|j�r t d|j|jrdndf � q
dS )z�Lists the unwinders whose name matches regexp.
Arguments:
title: The line to print before the list.
unwinders: The list of the unwinders.
name_re: unwinder name filter.
Nz %s%sr z [disabled])�print�match�name�enabled)r �title� unwinders�name_rer r r r �list_unwindersL s ����zInfoUnwinder.list_unwindersc C s� t |�\}}|�d�r| �dtj|� |�d�r't�� }| �d|j |j|� t�� D ]}|�|j�r>| �d|j |j|� q+d S )N�globalzGlobal:� progspacez
Progspace %s:zObjfile %s:)r r# r) r �frame_unwinders�current_progspace�filename�objfiles)r r �from_tty�locus_rer( �cp�objfiler r r �invoke^ s
����zInfoUnwinder.invoke)�__name__�
__module__�__qualname__�__doc__r r) r4 �
__classcell__r r r r r : s
r c C s, d}| D ]}|� |j�r||_|d7 }q|S )z�Enable/disable unwinders whose names match given regex.
Arguments:
unwinders: The list of unwinders.
name_re: Unwinder name filter.
flag: Enable/disable.
Returns:
The number of unwinders affected.
r r )r# r$ r% )r'