Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intellisense working in VS2019

26 views
Skip to first unread message

markdo...@gmail.com

unread,
Feb 27, 2020, 9:06:37 AM2/27/20
to
Hi, I'm new to this. I have made Intellisense work in VS2019 with Firefox to give full insight to the code. Would anyone be interested in my steps or is this something obvious?

Nicholas Alexander

unread,
Feb 27, 2020, 12:02:18 PM2/27/20
to markdo...@gmail.com, dev-builds
Hi Mark,

On Thu, Feb 27, 2020 at 6:10 AM <markdo...@gmail.com> wrote:
Hi, I'm new to this. I have made Intellisense work in VS2019 with Firefox to give full insight to the code. Would anyone be interested in my steps or is this something obvious?

I have no idea if this is obvious, but it sounds cool!  A really rough sketch of your steps, like `./mach build-backend -b ...` and then modify this and edit this might help us understand how subtle this is, where we might improve to make this easier, etc.  Maybe others are doing this regularly and it is well understood?  I hope others will speak up if that's so.

It feels like https://bugzilla.mozilla.org/show_bug.cgi?id=1535732 may be relevant, although that seems to be a blend of "official as in automation" and "official as in supported for developers".

Nick

markdo...@gmail.com

unread,
Feb 29, 2020, 2:00:39 AM2/29/20
to
If people find this useful, we might be able to bring it back into the docs for getting Firefox to build for Windows:

VS2017/VS2019 SETUP:

I wanted to do the following:
- Enable Intellisense to get a better view into the codebase with Visual Studio's great tools (I'm operating with VS2019 Enterprise at the moment)
- Step through as much of the code as I can

Ingredients:
VS2017 or VS2019 Community minimum.

Method:
Install the MozillaBuild tools (https://wiki.mozilla.org/MozillaBuild)

In the MinGW32 shell, Clone the source code:
hg clone https://hg.mozilla.org/mozilla-central

Change this to stop unified builds for debug stepping purposes:
- https://bugzilla.mozilla.org/attachment.cgi?id=9097538&action=diff

Create a file mozconfig in the top source directory (mozilla-central) in order to be able to step through all the code in VS:
ac_add_options --disable-optimize
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32

Kill tasks to enable a clean build/tool setup if they exist:
Any tasks running from \Users\[LoginID]\.mozbuild (or the directory you installed the tools to)
Remove \Users\[ID]\mercurial.ini folder
Remove \Users\[ID]\.mozbuild folder

In the MinGW32 shell, clean and install tools:
mach clobber
mach bootstrap

Start the MinGW32 shell again, and configure and build:
mach configure
mach build

Set the Windows Path in the environment variables for the clang compiler to the \Users\[LoginID]\.mozbuild version. Remove references to other clang directories from the PATH variables.

Start the MinGW32 shell again:
mach build-backend -b VisualStudio

For the next changes, VSCode has nice multi-line/multi-file search/replace.

In the top object folder (obj-x86_64-pc-mingw32):

Set project settings debugger to Native Only:

Searching only *.vcxproj.user files, replace:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

with

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Build|Win32'">
<LocalDebuggerDebuggerType>NativeOnly</LocalDebuggerDebuggerType>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

Pre-processor macro definitions:

Searching only *.vcxproj files, replace:

;_SECURE_ATL

with

;_SECURE_ATL;MOZILLA_INTERNAL_API;MOZILLA_OFFICIAL

(Optional VS2019 only) Retarget solution to latest tools/platform:

Searching only *.vcxproj files, replace:

<PlatformToolset>v141</PlatformToolset>

with

<PlatformToolset>v142</PlatformToolset>

In VS2017/2019, install and enable child-process debugging:
- https://marketplace.visualstudio.com/items?itemName=vsdbgplat.MicrosoftChildProcessDebuggingPowerTool

In VS, go to the Child Process Debugging Settings and make sure "Enable child process debugging" is checked and saved.

Load the obj-x86_64-pc-mingw32\msvc\mozilla.sln solution in VS2017/VS2019, and select Firefox.exe project as the Startup Project.

Work through remaining Intellisense errors (in the Error List view, select Intellisense Only. A few particular fixes will clear up the rest of them):

Add cairo/ in front of missing cairo header references to find them correctly.
Comment out defines that include assertions only (e.g. static_assert calls)
Add /std:c++17 to Intellisense Additional Options in the firefox.exe properties NMake section. This enables VS Intellisense to understand the C++17 language constructs without complaining.

Click Project/Rescan Solution (will probably happen automatically if you close and reload the solution)

Add Intellisense Preprocessor definitions in appropriate projects if assertions still demand it:
MOZILLA_INTERNAL_API
MOZILLA_OFFICIAL

Make a backup of the msvc folder in obj-x86_64-pc-mingw32. If "mach build" decides to run "mach build-backend -b VisualStudio" you will lose your changes to the Visual Studio build.

Optional:
Install Mercurial for Windows
Install Mercurial Support extension in VS

Let me know if you have any questions. It took a lot of messing around to get past certain issues.
0 new messages