ARM Stack Frame / Backtrace

ARM: link register and frame pointer
ARM Stack Frame Layout
ARM GCC generated functions prolog
ARM Procedure Call Standard (APCS)
Procedure Call Standard for the ARM Architecture (AAPCS)
On the AAPCS, with an application to efficient parameter passing
ARM to C calling convention, registers to save


Der Stack Frame
Deep Wizardry: Stack Unwinding
What is exactly the base pointer and stack pointer? To what do they point?
What is stack unwinding?
Stack Unwinding in C++, The stack_unwinding is a small header only C++ library which supplies primitive(class unwinding_indicator) to determining when object destructor is called due to stack-unwinding or due to normal scope leaving.


libc Backtraces
How to automatically generate a stacktrace when my gcc C++ program crashes
Backtrace on ARM has repeating entries

libunwind / Call chain

  • allows you to easily walk the stack frames
  • access to the callee-saved registers contents
  • support for resuming execution at a certain frame

The libunwind project
KenWerner/Sandbox/libunwind – Linaro Wiki
Stack frame unwinding on ARM (2011)

#include <libunwind.h>

void show_backtrace (void) {
  unw_cursor_t cursor; unw_context_t uc;
  unw_word_t ip, sp;

  unw_init_local(&cursor, &uc);
  while (unw_step(&cursor) > 0) {
    unw_get_reg(&cursor, UNW_REG_IP, &ip);
    unw_get_reg(&cursor, UNW_REG_SP, &sp);
    printf ("ip = %lx, sp = %lx\n", (long) ip, (long) sp);

libbacktrace, A C library that may be linked into a C/C++ program to produce symbolic backtraces (2018)


Before Android 8.0, crashes were handled by the debuggerd and debuggerd64 daemons. In Android O and later, crash_dump32 and crash_dump64 are spawned as needed.
Debugging Native Android Platform Code
android / platform / system / core / libbacktrace
android / platform / system / core / include / backtrace / backtrace.h/a>
android / platform / system / libbacktrace / Backtrace.cpp
android-aosp-sdcard debuggerd backtrace.c, Rewrite libbacktrace using C++
am 98f87d92: Merge “Rewrite libbacktrace using C++.”

Breakpoint 1, main () at /home/andreas/src/DermoInspectMiniServer/src/tcp_server.cpp:79
79          A();
(gdb) info register pc lr sp fp
pc             0x142824 0x142824 <main()+72>
lr             0x76d7b208       1993847304
sp             0x7efff568       0x7efff568
fp             0x7efff5fc       0x7efff5fc

(gdb) s
A () at /home/andreas/src/DermoInspectMiniServer/src/tcp_server.cpp:72
72              B();
(gdb) info register pc lr sp fp
pc             0x1427d0 0x1427d0 <A()+8>
lr             0x142828 1321000
sp             0x7efff560       0x7efff560
fp             0x7efff564       0x7efff564

(gdb) s
B () at /home/andreas/src/DermoInspectMiniServer/src/tcp_server.cpp:67
67              C();
(gdb) info register pc lr sp fp
pc             0x1427bc 0x1427bc <B()+8>
lr             0x1427d4 1320916
sp             0x7efff558       0x7efff558
fp             0x7efff55c       0x7efff55c

(gdb) s
C () at /home/andreas/src/DermoInspectMiniServer/src/tcp_server.cpp:62
62          MyBacktrace();
(gdb) info register pc lr sp fp
pc             0x1427a8 0x1427a8 <C()+8>
lr             0x1427c0 1320896
sp             0x7efff550       0x7efff550
fp             0x7efff554       0x7efff554

(gdb) s
100         frame = (struct frame*) ctx.uc_mcontext.arm_lr;
102         for (int i = 0; frame && frame->fr_savfp; i++) {
(gdb) info register pc lr sp fp
pc             0x170a74 0x170a74 <MyBacktrace()+32>
lr             0x170a6c 1509996
sp             0x7efff238       0x7efff238
fp             0x7efff54c       0x7efff54c


Getting the call stack without a frame pointer

Windows 1803 and AMD Drivers (OpenGL)

WINDOWS 10 KB4100375
“OpenGL 3.3 and later is required” – How to update video card driver (Windows Only)
Windows 10 Spring Update + Radeon drivers 18.3.4 = Mega FAIL
Windows 10 (Ver. 1803) – Treiberproblem mit AMD 18.3.4
Every Single Windows Update
Radeon Software Adrenalin Edition 18.4.1 Release Notes
Graphics card stopped working after windows insder update
Windows 10 April 2018 Update problems and issues

Schrauben / Zylinderschrauben / Innensechskant / Innensechsrund / INOX

83.1345 – Metallschrauben, Edelstahl rostfrei A2, Zylinderkopf nieder, mit Antrieb Torx TX, ohne Schaft, ISO 14580, BN 15857, FN 1952
83.1340 – Metallschrauben, Stahl blau verzinkt, Zylinderkopf nieder, mit Antrieb Torx TX, Festigkeitsklasse 8.8, ohne Schaft, ISO 14580, BN 4850, FN 361
83.1215 – Metallschrauben, Edelstahl rostfrei A2, Zylinderkopf, mit Antrieb Innensechskant SW, ohne Schaft, DIN 912, ISO 4762, BN 610, FN 123
83.1210 – Metallschrauben, Stahl blau verzinkt, Zylinderkopf, mit Antrieb Innensechskant SW, Festigkeitsklasse 8.8, ohne Schaft, DIN 912, ISO 4762, BN 3, FN 120

BN 15857 – ISO 14580 – Zylinderschrauben, Edelstahl rostfrei
BN 272 – DIN 912 – ISO 4762 – Zylinderschrauben, schwarz

Raspberry Pi 3, Notizen

dd bs=4M if=2018-04-18-raspbian-stretch.img of=/dev/sdX conv=fsync
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=20586949-02 rootfstype=ext4 elevator=deadline rootwait
# Uncomment some or all of these to enable the optional hardware interfaces

# Uncomment this to enable the lirc-rpi module

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)


pi@raspberrypi:~$ sudo useradd andreas

pi@raspberrypi:~$ sudo apt-get install openssh-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openssh-server is already the newest version (1:7.4p1-10+deb9u3).
openssh-server set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

pi@raspberrypi:~$ sudo systemctl enable ssh
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.

pi@raspberrypi:~$ sudo systemctl start ssh

pi@raspberrypi:~$ sudo adduser andreas
Adding user `andreas' ...
Adding new group `andreas' (1001) ...
Adding new user `andreas' (1001) with group `andreas' ...
Creating home directory `/home/andreas' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for andreas
Enter the new value, or press ENTER for the default
	Full Name [Andreas Bachman]: bachman0
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] y

pi@raspberrypi:~$ sudo vi /etc/sudoers

pi@raspberrypi:~$ sudo apt-get install samba
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  attr libaio1 libavahi-client3 libcups2 libfile-copy-recursive-perl
  libgpgme11 libldb1 libpython2.7 libtdb1 libtevent0 python-crypto
  python-dnspython python-ldb python-samba python-talloc python-tdb
  samba-common-bin samba-dsdb-modules samba-libs samba-vfs-modules tdb-tools
Suggested packages:
  cups-common gpgsm python-crypto-dbg python-crypto-doc python-gpgme bind9
  bind9utils ctdb ldb-tools ntp | chrony smbldap-tools winbind ufw
The following NEW packages will be installed:
  attr libaio1 libavahi-client3 libcups2 libfile-copy-recursive-perl
  libgpgme11 libldb1 libpython2.7 libtdb1 libtevent0 python-crypto
  python-dnspython python-ldb python-samba python-talloc python-tdb samba
  samba-common-bin samba-dsdb-modules samba-libs samba-vfs-modules tdb-tools
0 upgraded, 23 newly installed, 0 to remove and 0 not upgraded.
Need to get 9,643 kB of archives.
After this operation, 49.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 stretch/main armhf python-dnspython all 1.15.0-1 [102 kB]
Get:2 stretch/main armhf python-crypto armhf 2.6.1-7 [253 kB]
Get:3 stretch/main armhf libtdb1 armhf 1.3.11-2 [38.0 kB]
Get:4 stretch/main armhf libtevent0 armhf 0.9.31-1 [24.7 kB]
Get:5 stretch/main armhf libldb1 armhf 2:1.1.27-1 [92.1 kB]
Get:6 stretch/main armhf libpython2.7 armhf 2.7.13-2+deb9u2 [914 kB]
Get:7 stretch/main armhf python-ldb armhf 2:1.1.27-1 [30.0 kB]
Get:8 stretch/main armhf python-tdb armhf 1.3.11-2 [15.3 kB]
Get:9 stretch/main armhf python-talloc armhf 2.1.8-1 [11.3 kB]
Get:10 stretch/main armhf libavahi-client3 armhf 0.6.32-2 [51.3 kB]
Get:11 stretch/main armhf libcups2 armhf 2.2.1-8 [272 kB]
Get:12 stretch/main armhf samba-libs armhf 2:4.5.12+dfsg-2+deb9u2 [4,377 kB]
Get:13 stretch/main armhf python-samba armhf 2:4.5.12+dfsg-2+deb9u2 [1,143 kB]
Get:14 stretch/main armhf samba-common-bin armhf 2:4.5.12+dfsg-2+deb9u2 [555 kB]
Get:15 stretch/main armhf tdb-tools armhf 1.3.11-2 [25.7 kB]
Get:16 stretch/main armhf libfile-copy-recursive-perl all 0.38-1 [20.6 kB]
Get:17 stretch/main armhf update-inetd all 4.44 [20.8 kB]
Get:18 stretch/main armhf samba armhf 2:4.5.12+dfsg-2+deb9u2 [869 kB]
Get:19 stretch/main armhf attr armhf 1:2.4.47-2 [41.3 kB]
Get:20 stretch/main armhf libaio1 armhf 0.3.110-3 [9,366 B]
Get:21 stretch/main armhf libgpgme11 armhf 1.8.0-3 [141 kB]
Get:22 stretch/main armhf samba-dsdb-modules armhf 2:4.5.12+dfsg-2+deb9u2 [304 kB]
Get:23 stretch/main armhf samba-vfs-modules armhf 2:4.5.12+dfsg-2+deb9u2 [334 kB]
Fetched 9,643 kB in 7s (1,259 kB/s)                                            
Preconfiguring packages ...
Selecting previously unselected package python-dnspython.
(Reading database ... 35265 files and directories currently installed.)
Preparing to unpack .../00-python-dnspython_1.15.0-1_all.deb ...
Unpacking python-dnspython (1.15.0-1) ...
Selecting previously unselected package python-crypto.
Preparing to unpack .../01-python-crypto_2.6.1-7_armhf.deb ...
Unpacking python-crypto (2.6.1-7) ...
Selecting previously unselected package libtdb1:armhf.
Preparing to unpack .../02-libtdb1_1.3.11-2_armhf.deb ...
Unpacking libtdb1:armhf (1.3.11-2) ...
Selecting previously unselected package libtevent0:armhf.
Preparing to unpack .../03-libtevent0_0.9.31-1_armhf.deb ...
Unpacking libtevent0:armhf (0.9.31-1) ...
Selecting previously unselected package libldb1:armhf.
Preparing to unpack .../04-libldb1_2%3a1.1.27-1_armhf.deb ...
Unpacking libldb1:armhf (2:1.1.27-1) ...
Selecting previously unselected package libpython2.7:armhf.
Preparing to unpack .../05-libpython2.7_2.7.13-2+deb9u2_armhf.deb ...
Unpacking libpython2.7:armhf (2.7.13-2+deb9u2) ...
Selecting previously unselected package python-ldb.
Preparing to unpack .../06-python-ldb_2%3a1.1.27-1_armhf.deb ...
Unpacking python-ldb (2:1.1.27-1) ...
Selecting previously unselected package python-tdb.
Preparing to unpack .../07-python-tdb_1.3.11-2_armhf.deb ...
Unpacking python-tdb (1.3.11-2) ...
Selecting previously unselected package python-talloc.
Preparing to unpack .../08-python-talloc_2.1.8-1_armhf.deb ...
Unpacking python-talloc (2.1.8-1) ...
Selecting previously unselected package libavahi-client3:armhf.
Preparing to unpack .../09-libavahi-client3_0.6.32-2_armhf.deb ...
Unpacking libavahi-client3:armhf (0.6.32-2) ...
Selecting previously unselected package libcups2:armhf.
Preparing to unpack .../10-libcups2_2.2.1-8_armhf.deb ...
Unpacking libcups2:armhf (2.2.1-8) ...
Selecting previously unselected package samba-libs:armhf.
Preparing to unpack .../11-samba-libs_2%3a4.5.12+dfsg-2+deb9u2_armhf.deb ...
Unpacking samba-libs:armhf (2:4.5.12+dfsg-2+deb9u2) ...
Selecting previously unselected package python-samba.
Preparing to unpack .../12-python-samba_2%3a4.5.12+dfsg-2+deb9u2_armhf.deb ...
Unpacking python-samba (2:4.5.12+dfsg-2+deb9u2) ...
Selecting previously unselected package samba-common-bin.
Preparing to unpack .../13-samba-common-bin_2%3a4.5.12+dfsg-2+deb9u2_armhf.deb ...
Unpacking samba-common-bin (2:4.5.12+dfsg-2+deb9u2) ...
Selecting previously unselected package tdb-tools.
Preparing to unpack .../14-tdb-tools_1.3.11-2_armhf.deb ...
Unpacking tdb-tools (1.3.11-2) ...
Selecting previously unselected package libfile-copy-recursive-perl.
Preparing to unpack .../15-libfile-copy-recursive-perl_0.38-1_all.deb ...
Unpacking libfile-copy-recursive-perl (0.38-1) ...
Selecting previously unselected package update-inetd.
Preparing to unpack .../16-update-inetd_4.44_all.deb ...
Unpacking update-inetd (4.44) ...
Selecting previously unselected package samba.
Preparing to unpack .../17-samba_2%3a4.5.12+dfsg-2+deb9u2_armhf.deb ...
Unpacking samba (2:4.5.12+dfsg-2+deb9u2) ...
[  615.677679] Under-voltage detected! (0x00050005)
Selecting previously unselected package attr.
Preparing to unpack .../18-attr_1%3a2.4.47-2_armhf.deb ...
Unpacking attr (1:2.4.47-2) ...
Selecting previously unselected package libaio1:armhf.
Preparing to unpack .../19-libaio1_0.3.110-3_armhf.deb ...
Unpacking libaio1:armhf (0.3.110-3) ...
Selecting previously unselected package libgpgme11:armhf.
Preparing to unpack .../20-libgpgme11_1.8.0-3_armhf.deb ...
Unpacking libgpgme11:armhf (1.8.0-3) ...
Selecting previously unselected package samba-dsdb-modules.
Preparing to unpack .../21-samba-dsdb-modules_2%3a4.5.12+dfsg-2+deb9u2_armhf.deb ...
Unpacking samba-dsdb-modules (2:4.5.12+dfsg-2+deb9u2) ...
Selecting previously unselected package samba-vfs-modules.
Preparing to unpack .../22-samba-vfs-modules_2%3a4.5.12+dfsg-2+deb9u2_armhf.deb ...
Unpacking samba-vfs-modules (2:4.5.12+dfsg-2+deb9u2) ...
Setting up python-dnspython (1.15.0-1) ...
Setting up libtdb1:armhf (1.3.11-2) ...
Setting up python-crypto (2.6.1-7) ...
Setting up libgpgme11:armhf (1.8.0-3) ...
Setting up libtevent0:armhf (0.9.31-1) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up libaio1:armhf (0.3.110-3) ...
Processing triggers for systemd (232-25+deb9u2) ...
Setting up libpython2.7:armhf (2.7.13-2+deb9u2) ...
Setting up tdb-tools (1.3.11-2) ...
update-alternatives: using /usr/bin/tdbbackup.tdbtools to provide /usr/bin/tdbbackup (tdbbackup) in auto mode
Processing triggers for man-db ( ...
[  626.077803] Under-voltage detected! (0x00050005)
Setting up libavahi-client3:armhf (0.6.32-2) ...
Setting up attr (1:2.4.47-2) ...
Setting up libfile-copy-recursive-perl (0.38-1) ...
Setting up libcups2:armhf (2.2.1-8) ...
Setting up python-talloc (2.1.8-1) ...
Setting up update-inetd (4.44) ...
Setting up python-tdb (1.3.11-2) ...
Setting up libldb1:armhf (2:1.1.27-1) ...
Setting up python-ldb (2:1.1.27-1) ...
Setting up samba-libs:armhf (2:4.5.12+dfsg-2+deb9u2) ...
Setting up samba-vfs-modules (2:4.5.12+dfsg-2+deb9u2) ...
Setting up python-samba (2:4.5.12+dfsg-2+deb9u2) ...
Setting up samba-common-bin (2:4.5.12+dfsg-2+deb9u2) ...
Setting up samba-dsdb-modules (2:4.5.12+dfsg-2+deb9u2) ...
Setting up samba (2:4.5.12+dfsg-2+deb9u2) ...
Adding group `sambashare' (GID 113) ...
Samba is not being run as an AD Domain Controller, masking samba-ad-dc-service.
Please ignore the following error about deb-systemd-helper not finding samba-ad-dc-service.
Created symlink /etc/systemd/system/ → /lib/systemd/system/nmbd.service.
[  642.717966] Under-voltage detected! (0x00050005)
Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory
Created symlink /etc/systemd/system/ → /lib/systemd/system/smbd.service.
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for systemd (232-25+deb9u2) ...

$ sudo vi /etc/samba/smb.conf 

security = user
read only = no

$ sudo /etc/init.d/samba restart
Restarting nmbd (via systemctl): nmbd.service.
Restarting smbd (via systemctl): smbd.service.

$ sudo smbpasswd -a andreas
New SMB password:
Retype new SMB password:
Added user andreas.