# Debugging via GDB and 16-bit Application / Database

**URL:** <https://community.hex-rays.com/t/debugging-via-gdb-and-16-bit-application-database/126>\
**Category:** IDA General\
**Created:** [February 4, 2025, 12:06am UTC](https://community.hex-rays.com/t/debugging-via-gdb-and-16-bit-application-database/126 "2025-02-04T00:06:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pheller](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/pheller/32/43_2.png) [@pheller](https://community.hex-rays.com/u/pheller)\
**Post date:** [February 4, 2025, 12:06am UTC](https://community.hex-rays.com/t/debugging-via-gdb-and-16-bit-application-database/126/1 "2025-02-04T00:06:17Z")

</div>

Greetings,

I’m working with a 16-bit x86 real mode application that was imported into IDA as such. Now, while working to connect to a GDB remote implementation in a fork of Dosbox, I am informed:

> The current database is for a 16-bit application  
> but the debugged application (pid=0) is 32-bit.  
> Please check that you are running the correct application.

Is there some particular thing the GDB remote server must return to indicate the application is real mode, does IDA inspect CR0 PE bit, or is it controlled some other way?

Thanks!

---

<div class="post-metadata">

**Author:** ![igor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/igor/32/35_2.png) [@igor](https://community.hex-rays.com/u/igor)\
**Post date:** [February 4, 2025, 3:27pm UTC](https://community.hex-rays.com/t/debugging-via-gdb-and-16-bit-application-database/126/2 "2025-02-04T15:27:33Z")

</div>

Hi,  
Alas, currently the GDB debugger can’t detect 16-bit applications. You can try marking your database 32-bit as a workaround:

`ida_ida.inf_set_app_bitness(32)`

P.S. In case the stub sends only 16 bits of IP, you should also set “Use CS:IP in real mode” in debugger-specific options.

---

<div class="post-metadata">

**Author:** ![pheller](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/pheller/32/43_2.png) [@pheller](https://community.hex-rays.com/u/pheller)\
**Post date:** [February 5, 2025, 4:32am UTC](https://community.hex-rays.com/t/debugging-via-gdb-and-16-bit-application-database/126/3 "2025-02-05T04:32:31Z")

</div>

Thanks for the pointers. I have it working now.

---

<div class="post-metadata">

**Author:** ![igor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/igor/32/35_2.png) [@igor](https://community.hex-rays.com/u/igor)\
**Post date:** [February 5, 2025, 10:29am UTC](https://community.hex-rays.com/t/debugging-via-gdb-and-16-bit-application-database/126/4 "2025-02-05T10:29:54Z")

</div>

Great! When you have some time, could you describe your whole set up for future reference?
