Recent

Author Topic: Common File Dialogs Have Been Broken for a Very Long Time (Ex: Ubuntu AARCH64)  (Read 9291 times)

msintle

  • Full Member
  • ***
  • Posts: 233
Is where it blows up!
SIGFPE

Quote
The SIGFPE signal reports a fatal arithmetic error. Although the name is derived from “floating-point exception”, this signal actually covers all arithmetic errors, including division by zero and overflow. If a program stores integer data in a location which is then used in a floating-point operation, this often causes an “invalid operation” exception, because the processor cannot recognize the data as a floating-point number.

Just to make sure.... This error also occurs if you run the compiled program outside the IDE (and thus debugger)?

Yes

msintle

  • Full Member
  • ***
  • Posts: 233
Can you repeat your test in a clean environment - if you don't believe in VMs, format a disposable device and run bare metal on it - it is very possible that missing dependencies could be the culprit (which is a primary advantage of VM testing).
I am on a clean environment on bare metal (rpi 4, also aarch64 and debian ;) ). Retesting wouldn't make a difference. If it's working on a system it might not be possible to make it fail.

That's why the others are saying it might be an issue on specific hardware, and not a generic problem on aarch64. Maybe someone with paralels can test this.

I believe you that you have a problem (others do too). But if nobody can reproduce it (especially developers) it's hard to pinpoint the exact culprit.

Can you test a standard distribution of Lazarus (or use a different install script)?
(I never used fpcdeluxe but use my own script.)

So how did you install Lazarus on your pi? Maybe your installation added some shared objects mine didn't?

rvk

  • Hero Member
  • *****
  • Posts: 6572
So how did you install Lazarus on your pi? Maybe your installation added some shared objects mine didn't?

Code: Bash  [Select][+][-]
  1. sudo apt-get -y install make binutils build-essential gdb git zip unzip
  2. sudo apt-get -y install libx11-dev libgtk2.0-dev  # for Lazarus, includes all dependencies

This will automatically install some other dependencies too.
So I didn't install these but they get installed with above lines.

Code: Bash  [Select][+][-]
  1. # sudo apt-get -y install libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev lpango-1.0 libpangox-1.0-dev xorg-dev libatk1.0-dev libgtk2.0-dev
  2. # libgtk2.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev
  3. # or
  4. # xorg-dev libssl-dev libx11-dev libgdk-pixbuf2.0-dev
  5. # libcairo2-dev lpango-1.0 libpangox-1.0-dev libatk1.0-dev libgtk2.0-dev

But my understanding was that fpcupdeluxe also checks for these.


msintle

  • Full Member
  • ***
  • Posts: 233
I installed 4.0 RC1 from the deb packages, same result.

I reset the VM to a clean slate, ran your dependency installs first, then again the DEBs; again the same result.

Maybe I can try your Lazarus install scripts next?

Edit: Is your pi using this install image?

https://cdimage.debian.org/debian-cd/current/arm64/iso-dvd/
« Last Edit: November 05, 2024, 08:48:02 pm by msintle »

rvk

  • Hero Member
  • *****
  • Posts: 6572
Maybe I can try your Lazarus install scripts next?
Currently looks like this.
Creates ~/dev directory and puts everything under it.
Works for several architectures and systems.

