
#CLION REMOTE CODE#
You can also directly type commands into gdb by switching to the gdb tab (when the program is paused)įor better code analysis and navigation, you can mark your xv6 folder as Project Sources and Headers, and add the line "include_directories()" to CMakeLists.txt To create a conditional breakpoint, right click on a normal breakpoint to add the condition.
#CLION REMOTE DOWNLOAD#
(If you cannot find this file, build xv6 again and download the built folder to your local machine)įor testing, let's create a breakpoint at kernel/proc.c:261 by clicking the space next to the line number (same as "b kernel/proc.c:261" in gdb).Ĭlick the debug button on the top-right corner. Choose the symbol file to be /kernel/kernel. Set ' target remote' args to be localhost:Ĥ. Add new configuration of type " GDB Remote Debug"ģ. Click " Edit configuration" on the top-rightĢ. (This is called SSH tunneling or SSH port forwarding so that we can access the gdb server running on the CS Lab machine via localhost: on your local machine) Note: Please leave the terminal window open at the background in the following steps. Open another terminal window, and use the following command to forward the port (recorded in step 2) on the remote server to your local machine.
#CLION REMOTE HOW TO#
Please refer to this tutorial if you don't know how to do this.ĥ. Open CLion and sync the folder to your local machine. (What qemu-nox-gdb does is that it runs a gdb server at localhost:25784 so that gdb can later connect to this server to debug the code.)Ĥ. I always have 25784, but it might be different for you. Copy xv6 to your working directory on a CS Lab machine, build the source, and run xv6 in debug mode. emperor-01.cs. through emperor-07.cs.Ģ.rockhopper-01.cs. through rockhopper-09.cs.We don't want to use this because it might change over time.) (best-linux.cs. is the Linux machine in the CS labs that currently has the fewest number of other users logged in to it. Please use a specific server in the following list instead of best-linux.cs. Note: You can skip this part if you are compiling xv6 on your local computer or you are already in the CS Lab.ġ. I highly recommend to watch the video first, but this tutorial doesn't require any prior knowledge about gdb. You can find the recorded video on this piazza page. Shivaram has a great tutorial about using gdb to debug xv6 during the discussion section. I have another tutorial about debugging general C programs here: Remote Debug and Execution using CLion. Since xv6 is running in QEMU (instead of a host machine), we have to manually connect gdb to the gdb server, which complicates the setup process. This tutorial is specifically focused on debugging xv6. If you haven't installed CLion or haven't set up file synchronization, you can read my previous tutorial: Setting up Coding Environment for CS 537. documentation (and declared location) shown for the selected function.code edited on the local machine and automatically synced.gdb connected to xv6 with frames and variables showed.xv6 running remotely on a CS Lab machine.

This tutorial will teach you how to debug xv6 remotely using CLion.
