[02/10] sim/ppc: don't try to print an uninitialized variable

Message ID efff6db85cc23fb65b22fd11720fb9d394612d9e.1666192979.git.aburgess@redhat.com
State Committed
Commit 368b8c325922ca329ae0edb1a9ce6bc16c9f927f
Headers
Series Building the sim/ tree with clang |

Commit Message

Andrew Burgess Oct. 19, 2022, 3:24 p.m. UTC
  The ppc simulator, in sim_create_inferior, tries to print the function
local entry_point variable before the variable is initialized.

In this commit, I defer the debug print line until the variable has
been initialized.
---
 sim/ppc/sim_calls.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Mike Frysinger Oct. 23, 2022, 1:51 p.m. UTC | #1
On 19 Oct 2022 16:24, Andrew Burgess via Gdb-patches wrote:
> The ppc simulator, in sim_create_inferior, tries to print the function
> local entry_point variable before the variable is initialized.
> 
> In this commit, I defer the debug print line until the variable has
> been initialized.

lgtm
-mike
  
Andrew Burgess Oct. 24, 2022, 4:05 p.m. UTC | #2
Mike Frysinger <vapier@gentoo.org> writes:

> On 19 Oct 2022 16:24, Andrew Burgess via Gdb-patches wrote:
>> The ppc simulator, in sim_create_inferior, tries to print the function
>> local entry_point variable before the variable is initialized.
>> 
>> In this commit, I defer the debug print line until the variable has
>> been initialized.
>
> lgtm

Pushed.

Thanks,
Andrew
  

Patch

diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index 729f6dcb6f3..3dcce19f628 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -161,8 +161,6 @@  sim_create_inferior (SIM_DESC sd,
 		     char * const *envp)
 {
   unsigned_word entry_point;
-  TRACE(trace_gdb, ("sim_create_inferior(start_address=0x%x, ...)\n",
-		    entry_point));
 
   if (simulator == NULL)
     error ("No program loaded");
@@ -172,6 +170,9 @@  sim_create_inferior (SIM_DESC sd,
   else
     entry_point = 0xfff00000; /* ??? */
 
+  TRACE(trace_gdb, ("sim_create_inferior(start_address=0x%x, ...)\n",
+		    entry_point));
+
   psim_init(simulator);
   psim_stack(simulator, argv, envp);