How to debug the transaction part in mongodb sever using gdb

I am a beginner who is learning mongodb source code and I try to build mongodb by myself and use gdb to figure out how mongodb implements multi-document transaction.

In my view, the transaction in relica set follows these phases:

  1. All the operations in transaction are done in only 1 recovery_unit in primay
  2. After transation in primary is committed, primary write oplogs.
  3. Secondaries pulls oplogs and apply.
  4. After majority of repl members commit the transaction. the transaction commit.

It seems that in primary, you just move all the operations into one recovery_unit as that for a single docuemnt.

However, here is a question that:
Whether a transaction only uses 1 wriedtiger_recovery_unit_of_work
There is a variable names _toplevel and I want to know the meaning it is, because it I found the wuow.commit(); is called in every insert command, in function void insertDocuments(int src/mongo/db/ops/write_ops_exec.cpp)

I try to figure out it by gdb and I indeed make breakpoint in the mongod. However, bad thing happens: it seems that if I try to debug it for a while, the transaction will abort by itself so I can’t find the trace of it.
I guess it is the time limit for transaction to avoid memory problems, but is there any configurations will help to stop the limit?

Is there any method could help?

As a beginner, I want to know what IDE and debugger you mongodb developers use.
I will apperciate it to your early reply.

Thanks a lot