This is the mail archive of the gdb-patches@sourceware.org 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]

[patch] fix error checking on add-symbol-file command.


Hi,

GDB does not recognizes the bad option on add-symbol-file command.

currently GDB shows

(gdb) add-symbol-file test 0 -readnow -blabla
add symbol table from file "test" at
    .text_addr = 0x0
(y or n) y
Reading symbols from /home/mbilal/test...done.
(gdb)


expected result

 (gdb) add-symbol-file test 0 -readnow -blabla
unknown option '-blabla'
(gdb)


Please find a attached file.



./testsuite
2013-09-02  Muhammad Bilal <mbilal@codesourcery.com>

        * gdb.base/relocate.exp: Error checking on unknown option
        with add-symbol-file command.

./
2013-09-02  Muhammad Bilal <mbilal@codesourcery.com>

        * symfile.c (add_symbol_file_command): Error checking on
        unkown option.




Thanks,
-Bilal
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.384
diff -u -p -r1.384 symfile.c
--- symfile.c	20 Aug 2013 15:04:51 -0000	1.384
+++ symfile.c	2 Sep 2013 13:24:04 -0000
@@ -2244,6 +2244,8 @@ add_symbol_file_command (char *args, int
 		    expecting_sec_name = 1;
 		    expecting_sec_addr = 1;
 		  }
+		else
+		  error (_("unknown option '%s'"), arg);
 	      }
 	    else
 	      {
Index: testsuite/gdb.base/relocate.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/relocate.exp,v
retrieving revision 1.20
diff -u -p -r1.20 relocate.exp
--- testsuite/gdb.base/relocate.exp	27 Jun 2013 18:53:49 -0000	1.20
+++ testsuite/gdb.base/relocate.exp	2 Sep 2013 13:24:04 -0000
@@ -53,6 +53,7 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
 # Load the object file.
+gdb_test "add-symbol-file ${binfile} 0 -blabla" "unknown option.*-blabla.*" "add-symbol-file error checking"
 gdb_test "add-symbol-file ${binfile} 0" \
 	"Reading symbols from .*${testfile}\\.o\\.\\.\\.done\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)" \
 	"add-symbol-file ${testfile}.o 0" \

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