This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/16784] GDB fails to build with Python 3.4


https://sourceware.org/bugzilla/show_bug.cgi?id=16784

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  38bcc89d48a20af944fe0d51eff3980f7dc8a88e (commit)
       via  89ed8ea187a460bc746a41f08fa8ee986716743b (commit)
      from  263ddf68020ee659a221af45319984b4e73e8efe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=38bcc89d48a20af944fe0d51eff3980f7dc8a88e

commit 38bcc89d48a20af944fe0d51eff3980f7dc8a88e
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Mon Dec 15 11:38:03 2014 -0500

    Fix build with Python 3.4 (PR python/16784)

    The type of the function pointer PyOS_ReadlineFunctionPointer (part of the
    Python C API), which we use, slightly changed starting with Python 3.4. The
    signature went from

    PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);

    to

    PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const
char *);

    The parameter that changed is the prompt text.

    This commits adjust gdb accordingly by making the prompt_arg parameter
    const, as well as the fallouts of that. I needed to rework how
    annotations are added to the prompt, since the it is now const. If
    annotations are enabled, it will make a copy of the prompt overwrite the
    prompt variable that is used throughout the function. Otherwise, no copy
    is done and the original prompt_arg value is passed.

    I changed the signature of deprecated_readline_hook. I would've changed any
    user of it, but it seems like nothing is using it,

    Built-tested with python 2.7.x, 3.3.y and 3.4.z.

    gdb/ChangeLog:

        * defs.h (gdb_readline): Constify argument.
        (gdb_readline_wrapper): Same.
        (command_line_input): Same.
        (deprecated_readline_hook): Same.
        * top.c (deprecated_readline_hook): Same.
        (gdb_readline): Same.
        (gdb_readline_wrapper): Same.
        (command_line_input): Constify argument. Pass prompt to
        called functions instead of local_prompt, overwriting prompt
        if using annotations.
        * event-top.h (display_gdb_prompt): Constify argument.
        * event-top.c (display_gdb_prompt): Same.
        * python/py-gdb-readline.c (gdbpy_readline_wrapper): Constify
        argument if building with Python 3.4 and up.

    Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=89ed8ea187a460bc746a41f08fa8ee986716743b

commit 89ed8ea187a460bc746a41f08fa8ee986716743b
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Mon Dec 15 11:30:20 2014 -0500

    python extended prompt: Use os.getcwd() instead of os.getcwdu()

    It seems like using os.getcwdu() here is wrong both for Python 2 and Python
3.

    For Python 2, this returns a 'unicode' object, which tries to get
concatenated
    to a 'str' object in substitute_prompt. The implicit conversion works when
the
    unicode string contains no accent. When it does contain an accent though,
    displaying the prompt results in the following error:

    (gdb) set extended-prompt \w
    ...
      File
"/home/simark/build/binutils-gdb-python2/gdb/data-directory/python/gdb/prompt.py",
line 138, in substitute_prompt
        result += str(cmd(arg))
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 49: ordinal not in range(128)

    When using os.getcwd() instead, it works correctly. I suppose that Python
does
    the necessary decoding internally.

    For Python 3, this method simply does not exist. It works fine with
os.getcwd().

    gdb/ChangeLog:

        * python/lib/gdb/prompt.py (_prompt_pwd): Use os.getcwd() instead of
        os.getcwdu().

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                |   21 +++++++++++++++++++++
 gdb/defs.h                   |    8 ++++----
 gdb/event-top.c              |    2 +-
 gdb/event-top.h              |    2 +-
 gdb/python/lib/gdb/prompt.py |    2 +-
 gdb/python/py-gdb-readline.c |    4 ++++
 gdb/top.c                    |   30 +++++++++++++++++-------------
 7 files changed, 49 insertions(+), 20 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]