1

Currently, I am using VS Code to write QEMU-related code. I use the clangd plugin, which requires the compile_command.json file. Although I generated this file with the appropriate command ninja -t compdb > compile_commands.jso, clangd still cannot prompt correctly. Additionally, I would like to use clang-format to format the code, but I cannot locate the .clang-format file that QEMU is using. I am also curious about the code formatting tool that QEMU developers use.

I want to know how the QEMU developers write the code especially what they use to debug and format the code.

董继斌
  • 11
  • 1
  • This doesn't seem like the best venue to ask, because most QEMU developers aren't going to read this. You could try the qemu-devel mailing list. Personally, I use emacs... – Peter Maydell May 24 '23 at 20:06
  • If you attach [clangd logs](https://clangd.llvm.org/troubleshooting#gathering-logs) to your question, that might contain some clues about the first issue (clangd not prompting correctly). Not sure about the formatting questions – HighCommander4 May 25 '23 at 01:27
  • You shouldn't need to manually generate a compile_commands.json, because when you build QEMU that will create one for you in the build directory. – Peter Maydell May 25 '23 at 09:27
  • @PeterMaydell Thank you for your comment. I was able to locate the compile_commands.json file, but clangd is still not working perfectly. The main issue appears to be the numerous configurations (#ifdefs) that make it difficult for clangd to determine what is happening. Currently, there are no issues with clangd or qemu, but Emacs is not suitable for me right. I think I will just disable the code hint in vscode. – 董继斌 Jun 07 '23 at 05:57
  • @HighCommander4 Thank you as well. As for the formatting question, I think that developers have to maintain good formatting practices through self-awareness. Some code is too old for auto-formatting tools, which can cause many issues. However, I will also trying the qemu-devel mailing list for more assistance, since there some wrong code styles in qemu right now. – 董继斌 Jun 07 '23 at 05:59

0 Answers0