diff options
author | Will Newton <will.newton@linaro.org> | 2013-10-29 09:20:48 -0700 |
---|---|---|
committer | Will Newton <will.newton@linaro.org> | 2013-11-07 16:02:41 +0000 |
commit | 8782aa321e1bb466012a71791b8a40e2cb42d841 (patch) | |
tree | 62131ceb45f509f31bd340eab53a72a3359c6dab /sim/arm/wrapper.c | |
parent | a22bc58c6ad25f1a2af7c93f3beeb4f927535329 (diff) | |
download | gdb-8782aa321e1bb466012a71791b8a40e2cb42d841.zip gdb-8782aa321e1bb466012a71791b8a40e2cb42d841.tar.gz gdb-8782aa321e1bb466012a71791b8a40e2cb42d841.tar.bz2 |
sim/arm: Prevent NULL pointer dereference in sim_create_inferior.
2013-11-07 Will Newton <will.newton@linaro.org>
PR gdb/9195
* arm/wrapper.c (sim_create_inferior): Avoid calling
bfd_get_mach with a NULL bfd.
Diffstat (limited to 'sim/arm/wrapper.c')
-rw-r--r-- | sim/arm/wrapper.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index a4b7683..cf10e78 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -244,11 +244,15 @@ sim_create_inferior (sd, abfd, argv, env) char **arg; if (abfd != NULL) - ARMul_SetPC (state, bfd_get_start_address (abfd)); + { + ARMul_SetPC (state, bfd_get_start_address (abfd)); + mach = bfd_get_mach (abfd); + } else - ARMul_SetPC (state, 0); /* ??? */ - - mach = bfd_get_mach (abfd); + { + ARMul_SetPC (state, 0); /* ??? */ + mach = 0; + } switch (mach) { |