In older versions of unix, text was included by default, as well as data in the kernel dump, but it was also specified in a.out format, and not in ELF. Today, the default behavior (for Linux, for sure, and not 100% sure of the options for BSD, Solaris, etc.) is to have a basic dump in ELF format without text partitions, but this behavior can be changed.
However, a core dump cannot be performed anyway without any help. The reason for this is that there are two things in the simplest kernel file. One of them is an entry point, the other is code for restoring the state of the processor in the state or immediately before the dump (by default there are also no text sections).
AIX used to have a utility called unump, but I have no idea what happened to it. It does not exist in any standard Linux distribution that I know of. As mentioned above (@WumpusQ), there is also an attempt at a similar Linux project mentioned in the comments above, however this project is not complete and does not restore the processor to its original state. This, however, is still quite good in some specific debugging cases.
It is also worth mentioning that there are other files in the ELF format, which also cannot be executed, which are not the main files. Such as object file files (compiler output) and .so (shared object). To start external addresses, a binding step is required.
source share