This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about test gdb remotely using gdbserver on uClinux


Daniel,

Thanks for your reply.

On 6/15/05, Daniel Jacobowitz <drow@false.org> wrote:
> On Wed, Jun 15, 2005 at 02:41:33PM +0800, Jie Zhang wrote:
> > Currently, I add ".gdb" to the argument of each gdb_file_cmd or
> > similar procedures in gdb testsuite. This is ugly. My plan is to add a
> > field to target board, like "symbol_file_name_extension" or a more
> > powerful transform helper procedure "infer_symbol_file_name". At each
> > place calling gdb_file_cmd or similar procedures, concatenate
> > "symbol_file_name_extension" to the its argument or use the result of
> > "infer_symbol_file_name" as its argument if they are defined in the
> > target board configuration.
> 
> No, don't do this at call sites.  Then it's still scattered all over
> the testsuite.
> 
> > I don't know if there are any such like mechanism. There are
> > gdbsever_host_exec and gdbserver_server_exec in gdbserver-support.exp.
> > I'm not clear if and how they can be used for my specific purpose.
> 
> Not as is.  They are just used for remote downloading.  But couldn't
> you call your new board method inside gdbserver_load and get 95% of
> cases that way?
> 
I later found that we can use [istarget "*-*-uclinux*"] to decide if
we need to append ".gdb" the file name before pass it to gdb_file_cmd.
Just as you said, modification of gdbserver_gdb_load get the most of
cases that way. Besides it, there are 5 other places need to be
changed.

Here is a patch against gdb-6.3. If it's OK, I will make a patch
against the latest CVS.

Thanks,
Jie


	* config/gdbserver.exp (gdbserver_gdb_load): Infer debughost from
	hostname if it exists.
	(gdb_load): Append .gdb to the file name before passed to gdb_file_cmd
	if target OS is uClinux.
	* lib/mi-support.exp (mi_gdb_load): Likewise.
	* gdb.base/dump.exp (symfile): Added and used as symbol file.
	* gdb.mi/mi-basics.exp (symfile): Likewise.
	* gdb.mi/mi-cli.exp: Cannot set $pc to 0 if target OS is uClinux.
	* gdb.mi/mi2-cli.exp: Likewise.

Index: binutils/binutils-2.15/gdb/testsuite/config/gdbserver.exp
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.15/gdb/testsuite/config/gdbserver.exp,v
retrieving revision 1.1
diff -u -r1.1 gdbserver.exp
--- binutils/binutils-2.15/gdb/testsuite/config/gdbserver.exp	26 Nov
2004 15:30:55 -0000	1.1
+++ binutils/binutils-2.15/gdb/testsuite/config/gdbserver.exp	15 Jun
2005 03:24:07 -0000
@@ -104,6 +104,8 @@
 
     if [target_info exists sockethost] {
 	set debughost  [target_info sockethost];
+    } elseif [target_info exists hostname] {
+	set debughost "[target_info hostname]:";
     } else {
 	set debughost "localhost:";
     }
@@ -124,7 +126,7 @@
     if [target_info exists sockethost] {
 	set sockethost [target_info sockethost];
     } else {
-	set sockethost ""
+	set sockethost ":"
     }
 
     # Export the host:port pair.
