Skip to content

Instantly share code, notes, and snippets.

@thierry-FreeBSD
Created December 22, 2020 15:29
Show Gist options
  • Save thierry-FreeBSD/d87720858a646c557e5cd7b196bcd3b1 to your computer and use it in GitHub Desktop.
Save thierry-FreeBSD/d87720858a646c557e5cd7b196bcd3b1 to your computer and use it in GitHub Desktop.
Extra tables GNU and Hurd build and install fine on FreeBSD, pinball finds them, but they cannot be loaded:
MenuSub::perform() load table
MenuSub::draw() load table
MenuSub::draw() load table
MenuSub::draw() load table
No current table name! (the first time is normal...)
SignalSender::clear()
loaded texture: /usr/local/share/pinball/gnu/tiles3.png
size 256 256
loaded texture: /usr/local/share/pinball/gnu/gnu.png
size 256 256
loaded texture: /usr/local/share/pinball/gnu/gnu2b.png
size 256 256
loaded texture: /usr/local/share/pinball/gnu/tiles.png
size 256 256
loaded texture: /usr/local/share/pinball/gnu/tiles2.png
size 256 256
+Loader::loadModule
Loader::loadFile caught exception ************
Could not allocate behavior object
When loading file: /usr/local/share/pinball/gnu/pinball.pbl
At line: 26046
Loader::loadFile *****************************
Error loading level: gnu
Try reinstalling the game
SignalSender::clear()
MenuSub::draw() main menu
At line 26046 of /usr/local/share/pinball/gnu/pinball.pbl, it refers to:
libModuleGnu.la
This file exists, with the corresponding library:
-rw-r--r-- 1 root wheel 56872 22 déc. 16:11 /usr/local/lib/pinball/libModuleGnu.a
-rwxr-xr-x 1 root wheel 960 22 déc. 16:11 /usr/local/lib/pinball/libModuleGnu.la
lrwxr-xr-x 1 root wheel 21 22 déc. 16:11 /usr/local/lib/pinball/libModuleGnu.so -> libModuleGnu.so.0.0.0
lrwxr-xr-x 1 root wheel 21 22 déc. 16:11 /usr/local/lib/pinball/libModuleGnu.so.0 -> libModuleGnu.so.0.0.0
-rwxr-xr-x 1 root wheel 32200 22 déc. 16:11 /usr/local/lib/pinball/libModuleGnu.so.0.0.0
This libtool file seems OK, libModuleProfessor and libModuleTux work fine, but not the extra ones.
@thierry-FreeBSD
Copy link
Author

The file pinball.pbl is at:
/usr/local/share/pinball/gnu/pinball.pbl

The working pinball.pbl are located at:
-rw-r--r-- 1 root wheel 449634 22 déc. 18:58 /usr/local/share/pinball/tux/pinball.pbl
-rw-r--r-- 1 root wheel 250721 22 déc. 18:58 /usr/local/share/pinball/professor/pinball.pbl

This is similar.

Hereunder is a debug session:

GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/pinball...
(gdb) b Loader::loadModule
Breakpoint 1 at 0x26ebd0: file Loader.cpp, line 692.
(gdb) r
Starting program: /usr/local/bin/pinball 
[New LWP 101907 of process 7283]
[New LWP 101931 of process 7283]
[New LWP 102030 of process 7283]
[New LWP 102163 of process 7283]
[New LWP 102180 of process 7283]
[New LWP 102183 of process 7283]

