Current File : //usr/share/gdb/python/gdb/command/__pycache__/unwinders.cpython-39.pyc |
a
ɱZh � @ 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 s4 zt �| �W S ty. td|| f ��Y n0 d S )NzInvalid %s regexp: %s.)�re�compile�SyntaxError)ZexpZidstring� r �./usr/share/gdb/python/gdb/command/unwinders.py�validate_regexp s r c C s^ t �| �}t|�}|dkr"td��d}d}|dkrJ|d }|dkrJ|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 Zlocus�unwinder)�gdbZstring_to_argv�lenr r )�arg�argvZargcZlocus_regexpZname_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 s t t| ��dtj� d S )Nz
info unwinder)�superr �__init__r �
COMMAND_STACK��self�� __class__r r r I s zInfoUnwinder.__init__c C sF |sdS t |� |D ],}|�|j�rt d|j|jr6dndf � qdS )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�rNt�� }| �d|j |j|� t�� D ]&}|�|j�rV| �d|j |j|� qVd S )N�globalzGlobal:� progspacez
Progspace %s:zObjfile %s:)r r r r �frame_unwinders�current_progspace�filename�objfiles)r r �from_tty�locus_rer Zcp�objfiler r r �invoke^ s
��zInfoUnwinder.invoke)�__name__�
__module__�__qualname__�__doc__r r r* �
__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 r �flag�totalr r r r �do_enable_unwinder1n s
r2 c C s� t | �\}}d}|�d�r,|ttj||�7 }|�d�rL|tt�� j||�7 }t�� D ]"}|�|j�rT|t|j||�7 }qT|dkr�t�� t d||dkr�dnd|r�dnd f � d
S )zEnable/disable unwinder(s).r r! r"