void-ppc / void-packages

The Void source packages collection (all ppc platforms, staging + main)
https://repo.voidlinux-ppc.org
Other
27 stars 12 forks source link

Does gdb works on ppc32 for big c++ programs? #66

Closed Randrianasulu closed 2 years ago

Randrianasulu commented 2 years ago

System

qemu-system-ppc -M mac99 with either G3 or G4 (default) cpu

Expected behavior

gdb debug program

Actual behavior

gdb bin/cin aborts without even showing splashscreen of program (visible on normal run)

Steps to reproduce the behavior

try to compile big c++ program (I used cinelerra-gg {0} with some patches)

in my case program failed to start fully (segfault somewhere in theme initialization) so I tried to debug this and got gdb abort. enabling core dumping with ulimit sadly produced core gdb can't read. But even core produced by gdb's own abort can't be read, new abort!

valgrind also does not work.

{0} - https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=summary with some patches not yet upstream

Randrianasulu commented 2 years ago
GNU gdb (GDB) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl
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 "powerpc-linux-gnu".
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 bin/cin...
(No debugging symbols found in bin/cin)                               
.[?2004h(gdb) run
.[?2004l
Starting program: /mnt/disk2/cinelerra/cinelerra-5.1/bin/cin

i tied to capture gdb's output into file but apparently some control esc symbols made viewing even this short file fun... (cat does not show them, mcview does)

Randrianasulu commented 2 years ago

diff file for cinelerra

$ cat ~/storage/downloads/Browser/gppc_debug.diff
diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile
index 1c10fc03..ddca1584 100644
--- a/cinelerra-5.1/cinelerra/Makefile
+++ b/cinelerra-5.1/cinelerra/Makefile
@@ -435,8 +435,10 @@ LIBS := $(LIBRARIES)
 ifeq ($(WANT_CIN_3RDPARTY),no)
 LIBS += -lavcodec -lavdevice -lavfilter -lavformat -lavutil
 LIBS += -lswresample -lswscale
-LIBS += -lintl -liconv
-LIBS += -lexecinfo
+LIBS += -l:libtheoraenc.a -l:libtheoradec.a
+LIBS += -lmp3lame -ltwolame
+#LIBS += -lintl -liconv
+#LIBS += -lexecinfo

 LIBS += $(shared_libs)
 LIBS += $(system_libs)
diff --git a/cinelerra-5.1/cinelerra/ci b/cinelerra-5.1/cinelerra/ci
index bc987833..22858982 120000
--- a/cinelerra-5.1/cinelerra/ci
+++ b/cinelerra-5.1/cinelerra/ci
@@ -1 +1 @@
-../bin/cinelerra
\ No newline at end of file
+../bin/cin
\ No newline at end of file
diff --git a/cinelerra-5.1/cinelerra/fileogg.h b/cinelerra-5.1/cinelerra/fileogg.h
index 87c26dc1..76048bd6 100644
--- a/cinelerra-5.1/cinelerra/fileogg.h
+++ b/cinelerra-5.1/cinelerra/fileogg.h
@@ -29,7 +29,9 @@
 #include "mutex.inc"

 #include <theora/theora.h>
+extern "C" {
 #include <theora/theoraenc.h>
+}
 #include <theora/theoradec.h>
 #include <vorbis/codec.h>
 #include <vorbis/vorbisenc.h>
diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C
index a502c156..49e87d3a 100644
--- a/cinelerra-5.1/cinelerra/mwindow.C
+++ b/cinelerra-5.1/cinelerra/mwindow.C
@@ -1220,6 +1220,8 @@ void MWindow::init_theme()
                        theme_plugin = plugindb->get(i);
        }

+printf("after pluginserver  for loop \n");
+
        if( !theme_plugin )
                fprintf(stderr, _("MWindow::init_theme: prefered theme %s not found.\n"),
                         preferences->theme);
@@ -1246,18 +1248,29 @@ void MWindow::init_theme()
                        theme_plugin->title);
                exit(1);
        }
+

        theme = plugin->new_theme();
        theme->mwindow = this;
+
+
+       if(!theme)
+       exit(1);
+
+printf("befor strcpy in init_theme\n");
        strcpy(theme->path, plugin->path);
+printf("after strcpy in init_theme\n");
        delete plugin;
-
+printf("before theme::initialize()\n");
 // Load default images & settings
        theme->Theme::initialize();
+printf("After Theme:initialize\n");
 // Load user images & settings
        theme->initialize();
+printf("After theme->initialize\n");
 // Create menus with user colors
        theme->build_menus();
+printf("after theme->build_menus\n");
        init_menus();

        theme->sort_image_sets();
diff --git a/cinelerra-5.1/cinelerra/theme.C b/cinelerra-5.1/cinelerra/theme.C
index 8a667b5c..3cd6b491 100644
--- a/cinelerra-5.1/cinelerra/theme.C
+++ b/cinelerra-5.1/cinelerra/theme.C
@@ -215,6 +215,7 @@ void Theme::initialize()

 // Set images which weren't set by subclass
        new_image("mode_normal", "mode_normal.png");
+       printf("in theme.C \n");
        new_image("mode_add", "mode_add.png");
        new_image("mode_subtract", "mode_subtract.png");
        new_image("mode_multiply", "mode_multiply.png");
diff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefile
index 57cfb21f..c9d969c5 100644
--- a/cinelerra-5.1/guicast/Makefile
+++ b/cinelerra-5.1/guicast/Makefile
@@ -20,6 +20,17 @@ ifeq ($(OBJDIR), aarch64)
 BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B aarch64 -I binary -O elf64-littleaarch64\""
 endif

+ifeq ($(OBJDIR), ppc64)
+BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B powerpc -I binary -O elf64-powerpc\""
+endif
+
+ifeq ($(OBJDIR), ppc)
+BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B powerpc -I binary -O elf32-powerpc\""
+endif
+
+
+
+
 $(shell mkdir -p $(OBJDIR) )

 OBJS = \
diff --git a/cinelerra-5.1/libzmpeg3/Makefile b/cinelerra-5.1/libzmpeg3/Makefile
index 47a0596f..cddcf611 100644
--- a/cinelerra-5.1/libzmpeg3/Makefile
+++ b/cinelerra-5.1/libzmpeg3/Makefile
@@ -79,7 +79,7 @@ UTILS += $(OBJDIR)/zmpeg3ifochk
 UTILS += $(OBJDIR)/zmpeg3cc2txt

 LIBS = -lm -lpthread
-
+LIBS += -la52
 LIBS += $(lib_a52dec) $(lib_djbfft) $(lib_libbthread)

 ifeq ($(DYNAMIC_FONTS), 1)
$
Randrianasulu commented 2 years ago

configure line for cinelerra-gg I used (because some switches do not work yet)

$ ./configure --with-single-user --disable-static-build --without-lv2 --without-vaapi --without-vdpau --without-dv --without-firewire --without-thirdparty

Randrianasulu commented 2 years ago

might be related: https://mail.coreboot.org/hyperkitty/list/openbios@openbios.org/thread/CUVAAOIFTDKGSKFILBWVD5PGI26H4IIQ/

https://sourceware.org/bugzilla/show_bug.cgi?id=28900

Randrianasulu commented 2 years ago

gdb from debian 8.11 works on same (emulated) machine

github-actions[bot] commented 2 years ago

Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.