public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [PATCH/RFC] Move the cmdarg before load execarg
Date: Fri, 28 Jan 2011 09:28:00 -0000	[thread overview]
Message-ID: <AANLkTik=q2dyCeMD5A3-dvjSsnzBxLb8y1NtA8-2-i_h@mail.gmail.com> (raw)

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 ();

             reply	other threads:[~2011-01-28  6:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-28  9:28 Hui Zhu [this message]
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

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='AANLkTik=q2dyCeMD5A3-dvjSsnzBxLb8y1NtA8-2-i_h@mail.gmail.com' \
    --to=teawater@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).