Code: Bash  [Select][+][-]
  1. #!/bin/bash
  2. # ======================================================
  3. # by rvk (v.1.8, 2023-09-01)
  4. # ======================================================
  5.  
  6. echo ""
  7. echo "=============================================================="
  8. echo "Running on: $(sed 's/\x0/ /' /sys/firmware/devicetree/base/model 2>/dev/null || cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null || echo Unknown)"
  9.  
  10. # ======================================================
  11. # setup versions, download and compile
  12. # ======================================================
  13.  
  14. #fpc_version="release_3_2_0"
  15. #laz_version="lazarus_2_0_12"
  16.  
  17. #fast
  18. zip=0
  19.  
  20. # repository
  21. fpc_git=1
  22. laz_git=1
  23.  
  24. # compile
  25. fpc_compile=1
  26. laz_compile=1
  27.  
  28. # ======================================================
  29. # check if we are running in bash instead of sh
  30. ps $$ 2>&1 | grep bash > /dev/null 2>&1 && echo "Running in bash. continuing..." || { echo "Not running in bash. Aborting..."; exit 1; }
  31.  
  32. # ======================================================
  33. # optional use zram as swapfile
  34. # ======================================================
  35. # not done yet
  36.  
  37. # ======================================================
  38. # minimal swap space needed is 1024MB
  39. # ======================================================
  40. while true; do
  41.  
  42.   FREESWAP=$(free | grep -i swap | awk '{print $2}')
  43.   if [ $FREESWAP -lt 900000 ]; then
  44.  
  45.     echo "=============================================================="
  46.     echo "Current swapsize is $FREESWAP"
  47.     echo "Swapsize is really small. Recomended size is 1024MB (1GB).";
  48.     echo "=============================================================="
  49.  
  50.     read -n1 -p "Do you want to increase it to 1024MB (1GB) or continue without swap? [y/n/c] " yn
  51.     echo ""
  52.     case $yn in
  53.       [Cc]* ) break;;
  54.       [Yy]* ) ;;
  55.       [Nn]* ) echo >&2 "Please increase the swap space manually. Aborting..."; exit 1;;
  56.       [Qq]* ) exit 1;;
  57.       * ) echo "Please answer yes or no."; echo ""; continue;;
  58.     esac
  59.  
  60.     # we can increase this if /etc/dphys-swapfile exists
  61.     [ -f /etc/dphys-swapfile ] && {
  62.       echo "=============================================================="
  63.       echo "Setting in /etc/dphys-swapfile $(cat /etc/dphys-swapfile | grep CONF_SWAPSIZE)"
  64.       echo "Increasing value and restarting swap"
  65.       sudo sed -i 's/CONF_SWAPSIZE=[0-9]*$/CONF_SWAPSIZE=1024/g' /etc/dphys-swapfile
  66.       sudo /etc/init.d/dphys-swapfile stop
  67.       sudo /etc/init.d/dphys-swapfile restart
  68.       echo "=============================================================="
  69.     } || {
  70.       echo "=============================================================="
  71.       echo "Setting up /swapfile"
  72.       DATE=$(date +%s)
  73.       sudo fallocate -l 1G "/swapfile.$DATE" \
  74.       && sudo chmod 600 "/swapfile.$DATE" \
  75.       && sudo mkswap "/swapfile.$DATE" \
  76.       && sudo swapon "/swapfile.$DATE" \
  77.       && sudo swapon --show \
  78.       && echo "Created and turned on /swapfile.$DATE" \
  79.       && echo "Note: This is not permanent."
  80.       echo "=============================================================="
  81.     }
  82.  
  83.   else
  84.     echo "Current swapsize is $FREESWAP. Ok"
  85.     break;
  86.   fi
  87.  
  88. done
  89.  
  90. # ======================================================
  91. begin=$(date +%s)
  92.  
  93. # ======================================================
  94. # update packages list to latest version
  95. # ======================================================
  96. echo "=============================================================="
  97. echo ""
  98. echo "Updating package list to latest version (sudo needed)"
  99. echo ""
  100. apt-get --version >/dev/null 2>&1 || { echo >&2 "I require apt-get but it's not installed. Aborting."; exit 1; }
  101. sudo apt-get update >/dev/null || { echo >&2 "apt-get update cannot be run. Aborting."; exit 1; }
  102.  
  103. # ======================================================
  104. # some other essentials
  105. # ======================================================
  106. echo "=============================================================="
  107. echo ""
  108. echo "Installing required packages (sudo used)"
  109. echo ""
  110. sudo apt-get -y install make binutils build-essential gdb git zip unzip pv
  111. sudo apt-get -y install libx11-dev libgtk2.0-dev  # for Lazarus, includes all dependencies
  112.  
  113. # sudo apt-get -y install libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev lpango-1.0 libpangox-1.0-dev xorg-dev libatk1.0-dev libgtk2.0-dev
  114. # libgtk2.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev
  115. # or
  116. # xorg-dev libssl-dev libx11-dev libgdk-pixbuf2.0-dev
  117. # libcairo2-dev lpango-1.0 libpangox-1.0-dev libatk1.0-dev libgtk2.0-dev
  118.  
  119. git --version >/dev/null 2>&1 || { echo >&2 "I require git but it's not installed. Aborting."; exit 1; }
  120.  
  121. # ======================================================
  122. #
  123. # ======================================================
  124. BASE=$HOME/dev
  125. mkdir -p $BASE
  126. cd $BASE
  127.  
  128. # ======================================================
  129. # We need a bootstrap compiler fpc 3.2.2
  130. # There is NONE AVAILABLE so we need to download complete
  131. # fpc-3.2.2.arm-linux-raspberry1wq.tar
  132. # in virtualbox Rasbian stretch we need i386
  133. # ======================================================
  134.  
  135. echo "=============================================================="
  136. echo ""
  137. CPU=$(uname -m)                  # aarch64, armv7l # note L not 1
  138. CPU=$(dpkg --print-architecture) # arm64, armhf
  139. if [ "$CPU" = "armhf" ]; then # note L not 1
  140.   echo "Compiling for ARMv7 Processor (Pi2 and higher only)"
  141.   OPTIONS_FPC="-g -gl -gw3 -O2 -Xs -CX -XX -v0 -dFPC_ARMHF"
  142.   OPTIONS_LAZ="-g -gl -gw3 -v0"
  143.   OS_TARGET="linux"
  144.   CPU_TARGET="arm"
  145.   COMP3_DOWNLOAD="fp-compiler" # distribution version
  146.   COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.2/arm-linux/fpc-3.2.2.arm-linux.tar" # complete version
  147.   COMP=ppcarm
  148. elif [ "$CPU" = "arm64" ]; then
  149.   echo "Compiling for ARM64 Processor (Pi2 and higher only)"
  150.   OPTIONS_FPC="-g -gl -gw3 -O2 -Xs -CX -XX -v0 -dFPC_ARMHF"
  151.   OPTIONS_LAZ="-g -gl -gw3 -v0"
  152.   OS_TARGET="linux"
  153.   CPU_TARGET="aarch64"
  154.   COMP3_DOWNLOAD="fp-compiler" # distribution version
  155.   COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.2/aarch64-linux/fpc-3.2.2.aarch64-linux.tar" # complete version
  156.   COMP=ppca64
  157. elif [ "$CPU" = "amd64" ]; then
  158.   echo "Compiling for x64 Processor"
  159.   OPTIONS_FPC="-g -gl -gw3 -O2 -Xs -CX -XX -v0"
  160.   OPTIONS_LAZ="-g -gl -gw3 -v0"
  161.   OS_TARGET="linux"
  162.   CPU_TARGET="x86_64"
  163.   COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.2/x86_64-linux/fpc-3.2.2.x86_64-linux.tar" # complete version
  164.   #COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.0/x86_64-linux/fpc-3.2.0-x86_64-linux.tar" # complete version
  165.   COMP=ppcx64
  166. elif [ "$CPU" = "i686" ]; then
  167.   echo "Compiling for i686 Processor"
  168.   OPTIONS_FPC="-g -gl -gw3 -O2 -Xs -CX -XX -v0 -dFPC_I386"
  169.   OPTIONS_LAZ="-g -gl -gw3 -v0"
  170.   OS_TARGET="linux"
  171.   CPU_TARGET="i386"
  172.   COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.2/i386-linux/fpc-3.2.2.i386-linux.tar" # complete version
  173.   COMP=ppc386
  174. else
  175.   echo >&2 "$CPU is not supported as processor (needed armv7l/x86_64/i686). Aborting."; exit 1;
  176. fi
  177.  
  178. # ------------------------------------------------------
  179.  
  180. echo "=============================================================="
  181. if [ ! -x ./bootstrap/$COMP ]; then
  182.  
  183.   if echo "$COMP3_DOWNLOAD" | grep -q "fp-compiler"; then
  184.  
  185.     echo "Downloading package fp-compiler-3.2.2"
  186.     echo ""
  187.     mkdir -p ./bootstrap
  188.     apt-get download fp-compiler-3.2.2
  189.     dpkg-deb --fsys-tarfile fp-compiler*.deb | tar -x ./usr/lib/arm-linux-gnueabihf/fpc/3.2.2/ppcarm --strip-components 6
  190.     mv ppcarm ./bootstrap
  191.     rm ./fp-compiler*.deb
  192.  
  193.   else
  194.  
  195.     echo "Downloading compiler 3.2.2"
  196.     echo ""
  197.     wget --continue --quiet --show-progress -O- $COMP3_DOWNLOAD |\
  198.     tar -O -xf- --wildcards --no-anchored "binary*-linux.tar" --strip=1 |\
  199.     tar -O -xf- --wildcards --no-anchored "base.*-linux.tar.gz" |\
  200.     tar -xzf- --wildcards --no-anchored "lib/fpc/*/ppc*" --transform "s|lib/fpc/.*/ppc|./bootstrap/ppc|"
  201.  
  202.   fi
  203.  
  204. fi
  205. [ -x ./bootstrap/$COMP ] || { echo >&2 "Bootstrap $BASE/bootstrap/$COMP compiler not found. Aborting."; exit 1; }
  206.  
  207. echo "Using bootstrap $BASE/bootstrap/$COMP compiler"
  208. echo ""
  209.  
  210. # ======================================================
  211. # downloading fpc and lazarus
  212. # ======================================================
  213. if [ "$zip" = "1" ]; then
  214.  
  215.   sudo wget -O /usr/bin/zram.sh https://raw.githubusercontent.com/novaspirit/rpi_zram/master/zram.sh
  216.  
  217.   wget --continue --quiet --show-progress -O fpc.zip "https://gitlab.com/freepascal.org/fpc/source/-/archive/main/source-main.zip"
  218.   wget --continue --quiet --show-progress -O laz.zip "https://gitlab.com/freepascal.org/lazarus/lazarus/-/archive/main/lazarus-main.zip"
  219.   unzip fpc.zip
  220.   unzip laz.zip
  221.   mv lazarus-main lazarus
  222.   mv source-main fpc
  223.  
  224. else
  225.  
  226.   if [ "$fpc_git" = "1" ]; then
  227.  
  228.     echo "=============================================================="
  229.     echo ""
  230.     echo "Downloading FPC sources $(git -C fpc log -1 2>&1 | grep Date)"
  231.     echo ""
  232.     [ -d ./fpc ] && { git -C fpc reset --hard && git -C fpc pull -q; } || { git clone https://gitlab.com/freepascal.org/fpc/source.git fpc; }
  233.     [ -f ./fpc/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  234.     echo "Now: $(git -C fpc log -1 | grep Date 2>&1)"
  235.     echo ""
  236.  
  237.   fi
  238.  
  239.   if [ "$laz_git" = "1" ]; then
  240.  
  241.     echo "Downloading Lazarus sources $(git -C lazarus log -1 2>&1 | grep Date)"
  242.     [ -d ./lazarus ] && { git -C lazarus reset --hard && git -C lazarus pull -q; } || { git clone https://gitlab.com/freepascal.org/lazarus/lazarus.git lazarus; }
  243.     [ -f ./lazarus/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  244.     echo "Now: $(git -C lazarus log -1 | grep Date 2>&1)"
  245.     echo ""
  246.  
  247.   fi
  248.  
  249.   if [ "$fpc_version" != "" ]; then
  250.     echo "Switch to fpc $fpc_version"
  251.     git -C fpc checkout tags/$fpc_version
  252.   fi
  253.  
  254.   if [ "$laz_version" != "" ]; then
  255.     echo "Switch to lazarus $laz_version"
  256.     git -C lazarus checkout tags/$laz_version
  257.   fi
  258.  
  259. fi
  260.  
  261. # ======================================================
  262. # compiling fpc
  263. # ======================================================
  264. if [ "$fpc_compile" = "1" ]; then
  265.  
  266. echo "=============================================================="
  267. echo ""
  268. echo "Now compiling FPC, this will take some time"
  269. echo ""
  270. cd $BASE/fpc
  271.  
  272. echo "Cleaning up"
  273. # find . -name "*.ppu" -type f -delete
  274. # find . -name "*.o" -type f -delete
  275. # make clean distclean cleanall > /dev/null 2>&1
  276. git clean -xdf > /dev/null 2>&1    # will clean untracked files and directories
  277.  
  278. echo "make -s all install OPT=\"$OPTIONS_FPC\" OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET INSTALL_PREFIX=$BASE/fpc PP=$BASE/bootstrap/$COMP"
  279.  
  280. make -s all install OPT="$OPTIONS_FPC" OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET INSTALL_PREFIX=$BASE/fpc PP=$BASE/bootstrap/$COMP \
  281.   | pv -l -bp -s2500 >$BASE/fpc.log \
  282.   || { echo >&2 "Compilation of FPC failed. Aborting."; exit 1; }
  283. cd $BASE
  284. [ -x ./fpc/bin/fpc ] || { echo >&2 "Something went wrong compiling FPC. Aborting."; exit 1; }
  285.  
  286. echo ""
  287. echo "Doing some extra configuration"
  288.  
  289. # remove old config
  290. [ -f $HOME/.fpc.cfg ] && rm $HOME/.fpc.cfg
  291. ln -sf $(find $BASE/fpc/lib -name $COMP    ) $BASE/fpc/bin/$COMP
  292. ln -sf $(find $BASE/fpc/lib -name samplecfg) $BASE/fpc/bin/samplecfg
  293. # ln -sf $BASE/fpc/lib/fpc/3.3.1/$COMP $BASE/fpc/bin/$COMP
  294. # ln -sf $BASE/fpc/lib/fpc/3.3.1/samplecfg $BASE/fpc/bin/samplecfg
  295. $BASE/fpc/bin/fpcmkcfg -d basepath=$BASE/fpc -o $HOME/.fpc.cfg
  296.  
  297. # sudo find / -name crtbegin.o
  298. # This library needs to be added to the fpc.cfg file.
  299.  
  300. cat << EOF >> $HOME/.fpc.cfg
  301. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget
  302. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/*
  303. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/rtl
  304. -Fl$(find / -name crtbegin.o -printf '%h\n' 2>/dev/null | head -n 1)
  305. -FD$BASE/fpc/bin
  306. EOF
  307.  
  308. echo ""
  309. echo "Doing some extra configuration"
  310. echo ""
  311.  
  312. # set path withhout old fpc
  313. PATH=$(echo $PATH | sed "s|$BASE/fpc/bin\:||g")
  314.  
  315. # strip previous $BASE from .profile
  316. sed -i '/# FPC PATH/,/fi/d' $HOME/.profile
  317.  
  318. cat << EOF >> $HOME/.profile
  319.  
  320. # FPC PATH
  321. if [ -d $BASE/fpc/bin ] ; then
  322.     PATH="$BASE/fpc/bin:\$PATH"
  323. fi
  324. EOF
  325.  
  326. # replace all double empty lines with one
  327. sed -i '/^$/N;/^\n$/D' $HOME/.profile
  328.  
  329. echo ""
  330.  
  331. fi
  332.  
  333. # ======================================================
  334. # compiling lazarus
  335. # ======================================================
  336. if [ "$laz_compile" = "1" ]; then
  337.  
  338. echo "=============================================================="
  339. echo ""
  340. echo "Now compiling Lazarus, this will take some time"
  341. echo ""
  342. cd $BASE/lazarus
  343.  
  344. echo "Cleaning up"
  345. # find . -name "*.ppu" -type f -delete
  346. # find . -name "*.o" -type f -delete
  347. # make clean distclean cleanall > /dev/null 2>&1
  348. git clean -xdf > /dev/null 2>&1    # will clean untracked files and directories
  349.  
  350. echo "make -s bigide OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET OPT=\"$OPTIONS_LAZ\" PP=$BASE/fpc/bin/fpc"
  351.  
  352. make -s bigide OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET OPT="$OPTIONS_LAZ" PP=$BASE/fpc/bin/fpc \
  353.   | pv -l -bp >$BASE/laz.log \
  354.   || { echo >&2 "Compilation of Lazarus failed. Aborting."; exit 1; }
  355. cd $BASE
  356. [ -f ./lazarus/lazarus ] || { echo >&2 "Something went wrong compiling Lazarus. Aborting."; exit 1; }
  357.  
  358. echo ""
  359. echo "Creating desktop icon"
  360. echo ""
  361.  
  362. cat << EOF > $HOME/Desktop/Lazarus.desktop
  363. [Desktop Entry]
  364. Name=Lazarus
  365. Comment=Lazarus
  366. Icon=$BASE/lazarus/images/ide_icon48x48.png
  367. Exec=$BASE/lazarus/startlazarus
  368. Path=$BASE/lazarus
  369. Type=Application
  370. Encoding=UTF-8
  371. Terminal=false
  372. Categories=None;
  373. EOF
  374.  
  375. fi
  376.  
  377. end=$(date +%s)
  378. echo "=============================================================="
  379. echo ""
  380. echo "$((($end-$begin) / 60)) minutes and $((($end-$begin) % 60)) seconds elapsed."
  381. echo ""
  382. echo "We are done. Please logout and back in before starting Lazarus"
  383. echo "Otherwise you need to supply the fpc location on 1st start"
  384. echo ""
  385. echo "=============================================================="
  386. echo ""

msintle

  • Full Member
  • ***
  • Posts: 233
No joy, exactly the same outcome sadly.

Here's the execution output in the terminal (what happens when I click the file open button on the Lazarus toolbar):

Code: Text  [Select][+][-]
  1. TApplication.HandleException: EAccessViolation
  2. Access violation
  3.   Stack trace:
  4.   $0000FFFFA963B7CC
  5.   $0000FFFFA96418DC
  6.   $0000FFFFA9641AF0
  7.   $0000FFFFA962B568
  8.   $0000FFFFA962E7A8
  9.   $0000FFFFA9AC1638
  10.   $0000000000522420  EnableWindow,  line 2850 of gtk2winapi.inc
  11.   $00000000005931C0  EnableWindow,  line 235 of include/winapi.inc
  12.   $00000000004A5B14  EnableForms,  line 453 of include/screen.inc
  13.   $000000000059BE1C  Execute,  line 44 of include/commondialog.inc
  14.   $00000000004CBF80  mnuOpenClicked,  line 3319 of main.pp
  15.   $0000000000A39B04  DoOnClick,  line 1715 of idecommands.pas
  16.   $0000000000A39B34  DoOnClick,  line 1720 of idecommands.pas
  17.   $0000000000D0308C  Click,  line 681 of toolbarintf.pas
  18.   $0000000000637724  MouseUp,  line 176 of include/toolbutton.inc
  19.   $00000000005CE6E4  DoMouseUp,  line 2364 of include/control.inc
  20.   $00000000005CF4A4  WMLButtonUp,  line 2846 of include/control.inc
  21.  
« Last Edit: November 05, 2024, 09:51:36 pm by msintle »

rvk

  • Hero Member
  • *****
  • Posts: 6572
Longshot and I'm almost sure it doesn't help... but...
Can you set the initial directory to something hardcoded.

Code: Pascal  [Select][+][-]
  1. OpenDialog1.InitialDir := 'myDefault_Path';
  2. OpenDialog1.Execute;
(myDefault_Path beeing something you are sure to have access to)

(We're just guessing here but without being able to reproduce this it's all just a guessing game ;) )

Maybe you can also try setting that exceptionmask.
Not sure if this is the correct way (I don't know much about that setexceptionmask).

Code: Pascal  [Select][+][-]
  1.   FPUExceptionMask := GetExceptionMask;
  2.   SetExceptionMask( [exInvalidOp, exOverflow, exPrecision, exZeroDivide] );
  3.   try
  4.     Opendialog1.Execute;
  5.   finally
  6.     SetExceptionMask(FPUExceptionMask);
  7.   end;
« Last Edit: November 05, 2024, 10:31:54 pm by rvk »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11929
  • FPC developer.
Just remove most of those ex* in the setexceptionmask for testing. If that changes anything, then bring them back one by one till you know which one.

msintle

  • Full Member
  • ***
  • Posts: 233
Holy cow - that worked, folks!

However, strap in your seatbelts - it gets trippy.

I tested all of these masks:

Code: Text  [Select][+][-]
  1. exInvalidOp,
  2. exDenormalized,
  3. exZeroDivide,
  4. exOverflow,
  5. exUnderflow,
  6. exPrecision

Hoping to report the problematic item. The exact code I used:

Code: Pascal  [Select][+][-]
  1. SetExceptionMask( [exInvalidOp, exOverflow, exPrecision, exZeroDivide, exUnderflow, exDenormalized] );

It *still* worked! :o

BUT, if I comment that line out, the crash happens again.

Does that make any sense?

Forum lizards, please don't hold back on my account!

Edit: The default exception mask is NOT equivalent to all of the defined masks above. The debugger trims the exact enumeration and a memory dump shows "32". Falling 10 short of the meaning of life, I'm afraid. Ah, but it's hex; of course. The all inclusive mask is "3F". So is the issue then that the original mask is too narrow?
« Last Edit: November 06, 2024, 12:48:38 am by msintle »

msintle

  • Full Member
  • ***
  • Posts: 233
BTW for completeness sake I also installed Debian 12.7 inside VMware from that download URL I referenced above and reproduced the same crash inside it as well. So the mystery to me is why it works on Pi, but oh well. Happy to leave that unresolved and thanking you folks very much for your generous workaround.

rvk

  • Hero Member
  • *****
  • Posts: 6572
Code: Pascal  [Select][+][-]
  1. SetExceptionMask( [exInvalidOp, exOverflow, exPrecision, exZeroDivide, exUnderflow, exDenormalized] );

It *still* worked! :o

BUT, if I comment that line out, the crash happens again.
You are suppressing any such exception from the framework (I think that's how it works). So it's logical that it works then.

Try
Code: Pascal  [Select][+][-]
  1. SetExceptionMask( [] );
and then adding them one by one until the error happens again.

Glad it works but we still need to know why this is because it can mask an underlying problem.

I'll try the same lines tomorrow on my pi to see if that can reproduce the error somehow.

TRon

  • Hero Member
  • *****
  • Posts: 3618
You are suppressing any such exception from the framework (I think that's how it works). So it's logical that it works then.
That is correct. The function disables the corresponding exceptions.
This tagline is powered by AI

msintle

  • Full Member
  • ***
  • Posts: 233
You are suppressing any such exception from the framework (I think that's how it works). So it's logical that it works then.
That is correct. The function disables the corresponding exceptions.

Oh. So I tried all of them individually, that failed. Setting a completely empty mask also failed. I can see this getting tricky as we'll be having quite a few combinations to test (6^6?) Suggestions on how to approach this programmatically?

TRon

  • Hero Member
  • *****
  • Posts: 3618
See also this entry in the wiki (note the link to forum discussion as well).
This tagline is powered by AI

msintle

  • Full Member
  • ***
  • Posts: 233
Heuristically, I've determined these to be the minimum required masks:

Code: Pascal  [Select][+][-]
  1. SetExceptionMask( [exInvalidOp, exPrecision, exZeroDivide] );
  2.  
Removing anything above reproduces the crash immediately.

 

TinyPortal © 2005-2018