stardot / b-em

An opensource BBC Micro emulator for Win32 and Linux
http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823
GNU General Public License v2.0
112 stars 56 forks source link

Seg fault when selecting 32016 co-pro #224

Closed rjpontefract closed 4 months ago

rjpontefract commented 4 months ago

Since the changes to move the co-pro definitions into the config file, selecting the 32016 co-pro seg faults due to the ROM name being a NULL pointer instead of a pointer to an empty string. The config file sections looks like this:

[tube_05]
name=32016
cpu=32016
speed=8

And the abend looks like this:

model: starting emulation as model #10, BBC Master 128 with tube #5, 32016
Process 55546 stopped
* thread #4, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100128fec b-em`model_init at model.c:279:14 [opt]
   276  {
   277      if (curtube!=-1) {
   278          TUBE_MODEL *tube = &tubes[curtube];
-> 279          if (!tube->bootrom[0]) { // no boot ROM needed
   280              tube->cpu->init(NULL);
   281              tube_updatespeed();
   282              tube_reset();
Target 0: (b-em) stopped.

tube->bootrom is NULL

(lldb) p *tube
(TUBE_MODEL) {
  cpu = 0x00000001001a7660
  cfgsect = 0x00006000037e7670 "tube_05"
  name = 0x00006000037e76b0 "32016"
  rom_size = 0
  bootrom = 0x0000000000000000
  speed_multiplier = 8
}
SteveFosdick commented 4 months ago

Fixed by https://github.com/stardot/b-em/commit/f35ab25b33a78e3f647799f6bcce0b9cf8eec8a9

rjpontefract commented 4 months ago

Looks good, thanks!