public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH/RFC] Move the cmdarg before load execarg
@ 2011-01-28  9:28 Hui Zhu
  2011-01-28  9:58 ` Jan Kratochvil
  0 siblings, 1 reply; 7+ messages in thread
From: Hui Zhu @ 2011-01-28  9:28 UTC (permalink / raw)
  To: gdb-patches ml

Hi,

I got following trouble:
gdb -q -ex "set gnutarget elf32-littlearm" ./vmlinux
"/home/teawater/kernel/barm_versatile_926ejs/vmlinux": not in
executable format: File format is ambiguous.
Matching formats: elf32-littlearm elf32-littlearm-symbian
elf32-littlearm-vxworks.
Use "set gnutarget format-name" to specify the format.

Even if I use -ex to exec the command to set the gnutarget, but it is
useless because cmdarg is exec after the vmlinux load.

I think -ex should have more high level than others.  So I make a
patch let it exec before load execarg.
What do you think about it?

Thanks,
Hui

2011-01-28  Hui Zhu  <teawater@gmail.com>

	* main.c (captured_main): Move the cmdarg code.


---
 main.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

--- a/main.c
+++ b/main.c
@@ -823,6 +823,17 @@ captured_main (void *data)
     catch_command_errors (directory_switch, dirarg[i], 0, RETURN_MASK_ALL);
   xfree (dirarg);

+  for (i = 0; i < ncmd; i++)
+    {
+      if (cmdarg[i].type == CMDARG_FILE)
+        catch_command_errors (source_script, cmdarg[i].string,
+			      !batch_flag, RETURN_MASK_ALL);
+      else  /* cmdarg[i].type == CMDARG_COMMAND */
+        catch_command_errors (execute_command, cmdarg[i].string,
+			      !batch_flag, RETURN_MASK_ALL);
+    }
+  xfree (cmdarg);
+
   /* Skip auto-loading section-specified scripts until we've sourced
      local_gdbinit (which is often used to augment the source search
      path).  */
@@ -900,17 +911,6 @@ captured_main (void *data)
   ALL_OBJFILES (objfile)
     load_auto_scripts_for_objfile (objfile);

-  for (i = 0; i < ncmd; i++)
-    {
-      if (cmdarg[i].type == CMDARG_FILE)
-        catch_command_errors (source_script, cmdarg[i].string,
-			      !batch_flag, RETURN_MASK_ALL);
-      else  /* cmdarg[i].type == CMDARG_COMMAND */
-        catch_command_errors (execute_command, cmdarg[i].string,
-			      !batch_flag, RETURN_MASK_ALL);
-    }
-  xfree (cmdarg);
-
   /* Read in the old history after all the command files have been
      read.  */
   init_history ();

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-08 13:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28  9:28 [PATCH/RFC] Move the cmdarg before load execarg Hui Zhu
2011-01-28  9:58 ` Jan Kratochvil
2011-01-28 12:25   ` Tom Tromey
2011-01-30  0:52     ` Hui Zhu
2011-01-31 15:03       ` Jan Kratochvil
2011-02-08 13:39         ` Hui Zhu
2011-01-31 15:05       ` Tom Tromey

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).