Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Azat Khuzhin <a3at.mail@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gcore: expand tilde in filename, like in "dump memory" command.
Date: Thu, 08 Aug 2013 17:51:00 -0000	[thread overview]
Message-ID: <CAG5DWog4_cg16oVdChUifkF+--iNEmfKhEDH_dUGdm79BZ5GsQ@mail.gmail.com> (raw)
In-Reply-To: <5203D8A2.50300@redhat.com>

On Thu, Aug 8, 2013 at 9:42 PM, Pedro Alves <palves@redhat.com> wrote:
> On 08/07/2013 10:04 PM, Azat Khuzhin wrote:
>> Before this patch next command will fail:
>> (gdb) generate-core-file ~/core
>> Failed to open '~/core' for output.
>>
>> After this patch:
>> (gdb) generate-core-file ~/core
>> Saved corefile ~/core
>
> Thanks!  Our cvs server is unfortunately stuck at the moment, but
> I'll apply this as soon as it gets unstuck.
>
>> ---
>>  ChangeLog   |    4 ++++
>>  gdb/gcore.c |    6 +++++-
>>  2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/ChangeLog b/ChangeLog
>> index 8b16b09..7aa8e8e 100644
>> --- a/ChangeLog
>> +++ b/ChangeLog
>> @@ -1,3 +1,7 @@
>
>> +2013-07-22  Azat Khuzhin  <a3at.mail@gmail.com>
>> +
>> +     * gdb/gcore.c: Use tilde_expand() to handle tilde in filename
>
> File paths mentioned in ChangeLog entries are relative to the directory
> that holds the ChangeLog.  So gdb/ should be dropped.
> No () when mentioning a function by name.  Period at end of
> sentence.
>
> I notice you don't seem to have a copyright assignment on file.
> The change is small enough that we can put it in without one
> (that's what "tiny" means in the ChangeLog).  If you intend to
> contribute further, contact me off list, and I'll get you
> started on the process.

Yes, I also think that it is small-enough to avoid copyright assignment.
Thanks, I'm thinking about this.

>
>>  bfd *
>>  create_gcore_bfd (const char *filename)
>>  {
>> -  bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ());
>> +  char *fullname = tilde_expand (filename);
>> +
>> +  bfd *obfd = gdb_bfd_openw (fullname, default_gcore_target ());
>
> Empty line goes after last declaration.

Sorry, didn't notice it.

>
>> +  xfree (fullname);
>>
>>    if (!obfd)
>>      error (_("Failed to open '%s' for output."), filename);
>
> Here's the adjusted patch I plan to check in as soon as I'm able to.

Thanks for you review Pedro!

>
> ------------
> From: Azat Khuzhin <a3at.mail@gmail.com>
> Date: 2013-08-08 01:04:35 +0400
>
> gcore: expand tilde in filename, like in "dump memory" command.
>
> Before this patch this fails:
>
>  (gdb) generate-core-file ~/core
>  Failed to open '~/core' for output.
>
> After this patch:
>
>  (gdb) generate-core-file ~/core
>  Saved corefile ~/core
>
> gdb/
> 2013-08-08  Azat Khuzhin  <a3at.mail@gmail.com>  (tiny change)
>
>         * gcore.c (create_gcore_bfd): Use tilde_expand.
> ---
>
>  gdb/gcore.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/gcore.c b/gdb/gcore.c
> index 620be54..9c83ec8 100644
> --- a/gdb/gcore.c
> +++ b/gdb/gcore.c
> @@ -34,6 +34,7 @@
>  #include "regcache.h"
>  #include "regset.h"
>  #include "gdb_bfd.h"
> +#include "readline/tilde.h"
>
>  /* The largest amount of memory to read from the target at once.  We
>     must throttle it to limit the amount of memory used by GDB during
> @@ -51,7 +52,12 @@ static int gcore_memory_sections (bfd *);
>  bfd *
>  create_gcore_bfd (const char *filename)
>  {
> -  bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ());
> +  char *fullname;
> +  bfd *obfd;
> +
> +  fullname = tilde_expand (filename);
> +  obfd = gdb_bfd_openw (fullname, default_gcore_target ());
> +  xfree (fullname);
>
>    if (!obfd)
>      error (_("Failed to open '%s' for output."), filename);
>



-- 
Respectfully
Azat Khuzhin


      reply	other threads:[~2013-08-08 17:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07 21:04 Azat Khuzhin
2013-08-08 17:42 ` [RFC] Show (tilde-)expanded filenames to the user? (was: Re: [PATCH] gcore: expand tilde in filename, like in "dump memory" command.) Pedro Alves
2013-08-08 18:16   ` Azat Khuzhin
2013-08-08 19:50   ` [RFC] Show (tilde-)expanded filenames to the user? Tom Tromey
2013-08-09 15:22     ` Pedro Alves
2013-08-08 17:43 ` [PATCH] gcore: expand tilde in filename, like in "dump memory" command Pedro Alves
2013-08-08 17:51   ` Azat Khuzhin [this message]

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=CAG5DWog4_cg16oVdChUifkF+--iNEmfKhEDH_dUGdm79BZ5GsQ@mail.gmail.com \
    --to=a3at.mail@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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