Re: [PATCH/RFC] Move the cmdarg before load execarg

Jan Kratochvil
2011-01-28T09:52:22Z

On Fri, 28 Jan 2011 07:41:22 +0100, Hui Zhu wrote:
> 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?

It apparently breaks the much more common case of:
gdb program -ex 'b main'

You should just use:
gdb -q -ex "set gnutarget elf32-littlearm" -ex "file ./vmlinux"

as changing options required before the image load is generally an advanced
topic so I guess the "file" command requirement is OK in such case.

Thanks,
Jan