@@ -212,8 +214,14 @@
     set gdbport [lindex $res 1]
 
     if { $arg != "" } {
-	if [gdb_file_cmd $arg] {
-	    return -1
+	if [istarget "*-*-uclinux*"] {
+	    if [gdb_file_cmd "$arg.gdb"] {
+		return -1
+	    }
+	} else {
+	    if [gdb_file_cmd $arg] {
+		return -1
+	    }
 	}
     }
     gdb_target_cmd $protocol $gdbport
Index: binutils/binutils-2.15/gdb/testsuite/gdb.base/dump.exp
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.15/gdb/testsuite/gdb.base/dump.exp,v
retrieving revision 1.1
diff -u -r1.1 dump.exp
--- binutils/binutils-2.15/gdb/testsuite/gdb.base/dump.exp	26 Nov 2004
16:17:00 -0000	1.1
+++ binutils/binutils-2.15/gdb/testsuite/gdb.base/dump.exp	15 Jun 2005
03:24:07 -0000
@@ -31,6 +31,13 @@
 
 set srcfile  ${testfile}.c
 set binfile  ${objdir}/${subdir}/${testfile}
+
+if [istarget "*-*-uclinux*"] {
+    set symfile "${binfile}.gdb"
+} else {
+    set symfile ${binfile}
+}
+
 set options  {debug}
 
 set is64bitonly "no"
@@ -186,7 +193,7 @@
 
 gdb_exit
 gdb_start
-gdb_file_cmd ${binfile}
+gdb_file_cmd ${symfile}
 
 # Reload saved values one by one, and compare.
 
Index: binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi-basics.exp
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi-basics.exp,v
retrieving revision 1.1
diff -u -r1.1 mi-basics.exp
--- binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi-basics.exp	26 Nov
2004 16:17:00 -0000	1.1
+++ binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi-basics.exp	15 Jun
2005 03:24:07 -0000
@@ -40,6 +40,13 @@
 set testfile "basics"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
+
+if [istarget "*-*-uclinux*"] {
+    set symfile "${binfile}.gdb"
+} else {
+    set symfile ${binfile}
+}
+
 set escapedobjdir [string_to_regexp ${objdir}]
 set escapedsrcdir [string_to_regexp ${srcdir}]
 
@@ -85,6 +92,7 @@
 proc test_exec_and_symbol_mi_operatons {} {
     global mi_gdb_prompt
     global binfile
+    global symfile
 
     # Load symbols and specify executable on a single operation
     # Tests:
@@ -92,7 +100,7 @@
 
     # Can't use mi_gdb_test as if this doesn't work,
     #  we must give up on the whole test file
-    send_gdb "-file-exec-and-symbols ${binfile}\n"
+    send_gdb "-file-exec-and-symbols ${symfile}\n"
     gdb_expect {
            -re "\[\r\n\]*\\\^done\r\n$mi_gdb_prompt$" \
                { pass "file-exec-and-symbols operation" }
@@ -116,11 +124,11 @@
 #            "\\\^done" \
 #            "file-clear operation"
 
-    mi_gdb_test "-file-exec-file ${binfile}" \
+    mi_gdb_test "-file-exec-file ${symfile}" \
              "\\\^done" \
              "file-exec-file operation"
 
-    mi_gdb_test "-file-symbol-file ${binfile}" \
+    mi_gdb_test "-file-symbol-file ${symfile}" \
              "\\\^done" \
              "file-symbol-file operation"
 
Index: binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi-cli.exp
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi-cli.exp,v
retrieving revision 1.1
diff -u -r1.1 mi-cli.exp
--- binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi-cli.exp	26 Nov 2004
16:17:00 -0000	1.1
+++ binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi-cli.exp	15 Jun 2005
03:24:07 -0000
@@ -199,9 +199,13 @@
 # mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \
 #   {.*=target-changed.*\^done} \
 #   "-interpreter-exec console \"set \$pc=0x0\""
-mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \
-  {888\^done} \
-  "-interpreter-exec console \"set \$pc=0x0\""
+
+# NOTE: jiez/2005-06-10: Cannot set pc to 0 on uClinux.
+if ![istarget "*-*-uclinux*"] {
+    mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \
+      {888\^done} \
+      "-interpreter-exec console \"set \$pc=0x0\""
+}
 
 #mi_gdb_test "-interpreter-exec console \"\"" \
   {} \
Index: binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi2-cli.exp
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi2-cli.exp,v
retrieving revision 1.1
diff -u -r1.1 mi2-cli.exp
--- binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi2-cli.exp	26 Nov
2004 16:17:00 -0000	1.1
+++ binutils/binutils-2.15/gdb/testsuite/gdb.mi/mi2-cli.exp	15 Jun
2005 03:24:07 -0000
@@ -199,9 +199,13 @@
 # mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \
 #   {.*=target-changed.*\^done} \
 #   "-interpreter-exec console \"set \$pc=0x0\""
-mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \
-  {888\^done} \
-  "-interpreter-exec console \"set \$pc=0x0\""
+
+# NOTE: jiez/2005-06-10: Cannot set pc to 0 on uClinux.
+if ![istarget "*-*-uclinux*"] {
+    mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \
+      {888\^done} \
+      "-interpreter-exec console \"set \$pc=0x0\""
+}
 
 #mi_gdb_test "-interpreter-exec console \"\"" \
   {} \
Index: binutils/binutils-2.15/gdb/testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.15/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.1
diff -u -r1.1 mi-support.exp
--- binutils/binutils-2.15/gdb/testsuite/lib/mi-support.exp	26 Nov
2004 16:17:01 -0000	1.1
+++ binutils/binutils-2.15/gdb/testsuite/lib/mi-support.exp	15 Jun
2005 03:24:07 -0000
@@ -429,7 +429,11 @@
 
     # ``gdb_unload''
     if { $arg != "" } {
-	mi_gdb_file_cmd $arg
+	if [istarget "*-*-uclinux*"] {
+	    mi_gdb_file_cmd "$arg.gdb"
+	} else {
+	    mi_gdb_file_cmd $arg
+	}
     }
 
     # ``load''


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]