VM Android-x86 should have bridge network connection.
Let take RIL daemon as an example.
On VM
Get VM IP address
# ifconfig
Get process id
# ps | grep rild
Start gdb server
# gdbserver64 :5039 --attach pid_of_rild
On host
Start gdb
$ gdb -q (gdb) target remote ip_address_of_vm:5039
Get stack
(gdb) bt
How to debug Android-x86 application running in virtual machine