public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Khoo Yit Phang <khooyp@cs.umd.edu>
To: Kevin Pouget <kevin.pouget@gmail.com>
Cc: Khoo Yit Phang <khooyp@cs.umd.edu>, gdb-patches@sourceware.org
Subject: Re: Make the "python" command resemble the standard Python interpreter
Date: Wed, 11 Jan 2012 16:04:00 -0000	[thread overview]
Message-ID: <94906C8E-C23D-4DA3-989D-DDCCFA20FC35@cs.umd.edu> (raw)
In-Reply-To: <CAPftXU+dJWRt2OXTQFAHqPGehx6LzLPUM5kmsq9AqJxegL9p7g@mail.gmail.com>

Hi,

Thanks for the review, I'll attach an updated patch in a moment. I have a few questions:

On Jan 11, 2012, at 5:26 AM, Kevin Pouget wrote:

>> +static char *
>> +gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
>> + char *prompt)
> 
> I think that 'char *prompt' whould be aligned with FILE *sys_stdin'

It is properly tabbed originally and it seems to be the case when I download the attachment too. Perhaps a email formatting glitch?

>> +{
>> +  int n;
>> +  char *p = NULL, *p_start, *p_end, *q;
>> +  volatile struct gdb_exception except;
>> +
>> +  TRY_CATCH (except, RETURN_MASK_ALL)
>> +    {
>> +      struct cleanup *cleanup = gdbpy_suspend_sigint_handler ();
> 
> new line between declarations and the code

Do you mean there should not be a new line?

>> +      p = command_line_input (prompt, 0, "python");
>> +      do_cleanups (cleanup);
>> +    }
> 
> I'm not sure about that, but isn't the clean up supposed to be
> executed even if an exception is thrown? it seems not to be the case
> here

Are you referring to do_cleanups? If I understand correctly, it's to handle the case where an exception is not thrown (see, e.g., py-value.c).

>> +  /* Detect Ctrl-C and treat as KeyboardInterrupt. */
>> +  if (except.reason == RETURN_QUIT)
>> +    return NULL;
>> +
>> +  /* Handle errors by raising Python exceptions. */
>> +  if (except.reason < 0)
>> +    {
>> +      /* The thread state is nulled during gdbpy_readline_wrapper,
>> + with the original value saved in the following undocumented
>> + variable (see Python's Parser/myreadline.c and
>> + Modules/readline.c). */
> 
> comment lines should be aligned with "The thread" (or maybe my tabs
> are not displayed properly)

That's might be the case.

>> +{
>> +  Py_InitModule3 ("readline", GdbReadlineMethods,
>> +  "GDB-provided dummy readline module to prevent conflicts with the standard readline module.");
> 
> This line is too long, should be < 80 chars

I'll shorten the line, but separately, how do you format lines containing strings that themselves can be up to 80 chars (e.g., for printing)?


Yit
January 11, 2012

  parent reply	other threads:[~2012-01-11 15:54 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:31 Khoo Yit Phang
2012-01-11  4:06 ` Joel Brobecker
2012-01-11 10:43 ` Kevin Pouget
2012-01-11 10:59   ` Joel Brobecker
2012-01-11 16:04   ` Khoo Yit Phang [this message]
2012-01-11 17:48     ` Khoo Yit Phang
2012-01-11 18:48     ` Kevin Pouget
2012-01-11 19:04       ` Khoo Yit Phang
2012-01-11 19:11         ` Kevin Pouget
2012-01-11 21:06           ` Khoo Yit Phang
2012-01-11 21:33             ` Tom Tromey
2012-01-11 22:22               ` Khoo Yit Phang
2012-01-20 21:25                 ` Tom Tromey
2012-01-20 21:31             ` Tom Tromey
2012-01-22 16:42               ` Khoo Yit Phang
2012-01-11 20:56 ` Tom Tromey
2012-01-11 21:30   ` Khoo Yit Phang
2012-01-11 21:41     ` Tom Tromey
2012-01-12  3:07   ` Khoo Yit Phang
2012-01-13 14:09   ` Phil Muldoon
2012-01-13 21:39     ` Khoo Yit Phang
2012-01-12 16:48 ` Doug Evans
2012-01-12 16:52   ` Khoo Yit Phang
2012-01-12 16:55   ` Paul_Koning
2012-01-12 17:24     ` Joel Brobecker
2012-01-12 17:30     ` Doug Evans
2012-01-12 17:38       ` Paul_Koning
2012-01-12 17:46         ` Doug Evans
2012-01-12 17:48           ` Doug Evans
2012-01-12 17:51             ` Paul_Koning
2012-01-12 18:06               ` Doug Evans
     [not found]                 ` <CADPb22T1ZmfiGeF9g-QZN6pCTBHwT5ByD9ddX_Dhxe4URvTAhw@mail.gmail.com>
2012-01-12 18:21                   ` Khoo Yit Phang
2012-01-12 18:36                     ` Doug Evans
2012-01-12 18:48                       ` Khoo Yit Phang
2012-01-12 21:22                         ` Doug Evans
2012-01-12 18:30                 ` Doug Evans
2012-01-21  1:56           ` Tom Tromey
2012-01-22 16:57             ` Khoo Yit Phang
2012-01-23 22:17               ` Doug Evans
2012-01-24 17:36                 ` Tom Tromey
2012-01-26 18:28                   ` Doug Evans
2012-01-30  6:50                     ` Khoo Yit Phang
2012-01-30 17:25                       ` Doug Evans
2012-01-30 19:57                         ` Doug Evans
2012-02-06 20:08                           ` Doug Evans
2012-02-06 20:13                             ` Paul_Koning
2012-02-06 20:30                               ` Khoo Yit Phang
2012-02-06 20:34                               ` Doug Evans
2012-02-06 20:59                                 ` Paul_Koning
2012-02-06 21:54                           ` 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=94906C8E-C23D-4DA3-989D-DDCCFA20FC35@cs.umd.edu \
    --to=khooyp@cs.umd.edu \
    --cc=gdb-patches@sourceware.org \
    --cc=kevin.pouget@gmail.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).