Thread 1 hit Breakpoint 1, Loader::loadModule (this=0x801127220, file=..., ist=..., group=0x804da4f00) at Loader.cpp:692
692	  EM_COUT("+Loader::loadModule", 1);
(gdb) n
693	  EmAssert(group != NULL, "Group NULL in loadMisc");
(gdb) 
694	  m_LoaderModule = LoaderModule::getInstance();
(gdb) 
[LWP 102183 of process 7283 exited]
695	  string str;
(gdb) 
697	  EmReadCmp(file, ist, str, "{");
(gdb) 
698	  this->readNextToken(file, ist, str);
(gdb) 
700	  string filename = string(EM_LIBDIR) + "/" + str;
(gdb) 
701	  Behavior *beh=0;
(gdb) p filename
$1 = "/usr/local/lib/pinball/libModuleGnu.la"
(gdb) n
702	  if (m_bModules) {
(gdb) 
703	    beh = m_LoaderModule->read(filename); 
(gdb) p filename
$2 = "/usr/local/lib/pinball/libModuleGnu.la"
(gdb) s
LoaderModule::read (this=0x804fc3440, filename="/usr/local/lib/pinball/libModuleGnu.la") at LoaderModule.cpp:130
130	  return readLibStatic(filename);
(gdb) n
Loader::loadModule (this=0x801127220, file=..., ist=..., group=0x804da4f00) at Loader.cpp:704
704	    if (beh == NULL) {
(gdb) 
705	      throw string("Could not allocate behavior object");
(gdb) 
[LWP 102030 of process 7283 exited]
[LWP 101931 of process 7283 exited]
[LWP 102180 of process 7283 exited]
[LWP 102163 of process 7283 exited]
pinball: exit: 0
[LWP 101907 of process 7283 exited]
[Inferior 1 (process 7283) exited normally]
(gdb) q

@thierry-FreeBSD
Copy link
Author

Hmm, sorry, I didn't paste the right log! This one show the pbl file:

GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/pinball...
(gdb) b Table::loadLevel
Breakpoint 1 at 0x28f7d2: file Table.cpp, line 133.
(gdb) r
Starting program: /usr/local/bin/pinball 
[New LWP 101216 of process 7520]
[New LWP 101916 of process 7520]
[New LWP 101917 of process 7520]
[New LWP 101919 of process 7520]
[New LWP 101918 of process 7520]
[New LWP 101921 of process 7520]

Thread 1 hit Breakpoint 1, Table::loadLevel (this=0x802a38ce0, engine=0x8010c6000, subdir=0x8010ffc94 "gnu") at Table.cpp:133
133	  this->clear(engine);
(gdb) n
134	  m_sTableName = string(subdir);
(gdb) 
137	  Config::getInstance()->setSubDir(subdir);
(gdb) p subdir
$1 = 0x8010ffc94 "gnu"
(gdb) n
138	  string datadir(Config::getInstance()->getDataSubDir());
(gdb) 
139	  string filename = datadir + string("/pinball.pbl");
(gdb) p datadir
$2 = "/usr/local/share/pinball/gnu"
(gdb) n
140	  Loader::getInstance()->clearSignalVariable();
(gdb) 
141	  if (Loader::getInstance()->loadFile(filename.c_str(), engine) != 0) {
(gdb) 
[LWP 101921 of process 7520 exited]
142	    cerr << "Error loading level: " << m_sTableName << endl;
(gdb) q
A debugging session is active.

	Inferior 1 [process 7520] will be killed.

Quit anyway? (y or n) y

@rzr
Copy link

rzr commented Dec 23, 2020

May we compare with hurd table?

adoptware/pinball-table-hurd#11

@thierry-FreeBSD
Copy link
Author

Hello,
Here is a debug session with the Hurd table: I don't see any notable difference.

GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/pinball...
(gdb) b Table::loadLevel
Breakpoint 1 at 0x28f7d2: file Table.cpp, line 133.
(gdb) r
Starting program: /usr/local/bin/pinball 
[New LWP 101696 of process 34014]
[New LWP 101699 of process 34014]
[New LWP 101707 of process 34014]
[New LWP 102152 of process 34014]
[New LWP 102153 of process 34014]
[New LWP 102154 of process 34014]

Thread 1 hit Breakpoint 1, Table::loadLevel (this=0x802a38ce0, engine=0x8010c6000, subdir=0x8010ffd74 "hurd") at Table.cpp:133
133	  this->clear(engine);
(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) 
�[K(gdb) n
134	  m_sTableName = string(subdir);
(gdb) 
137	  Config::getInstance()->setSubDir(subdir);
(gdb) p subdir
$1 = 0x8010ffd74 "hurd"
(gdb) n
138	  string datadir(Config::getInstance()->getDataSubDir());
(gdb) n
139	  string filename = datadir + string("/pinball.pbl");
(gdb) p datadir
$2 = "/usr/local/share/pinball/hurd"
(gdb) n
140	  Loader::getInstance()->clearSignalVariable();
(gdb) 
141	  if (Loader::getInstance()->loadFile(filename.c_str(), engine) != 0) {
(gdb) s
Loader::getInstance () at Loader.cpp:80
80	  if (p_Loader == NULL) {
(gdb) n
83	  return p_Loader;
(gdb) 
[LWP 102154 of process 34014 exited]
Table::loadLevel (this=0x802a38ce0, engine=0x8010c6000, subdir=0x8010ffd74 "hurd") at Table.cpp:142
142	    cerr << "Error loading level: " << m_sTableName << endl;
(gdb) 
143	    cerr << "Try reinstalling the game"
(gdb) 
144	         << endl;
(gdb) 
145	    this->clear(engine);
(gdb) 
146	    return -1;
(gdb) 
182	}
(gdb) 
MyMenuLoad::perform (this=0x8010ffd50) at Pinball.cpp:393
393	      p_Engine->clearScreen();
(gdb) 
394	      if (p_Texture != NULL) p_Engine->drawSplash(p_Texture);
(gdb) 
395	      p_EmFont->printRowCenter("ERROR", 10);
(gdb) 
396	      p_Engine->swap();
(gdb) c
Continuing.
[LWP 101699 of process 34014 exited]
[LWP 102153 of process 34014 exited]
[LWP 101707 of process 34014 exited]
[LWP 102152 of process 34014 exited]
pinball: exit: 0
[LWP 101696 of process 34014 exited]
[Inferior 1 (process 34014) exited normally]
(gdb) q

@thierry-FreeBSD
Copy link
Author

Patch adoptware/pinball-table-gnu@8ee41d3?branch=8ee41d30dd8a76b3b0cb93220cc2dd08a90a7656&diff=unified applied, but it still fails to load the table:

GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.1".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/pinball...
(gdb) b Table::loadLevel
Breakpoint 1 at 0x28f7d2: file Table.cpp, line 133.
(gdb) r
Starting program: /usr/local/bin/pinball 
[New LWP 101924 of process 43398]
[New LWP 102065 of process 43398]
[New LWP 102085 of process 43398]
[New LWP 102088 of process 43398]
[New LWP 102095 of process 43398]
[New LWP 102102 of process 43398]

Thread 1 hit Breakpoint 1, Table::loadLevel (this=0x802a38ce0, engine=0x8010c6000, subdir=0x8010ffc94 "gnu") at Table.cpp:133
133	  this->clear(engine);
(gdb) n
134	  m_sTableName = string(subdir);
(gdb) b subdir
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) p subdir
$1 = 0x8010ffc94 "gnu"
(gdb) n
137	  Config::getInstance()->setSubDir(subdir);
(gdb) s
Config::getInstance () at Config.cpp:48
48	  if (p_Instance == NULL) {
(gdb) 
52	  return p_Instance;
(gdb) 
Config::setSubDir (this=0x8010b5000, ch=0x8010ffc94 "gnu") at Config.cpp:96
96	  m_sSubDir = string(ch); 
(gdb) p ch
$2 = 0x8010ffc94 "gnu"
(gdb) n
97	  m_sDataSubDir = m_sDataDir + "/" + m_sSubDir;
(gdb) p m_sDataDir
$3 = "/usr/local/share/pinball"
(gdb) n
98	}
(gdb) p m_sDataSubDir
$4 = "/usr/local/share/pinball/gnu"
(gdb) n
Table::loadLevel (this=0x802a38ce0, engine=0x8010c6000, subdir=0x8010ffc94 "gnu") at Table.cpp:138
138	  string datadir(Config::getInstance()->getDataSubDir());
(gdb) s
Config::getInstance () at Config.cpp:48
48	  if (p_Instance == NULL) {
(gdb) 
52	  return p_Instance;
(gdb) 
Config::getDataSubDir (this=0x8010b5000) at ../base/Config.h:85
85	  inline const char * getDataSubDir() { return m_sDataSubDir.c_str(); };
(gdb) 
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str (this=0x8010b5078) at /usr/include/c++/v1/string:1240
1240	    const value_type* c_str() const _NOEXCEPT {return data();}
(gdb) 
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::data (this=0x8010b5078) at /usr/include/c++/v1/string:1242
1242	    const value_type* data() const _NOEXCEPT  {return _VSTD::__to_address(__get_pointer());}
(gdb) 
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__get_pointer (this=0x8010b5078) at /usr/include/c++/v1/string:1514
1514	        {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
(gdb) n
Table::loadLevel (this=0x802a38ce0, engine=0x8010c6000, subdir=0x8010ffc94 "gnu") at Table.cpp:139
139	  string filename = datadir + string("/pinball.pbl");
(gdb) p datadir
$5 = "/usr/local/share/pinball/gnu"
(gdb) n
140	  Loader::getInstance()->clearSignalVariable();
(gdb) s
Loader::getInstance () at Loader.cpp:80
80	  if (p_Loader == NULL) {
(gdb) 
81	    p_Loader = new Loader();
(gdb) 
operator new (size=136) at /usr/src/contrib/llvm-project/libcxx/src/new.cpp:64
64	    if (size == 0)
(gdb) 
67	    while ((p = ::malloc(size)) == 0)
(gdb) n
81	    return p;
(gdb) 
Loader::getInstance () at Loader.cpp:82
82	  }
(gdb) 
83	  return p_Loader;
(gdb) 
Table::loadLevel (this=0x802a38ce0, engine=0x8010c6000, subdir=0x8010ffc94 "gnu") at Table.cpp:141
141	  if (Loader::getInstance()->loadFile(filename.c_str(), engine) != 0) {
(gdb) 
[LWP 102102 of process 43398 exited]
142	    cerr << "Error loading level: " << m_sTableName << endl;
(gdb) c
Continuing.
[LWP 102065 of process 43398 exited]
[LWP 102085 of process 43398 exited]
[LWP 102088 of process 43398 exited]
[LWP 102095 of process 43398 exited]
pinball: exit: 0
[LWP 101924 of process 43398 exited]
[Inferior 1 (process 43398) exited normally]
(gdb) q

@rzr
Copy link

rzr commented Dec 23, 2020

can you show backtrace for hurd table at:

adoptware/pinball-table-hurd#11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment