public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCHv2 5/5] gdb: implement missing debug handler hook for Python
Date: Thu, 16 Nov 2023 12:16:10 +0100	[thread overview]
Message-ID: <14b96a7f-0250-4224-ab76-758910112629@suse.de> (raw)
In-Reply-To: <87a5req805.fsf@redhat.com>

On 11/16/23 11:59, Andrew Burgess wrote:
> Tom de Vries <tdevries@suse.de> writes:
> 
>> On 11/8/23 16:48, Andrew Burgess wrote:
>>> + for ch in name: + if not ch.isascii() or not (ch.isalnum() or ch in
>>> "_-"): + raise ValueError("invalid character '%s' in handler name: %s" %
>>> (ch, name)) + +
>>
>> on openSUSE leap 15.4 with python 3.6 I run into:
>> ...
>> (gdb) PASS: gdb.python/py-missing-debug.exp: initial checks: debug info
>> no longer found
>> source
>> /data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.python/py-missing-debug/py-missing-debug.py^M
>> Traceback (most recent call last):^M
>>     File
>> "/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.python/py-missing-debug/py-missing-debug.py",
>> line 117, in <module>^M
>>       rhandler = exception_handler()^M
>>     File
>> "/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.python/py-missing-debug/py-missing-debug.py",
>> line 93, in __init__^M
>>       super().__init__("exception_handler")^M
>>     File
>> "/data/vries/gdb/leap-15-4/build/gdb/data-directory/python/gdb/missing_debug.py",
>> line 70, in __init__^M
>>       _validate_name(name)^M
>>     File
>> "/data/vries/gdb/leap-15-4/build/gdb/data-directory/python/gdb/missing_debug.py",
>> line 41, in _validate_name^M
>>       if not ch.isascii() or not (ch.isalnum() or ch in "_-"):^M
>> AttributeError: 'str' object has no attribute 'isascii'^M
>> (gdb) FAIL: gdb.python/py-missing-debug.exp: source python script
> 
> Sorry about this Tom.  Turns out str.isascii() (and friends) were only
> added in 3.7.
> 

Np, thanks for fixing this.

> I believe the patch below should fix things.  Local testing here with
> 3.6 suggests it is fine.  I'll push this tomorrow if I don't get any
> feedback before then.

With this patch the test-case passes cleanly for me:
...
Running 
/data/vries/gdb/src/gdb/testsuite/gdb.python/py-missing-debug.exp ...

		=== gdb Summary ===

# of expected passes		83
...
so, LGTM.

Thanks,
- Tom

> 
> Thanks,
> Andrew
> 
> ---
> 
> commit 32ce7ac847349d2aa15e51878119a4e9df4c331f
> Author: Andrew Burgess <aburgess@redhat.com>
> Date:   Thu Nov 16 10:53:34 2023 +0000
> 
>      gdb/python: remove use of str.isascii()
>      
>      This commit:
>      
>        commit 8f6c452b5a4e50fbb55ff1d13328b392ad1fd416
>        Date:   Sun Oct 15 22:48:42 2023 +0100
>      
>            gdb: implement missing debug handler hook for Python
>      
>      introduced a use of str.isascii(), which was only added in Python 3.7.
>      
>      This commit switches to use curses.ascii.isascii(), as this was
>      available in 3.6.
>      
>      The same is true for str.isalnum(), which is replaced with
>      curses.ascii.isalnum().
>      
>      There should be no user visible changes after this commit.
> 
> diff --git a/gdb/python/lib/gdb/missing_debug.py b/gdb/python/lib/gdb/missing_debug.py
> index 42d69858f96..bb233a66c73 100644
> --- a/gdb/python/lib/gdb/missing_debug.py
> +++ b/gdb/python/lib/gdb/missing_debug.py
> @@ -18,6 +18,7 @@ MissingDebugHandler base class, and register_handler function.
>   """
>   
>   import gdb
> +from curses.ascii import isascii, isalnum
>   
>   
>   def _validate_name(name):
> @@ -38,7 +39,7 @@ def _validate_name(name):
>                       name.
>       """
>       for ch in name:
> -        if not ch.isascii() or not (ch.isalnum() or ch in "_-"):
> +        if not isascii(ch) or not (isalnum(ch) or ch in "_-"):
>               raise ValueError("invalid character '%s' in handler name: %s" % (ch, name))
>   
>   
> 


  reply	other threads:[~2023-11-16 11:14 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 10:53 [PATCH 0/5] New Python hook for missing debug information Andrew Burgess
2023-10-18 10:53 ` [PATCH 1/5] gdb/coffread: bring separate debug file logic into line with elfread.c Andrew Burgess
2023-10-20 17:35   ` Tom Tromey
2023-10-24 11:59     ` Andrew Burgess
2023-10-18 10:53 ` [PATCH 2/5] gdb: merge debug symbol file lookup code from coffread & elfread paths Andrew Burgess
2023-10-18 13:18   ` Jon Turney
2023-10-18 17:25     ` Andrew Burgess
2023-10-18 10:53 ` [PATCH 3/5] gdb: refactor objfile::find_and_add_separate_symbol_file Andrew Burgess
2023-10-20 17:50   ` Tom Tromey
2023-10-24 12:03     ` Andrew Burgess
2023-11-08 15:22     ` Andrew Burgess
2023-10-18 10:53 ` [PATCH 4/5] gdb: add an extension language hook for missing debug info Andrew Burgess
2023-10-18 10:53 ` [PATCH 5/5] gdb: implement missing debug handler hook for Python Andrew Burgess
2023-10-18 12:08   ` Eli Zaretskii
2023-11-08 15:48 ` [PATCHv2 0/5] New Python hook for missing debug information Andrew Burgess
2023-11-08 15:48   ` [PATCHv2 1/5] gdb/coffread: bring separate debug file logic into line with elfread.c Andrew Burgess
2023-11-08 15:48   ` [PATCHv2 2/5] gdb: merge debug symbol file lookup code from coffread & elfread paths Andrew Burgess
2023-11-08 15:48   ` [PATCHv2 3/5] gdb: refactor objfile::find_and_add_separate_symbol_file Andrew Burgess
2023-11-08 15:48   ` [PATCHv2 4/5] gdb: add an extension language hook for missing debug info Andrew Burgess
2023-11-08 15:48   ` [PATCHv2 5/5] gdb: implement missing debug handler hook for Python Andrew Burgess
2023-11-12 22:38     ` Tom Tromey
2023-11-15 12:36     ` Tom de Vries
2023-11-16 10:59       ` Andrew Burgess
2023-11-16 11:16         ` Tom de Vries [this message]
2023-11-16 17:21           ` Andrew Burgess
2023-11-16 15:26         ` Tom Tromey
2023-11-12 22:39   ` [PATCHv2 0/5] New Python hook for missing debug information Tom Tromey
2023-11-13 16:04     ` Andrew Burgess
2023-11-13 17:18       ` Tom Tromey
2023-11-12 22:40   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14b96a7f-0250-4224-ab76-758910112629@suse.de \
    --to=tdevries@suse.de \
    --cc=aburgess@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).