Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Thomas Preudhomme <thomas.preudhomme@foss.arm.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH, GDB] Fix Windows gdb build failure with python support
Date: Thu, 06 Apr 2017 15:05:00 -0000	[thread overview]
Message-ID: <e1ea09ea-6996-0ef9-2e34-73cc1c23c20d@redhat.com> (raw)
In-Reply-To: <fd8731d0-1306-3329-5a5f-ac079b773c30@foss.arm.com>

On 04/06/2017 03:28 PM, Thomas Preudhomme wrote:
> 
> 
> GDB fails to build for Windows host with python support enabled due to

Uppercase "Python", and would be a good idea to mention that this is
Python 2.

> python_file's second argument 

It's actually PyFile_FromString's second parameter, not python_file's.
"python_file" is a reference that is being initialized from the result
of PyFile_FromString.

> being of type char * and being passed a
> string litteral. 

Typo "literal".

> This patch takes the conservative assumptions that the
> function might indeed modify the character string and use a local char
> array to pass the mode instead.

The Python API is notoriously buggy wrt to const-correctness when
it comes to string parameters.

Note that in gdb/python/python-internal.h, we have fixups for all of:

 PyObject_GetAttrString
 PyObject_HasAttrString
 PyObject_CallMethod
 PyErr_NewException
 PySys_GetObject
 PySys_SetPath
 PyGetSetDef
 PyArg_ParseTupleAndKeywords

Over the years it's been getting better.

A few of those were added just yesterday, but I didn't build Windows
with Python so I missed this one.

Now, this API in particular seems to have been removed completely
in Python 3, so there's no "it was fixed in 3.x" that we could put
in a comment.  Anyway, since this is just one single place, let's just
not bother with anything fancy.

Please just add a cast instead (and update the commit log accordingly):

  PyFile_FromString (full_path.get (), (char *) "r")

OK with that change.

Thanks,
Pedro Alves


       reply	other threads:[~2017-04-06 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fd8731d0-1306-3329-5a5f-ac079b773c30@foss.arm.com>
2017-04-06 15:05 ` Pedro Alves [this message]
2017-04-06 16:20   ` Thomas Preudhomme
2017-04-06 16:24     ` Pedro Alves

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=e1ea09ea-6996-0ef9-2e34-73cc1c23c20d@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=thomas.preudhomme@foss.arm.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