Re: [PATCH] Avoid seg fault in sim/cris/sim-if.c

Hans-Peter Nilsson <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
> From: "Roger Sayle" <[email protected]>
> Date: Mon, 3 Aug 2026 13:28:41 +0100

> Hi Andrew,
> No worries.  The one line change is obvious, and there's really nothing
> to take credit for.  I'm far more pleased that you've pushed a fix.
> Thank you very much for taking care of this.
> 
> Cheers,
> Roger
> --
> 
> > -----Original Message-----
> > From: Andrew Burgess <[email protected]>
> > Sent: 03 August 2026 13:10
> > To: Roger Sayle <[email protected]>; [email protected]
> > Cc: 'Hans-Peter Nilsson' <[email protected]>
> > Subject: Re: [PATCH] Avoid seg fault in sim/cris/sim-if.c
> > 
> > "Roger Sayle" <[email protected]> writes:
> > 
> > > Typing "target sim" in GDB built with --target=cris-elf, crashes
> > > immediately after being launched with "gdb ./a.out".  The issue is
> > > that STATE_PROG_ARGV may return NULL, and this isn't tested before
> > dereferencing the pointer.
> > >
> > > If approved, please could someone commit this for me.
> > > Thanks in advance.
> > 
> > I pushed this.
> > 

[Apology for mortal sin elided]

> > Thanks,
> > Andrew
> > 
> > 
> > >
> > > 2026-08-01  Roger Sayle  <[email protected]>
> > >
> > > ChangeLog
> > > 	* sim/cris/sim-if.c (sim_open): Check that prog_argv isn't NULL.

Thank you both!  I've (obviously) never run "target sim" in gdb for
cris-elf.  That sin may be more grave than forgetting to assign
authorship when applying a one-line patch...

It was always on the TODO-list to wire up the hooks and plugging in
the pieces, to get the simulator running built-in with gdb.  I'm glad
this got it working.  If there's actually something more needed, then
at least this serves as defensive programming.  I see it was already
rightly committed while I was happily on vacation, so just a thank
you.

brgds, H-P
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.