How to debug boot loop?
In practice, the only way to debug early boot loops is to read the kernel log as follows:
Minimum steps to get log if you have a working adb and TWRP:

When the device is boot looping, press and hold VOLUME UP + HOME until the boot loop repeats and you get blue &quot;RECOVERY&quot; text in top left corner (specific key sequence will differ depending on actual harware but above should correct for Samsung devices). The important part is that you have to enter the TWRP recovery directly after failed boot and exact steps to do this depend on the hardware. The above example should be correct for all Samsung devices with hardware home button.

Attach the phone to computer with an USB cable and wait for TWRP to finish booting (the order to attach the phone and TWRP booting is not important).

Extract the kernel log from failed boot. Run following on the host computer command line:


The required command for linux host:
adb shell cat /proc/last_kmsg &gt; ~/Desktop/boot-loop-kernel-log.txt

The required command for Windows host:
adb shell cat /proc/last_kmsg &gt; %UserProfile%/Desktop/boot-loop-kernel-log.txt

You'll end up with a file called boot-loop-kernel-log.txt on your desktop which contains the kernel log of failed boot.
This works because /proc/last_kmsg contains the memory contents of previous boot kernel log ring (this works because kernel keeps this log in known memory address and next boot saves the contents of that memory area before writing the new log in the same location). Some vendors put the previous boot kernel log ring to file /sys/fs/pstore/console-ramoops or cat /sys/fs/pstore/console-ramoops-0 so you may need to do
adb shell cat '/sys/fs/pstore/console-ramoops*' &gt; ~/Desktop/boot-loop-kernel-log.txt

instead, but the idea is still the same. Obviously, if the hardware overwrites all memory with zeros on boot, this cannot work.
In my specific boot looping case the problem was caused by &quot;Live Display&quot; color correction failing during boot process if its settings had been changed from the default. With that specific problem, the workaround was to boot to recovery and execute following as root
rm /data/vendor/display/.displaymodedefault

Long version of instructions to acquire boot log during a boot loop: https://forum.xda-developers.com/showthread.php?t=1520508