Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Marco Barisione <mbarisione@undo.io>, gdb-patches@sourceware.org
Subject: Re: [PING][PATCH] gdb/docs: add parentheses in Python examples using print
Date: Mon, 25 Jan 2021 10:30:34 -0500	[thread overview]
Message-ID: <775acd49-35a6-6ff6-a72c-ba191b081ebb@polymtl.ca> (raw)
In-Reply-To: <CAKDUT2Lo_Z8qfnsPLW1GncjD5cdYfZggwx9bKewSTow5Z5y7+A@mail.gmail.com>

I think we were just missing for someone to push the patch, so I did it.

Simon

On 2021-01-25 9:07 a.m., Marco Barisione via Gdb-patches wrote:
> Ping.
> 
> On Fri, 8 Jan 2021 at 09:29, Marco Barisione <mbarisione@undo.io> wrote:
>>
>> This makes the examples work both in Python 2 and 3.
>>
>> gdb/doc/ChangeLog:
>>
>>         * python.texi: Add parentheses to print statements/functions.
>> ---
>>  gdb/doc/python.texi | 18 +++++++++---------
>>  1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
>> index 0f776f54768..da81906d03d 100644
>> --- a/gdb/doc/python.texi
>> +++ b/gdb/doc/python.texi
>> @@ -559,7 +559,7 @@ rather recognizes it when thrown from user Python code.  Example:
>>  >    argv = gdb.string_to_argv (args)
>>  >    if len (argv) != 0:
>>  >      raise gdb.GdbError ("hello-world takes no arguments")
>> ->    print "Hello, World!"
>> +>    print ("Hello, World!")
>>  >HelloWorld ()
>>  >end
>>  (gdb) hello-world 42
>> @@ -3100,8 +3100,8 @@ Here is an example:
>>
>>  @smallexample
>>  def exit_handler (event):
>> -    print "event type: exit"
>> -    print "exit code: %d" % (event.exit_code)
>> +    print ("event type: exit")
>> +    print ("exit code: %d" % (event.exit_code))
>>
>>  gdb.events.exited.connect (exit_handler)
>>  @end smallexample
>> @@ -3921,7 +3921,7 @@ class HelloWorld (gdb.Command):
>>      super (HelloWorld, self).__init__ ("hello-world", gdb.COMMAND_USER)
>>
>>    def invoke (self, arg, from_tty):
>> -    print "Hello, World!"
>> +    print ("Hello, World!")
>>
>>  HelloWorld ()
>>  @end smallexample
>> @@ -4309,7 +4309,7 @@ def clear_objfiles_handler(event):
>>      event.progspace.expensive_computation = None
>>  def expensive(symbol):
>>      """A mock routine to perform an "expensive" computation on symbol."""
>> -    print "Computing the answer to the ultimate question ..."
>> +    print ("Computing the answer to the ultimate question ...")
>>      return 42
>>  def new_objfile_handler(event):
>>      objfile = event.new_objfile
>> @@ -4654,7 +4654,7 @@ versions.  Using it, you could write:
>>  reason = gdb.selected_frame().unwind_stop_reason ()
>>  reason_str =  gdb.frame_stop_reason_string (reason)
>>  if reason >=  gdb.FRAME_UNWIND_FIRST_ERROR:
>> -    print "An error occured: %s" % reason_str
>> +    print ("An error occured: %s" % reason_str)
>>  @end smallexample
>>  @end table
>>
>> @@ -5295,7 +5295,7 @@ example illustrating iterating over a line table.
>>  symtab = gdb.selected_frame().find_sal().symtab
>>  linetable = symtab.linetable()
>>  for line in linetable:
>> -   print "Line: "+str(line.line)+" Address: "+hex(line.pc)
>> +   print ("Line: "+str(line.line)+" Address: "+hex(line.pc))
>>  @end smallexample
>>
>>  This will have the following output:
>> @@ -5618,11 +5618,11 @@ method:
>>  @smallexample
>>  class MyFinishBreakpoint (gdb.FinishBreakpoint)
>>      def stop (self):
>> -        print "normal finish"
>> +        print ("normal finish")
>>          return True
>>
>>      def out_of_scope ():
>> -        print "abnormal finish"
>> +        print ("abnormal finish")
>>  @end smallexample
>>  @end defun
>>
>> --
>> 2.28.0
>>

  reply	other threads:[~2021-01-25 15:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08  9:29 [PATCH] " Marco Barisione via Gdb-patches
2021-01-08 10:22 ` Eli Zaretskii via Gdb-patches
2021-01-08 14:04   ` Andrew Burgess
2021-01-25 14:07 ` [PING][PATCH] " Marco Barisione via Gdb-patches
2021-01-25 15:30   ` Simon Marchi via Gdb-patches [this message]
2021-01-25 15:41   ` Eli Zaretskii via Gdb-patches
2021-01-25 15:50     ` Marco Barisione via Gdb-patches

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=775acd49-35a6-6ff6-a72c-ba191b081ebb@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=mbarisione@undo.io \
    --cc=simon.marchi@polymtl.ca \
    /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