From: Muhammad Bilal <mbilal@codesourcery.com>
To: Pedro Alves <palves@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH PR gdb/15715] 'set history filename' to by immediately converted to absolute path.
Date: Tue, 30 Jul 2013 09:56:00 -0000 [thread overview]
Message-ID: <51F78DB7.8010902@codesourcery.com> (raw)
In-Reply-To: <51F67A1A.8060602@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]
Oh , my bad, and I am sorry
On 07/29/2013 07:20 PM, Pedro Alves wrote:
> Hello,
>
> On 07/29/2013 07:12 AM, Muhammad Bilal wrote:
>
>> 2013-07-29 Muhammad Bilal <mbilal@codesorcery.com>
>>
>> PR gdb/15715
>> * top.c: include "filenames.h"
>> (set_history_filename):New function.
> Space after ':'.
fixed.
>> static void
>> +set_history_filename (char *args, int from_tty, struct cmd_list_element *c)
>> +{
>> + /*We include the current directory so that if the user changes
>> + directories the file written will be the same as the one
>> + that was read. */
> Formatting still not right. Add a space after '/*', and then reindent.
> Also, there's trailing whitespace in the first two lines that should not
> be there. The correct format is:
>
> /* We include the current directory so that if the user changes
> directories the file written will be the same as the one that
> was read. */
>
>> + if (!IS_ABSOLUTE_PATH (history_filename))
>> + history_filename = reconcat (history_filename, current_directory, "/",
>> + history_filename, (char *) NULL);
>> +}
> Thanks,
fixed.
Please find new patch.
2013-07-30 Muhammad Bilal <mbilal@codesorcery.com>
PR gdb/15715
* top.c: include "filenames.h"
(set_history_filename): New function.
(init_main): Install it as set hook of the "set history filename"
command.
./testsuit
2013-07-30 Muhammad Bilal <mbilal@codesourcery.com>
PR gdb/15715
* gdb.base/setshow.exp: Test that relative paths passed to
'set history filename' are converted to absolute paths.
OK?
Thanks,
-Bilal
[-- Attachment #2: pr15715.diff --]
[-- Type: text/x-patch, Size: 3486 bytes --]
Index: gdb/top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.239
diff -u -p -r1.239 top.c
--- gdb/top.c 22 Jul 2013 11:42:31 -0000 1.239
+++ gdb/top.c 30 Jul 2013 09:39:50 -0000
@@ -48,6 +48,7 @@
#include "interps.h"
#include "observer.h"
#include "maint.h"
+#include "filenames.h"
/* readline include files. */
#include "readline/readline.h"
@@ -1704,6 +1705,17 @@ set_gdb_datadir (char *args, int from_tt
}
static void
+set_history_filename (char *args, int from_tty, struct cmd_list_element *c)
+{
+ /* We include the current directory so that if the user changes
+ directories the file written will be the same as the one
+ that was read. */
+ if (!IS_ABSOLUTE_PATH (history_filename))
+ history_filename = reconcat (history_filename, current_directory, "/",
+ history_filename, (char *) NULL);
+}
+
+static void
init_main (void)
{
/* Initialize the prompt to a simple "(gdb) " prompt or to whatever
@@ -1779,7 +1791,7 @@ variable \"HISTSIZE\", or to 256 if this
Set the filename in which to record the command history"), _("\
Show the filename in which to record the command history"), _("\
(the list of previous commands of which a record is kept)."),
- NULL,
+ set_history_filename,
show_history_filename,
&sethistlist, &showhistlist);
Index: gdb/testsuite/gdb.base/setshow.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/setshow.exp,v
retrieving revision 1.33
diff -u -p -r1.33 setshow.exp
--- gdb/testsuite/gdb.base/setshow.exp 27 Jun 2013 18:58:28 -0000 1.33
+++ gdb/testsuite/gdb.base/setshow.exp 30 Jul 2013 09:46:44 -0000
@@ -165,11 +165,38 @@ gdb_test_no_output "set height unlimited
gdb_test_no_output "set history expansion on" "set history expansion on"
#test show history expansion on
gdb_test "show history expansion on" "History expansion on command input is on.*" "show history expansion"
+#get home directory path
+set HOME ""
+set test "show environment HOME"
+gdb_test_multiple $test $test {
+ -re "\nHOME = (.*).\n.*" {
+ set HOME $expect_out(1,string)
+ pass $test
+ }
+}
+#test set history filename ~/foobar.baz
+gdb_test_no_output "set history filename ~/foobar.baz" \
+ "set history filename ~/foobar.baz"
+#test show history filename ~/foobar.baz
+gdb_test "show history filename" \
+ "The filename in which to record the command history is \"$HOME/foobar.baz\"..*" \
+ "show history filename (~/foobar.baz)"
+#get current working directory
+set PWD ""
+set test "show working directory"
+gdb_test_multiple "pwd" $test {
+ -re "\nWorking directory (.*)..\n.*" {
+ set PWD $expect_out(1,string)
+ pass $test
+ }
+}
#test set history filename foobar.baz
gdb_test_no_output "set history filename foobar.baz" \
- "set history filename foobar.baz"
+ "set history filename foobar.baz"
#test show history filename foobar.baz
-gdb_test "show history filename" "The filename in which to record the command history is \"foobar.baz\"..*" "show history filename (foobar.baz)"
+gdb_test "show history filename" \
+ "The filename in which to record the command history is \"$PWD/foobar.baz\"..*" \
+ "show history filename (current_directory/foobar.baz)"
#test set history save on
gdb_test_no_output "set history save on" "set history save on"
#test show history save on
next prev parent reply other threads:[~2013-07-30 9:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <97B73E257CC18646B0B5D3DD77DCBDD15DA063@EU-MBX-02.mgc.mentorg.com>
2013-07-12 11:05 ` Bilal, Muhammad
2013-07-19 10:22 ` Muhammad Bilal
2013-07-26 5:13 ` Muhammad Bilal
2013-07-26 12:49 ` Pedro Alves
2013-07-29 6:12 ` Muhammad Bilal
2013-07-29 14:43 ` Pedro Alves
2013-07-30 9:56 ` Muhammad Bilal [this message]
2013-07-30 10:09 ` Pedro Alves
2013-07-30 10:47 ` Muhammad Bilal
2013-07-30 11:33 ` Pedro Alves
2013-07-30 12:11 ` Muhammad Bilal
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=51F78DB7.8010902@codesourcery.com \
--to=mbilal@codesourcery.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