Navigation
Browse the developer docs

FH2 Modding Guide

Game symbols (PDB)

Names for the game's functions in debuggers, crash dumps and disassemblers.

By Trinculo54 · from the FH2 Modding Guide · CC BY 4.0 · copied 4 Dec 2026 · read the original, which may be newer

On this page

A PDB for forza_durango_release_final.exe, the Forza Horizon 2 build that Azimuth runs (24 Nov 2015, TimeDateStamp 0x565501ED, SizeOfImage 0x3A18000). It carries the exe's own GUID and age, so tools accept it as the game's real PDB, with no mismatch override.

It holds names, addresses and function sizes. It has no types, local variables or source lines.

Instead of forza_durango_release_final+0x12CC7A0 you see CollisionWorld::GetPolys+0x70.

Use it

Azimuth maps the game into azimuth.exe by hand, so the game is not a module and no tool finds this PDB on its own: give the game a module entry first. Addresses below are as mapped at 0x140000000 (the base on Windows).

  • Crash reports and game+0x... addresses, no debugger (tried):

    python lookup.py C:\path\to\pdb-folder "C:\path\to\forza_durango_release_final.exe" 0x1412CC7A0
    

    That prints CollisionWorld::GetPolys+0x70 (size 0x4e0).

  • lldb, on a platform minidump (tried), with the exe and the PDB in the current folder:

    lldb -c crash-....dmp
    (lldb) target modules add forza_durango_release_final.exe
    (lldb) target modules load --file forza_durango_release_final.exe --slide 0
    (lldb) image lookup -a 0x1412CC7A0
          Summary: forza_durango_release_final.exe`CollisionWorld::GetPolys + 112
    

    Under Wine or Proton the game sits elsewhere: the slide is its base minus 0x140000000.

  • WinDbg (untested): .sympath+ C:\path\to\pdb-folder, .exepath+ the game's Mount folder, then .reload /f forza_durango_release_final.exe=0x140000000,0x3A18000.

  • Ghidra (tried with 12.2, headless, through the same PDB analyser the menus use): import the exe, then put the PDB beside it before auto-analysis, or use File > Load PDB File. It creates all 170,286 functions with their names in about 20 seconds. Names show spaces as _, and a few dozen C++/CX vtable warnings are harmless.

  • x64dbg (tried), attached to azimuth.exe with the game running: in the command box, virtualmod forza_durango_release_final.exe, 140000000, 3A18000, then symload forza_durango_release_final.exe, <path to the pdb> (add , 1 if it reports a mismatch). Leave with Debug > Detach; stopping the debugger ends the game.

  • IDA and other disassemblers (untested): load the PDB onto the exe file; its GUID matches.

Where the names come from

At each address the first of these wins:

  1. names.txt: names people have worked out by hand. Add yours here (see below).
  2. The exe's exports and imports: mostly FMOD's API, plus __imp_... for every imported function's slot.
  3. RTTI vtables and records: every class's vtable, as Class::vftable', and RTTI's own records under the names the compiler gives them: ``Class RTTI Type Descriptor', Class::RTTI Complete Object Locator'`` (what the pointer just before a vtable points at), ``Class::RTTI Class Hierarchy Descriptor'andClass::`RTTI Base Class Array'``.
  4. names-reflect.txt: the game has its own reflection system (the RTTI namespace), and about 1,000 classes register their methods and properties with it by name, each with a pointer to its code. derive.py reads those registrations, so these are the developers' own names: Class::Method, and Class::get_Property and Class::set_Property for a property's two accessors, with the property's type in the list as a note. An accessor is often a three-instruction function that reads or writes one field, so it also tells you where that field sits in the object. _xN means N members share one piece of code. Class::`reflection registration' is the function that does the registering.
  5. names-found.txt: names gathered from FH2 mods' source code and research notes by harvest.py. A name only counts at a function's first byte or in a data section, never at a call site inside a function.
  6. names-lib.txt and names-libref.txt: standard library and C runtime functions found by matching their bytes, and what those functions call (see below). Element types in these names are the test code's: std::vector<Elem16> is a vector of some 16-byte type.
  7. names-code.txt: names derive.py works out from what the code does.
    • Constructors, Class::Class: a function that stores vtables into its own object, base classes first, and returns the object. The last vtable it stores at the object's start is its class. A class with several constructors has several functions of that name. Of the 768 constructors the reflection code calls (so their class is known for certain), this finds 767, all with the right class.
    • Deleting destructors, Class::`scalar deleting destructor': the virtual function delete goes through. It calls the destructor, then frees the object if asked to. It's usually slot 0, but not in every class.
    • Destructors, Class::~Class: the function a deleting destructor calls first is that class's destructor. Where only the vtable it stores is known, it's named after that, and only when no other function fits the same class, because a destructor may leave out the store of its own vtable and then looks like its base class's.
    • Thunks: `vcall'{N} jumps to the virtual function at offset N in the vtable; a function named after an import (memcpy) is the jump to that import.
    • Deferred calls: calls into the render and audio threads are queued. The class that carries the arguments is named after the interface and method it will call (CTrackPresentationDeferred::CParams1ITrackPresentationResetObjectPose), and the small function queued with it calls that method through the real object's vtable. That function is CTrackPresentationDeferred::ResetObjectPose`deferred call', and the vtable offset it uses gives the interface's slot for the method (slots-code.txt, used in step 10). The slot is only taken where the queueing class's own method sits in the same slot.
    • The UI library's types: AVUI keeps an AVUI::Type object for each UI class, built at start-up from the class's name. The object is Class::`AVUI type', the function that builds it Class::`AVUI type initializer', and the stub that destroys it at exit Class::`AVUI type atexit destructor'.
    • FMOD Studio's command table: the two functions listed beside each recordable API call's name: FMOD::Studio::System::getBank`command parser' and ...`command function 2'.
  8. "Class::Method" strings the game logs: a function gets the name when it is the only one that uses that string. A few of these (PartyManager::State, ...::RouteType) name an enum the function prints, not the function itself.
  9. Destructors gen.py finds itself: the same shapes as above, for slot 0 only, when names-code.txt is missing.
  10. Shared one-line functions: the linker keeps one copy of identical functions, so every return 0; in the game is a single function that sits in thousands of unrelated vtables. A name taken from one of its uses would be wrong for all the others, so a one-line function found in different slots of different vtables is named after what it does, whatever an earlier source called it: stub_do_nothing (in about 49,000 vtable slots), stub_return_0, stub_return_true, stub_return_arg1, stub_get_qword_at_18 (returns the 8 bytes at +0x18 of its first argument), stub_call_virtual_at_98 (calls the virtual function at offset 0x98 of its first argument's vtable), stub_return_float_0.5. About 215 of them. A second function that does the same thing has its address on the end.
  11. Virtual functions named through their hierarchy: a derived class's vtable starts with its base's slots in the same order, so when slot N has a name in one class, the function in slot N of every related class is its version of the same method. The names come from four places: slots.txt, hand-kept vtable layouts taken from headers (std::function's holder, shared_ptr's control block, C++/CX objects); slots-reflect.txt, the virtual methods the reflection code registers; slots-code.txt, the interface methods the deferred calls go to; and any name above that belongs to a function sitting in a vtable. So one known Update names the Update of every class derived from the same base. A (or B) is one body the linker merged for two slots. Name`adjustor{N}' is the small thunk a second base class's vtable holds, which moves the object pointer back by N and jumps to Name. Where none of those knows a slot, a guess from slots-guess.txt is used and marked (see "Guessed names" below).
  12. Guessed names: names-guess.txt, best guesses for single functions (see "Guessed names" below).
  13. RTTI virtual functions: Class::vfN, named after the most basic class that has the function in slot N. _xN means N vtables share it. vfshared_... means it sits in different slots and is not one of the one-line shapes above, so it has no owner.
  14. Catch blocks and unwind actions: a function with a try block, or with objects to destroy when an exception passes through, has small pieces of code for that ("funclets") which the linker puts far away from it. The C++ exception data lists them for each function, so they are named after it: Function$catch$0, Function$dtor$0, $dtor$1 and so on, numbered by address. About 89,000 of them, and 72,000 had no symbol at all. One the linker merged for several functions has no single owner and reads dtor$<address>_xN or catch$<address>_xN, N being how many functions use it. A "Class::Method" string that only a catch block uses names the function the catch block belongs to.
  15. Everything else: sub_<address>, for each function in .pdata and for each function without unwind data that derive.py saw called, jumped to or pointed at (functions-found.txt, about 10,400 small leaf functions). Without these, an address in an unnamed function would show as the nearest name plus a big, misleading offset.

Of about 417,000 names, some 108,000 are RTTI records, 89,000 are catch blocks and unwind actions, some 79,000 are real names of code and vtables, and about 16,000 are guesses, marked ? (12,000 functions and the catch blocks and chunks named after them); the rest are vfN and sub_ placeholders.

Guessed names

Every name above this point is one the game gives, or one that follows from what the code does. A name that ends in ? is different: it is somebody's best guess from reading the code.

RTTI::Private::CConstructor0<class EntityModel::AICarUpgradeComponent>::Construct?
States::AdvanceIE::Enter?
AVUI::Object::operator new?

A guess is used only where no other source has a name, so a real name always wins. There are two files, and each line says why:

  • slots-guess.txt: what a virtual function slot of a base class is. One line names that slot in every derived class, so about 50 guesses name about 11,700 functions that were Class::vfN. The class in such a name is certain; only the method is the guess. Most are the reflection system's helpers (Construct?, Destroy?, GetValue?, SetValue?, Invoke?, ToString?), the UI library's GetType? and IsType?, and the state machine's Enter?. The UI library follows WPF closely, so WPF's names are used where a slot behaves like WPF's method (MeasureOverride?, CreateInstanceCore?).
  • names-guess.txt: single functions, starting with the ones the rest of the game calls most. Here the class can be a guess too, and two are made up because the exe has no name for them (RTTI::Value, RTTI::TypeHandle); the file says so.
  • gen.py adds one kind itself: a function that only returns a class's AVUI::Type object is Class::GetStaticType? (about 280).

To add one, read the function (and for a slot, two or three classes' versions of it), then add a line with the reason after a ;. To promote a guess you have confirmed, move its line to names.txt or slots.txt. To build a PDB without guesses, rename the two files away. To drop the mark, set GUESS = "" in gen.py.

Pieces split off a function (about 22,500) are named after it: Parent$chunk1, $chunk2 and so on, by address. Most continue the same function's code, split where its unwind state changes.

Every function in .pdata (about 170,000) has its size, so debuggers know where it ends. Small leaf functions without a .pdata entry have a name but no size. An address in the padding after a function still shows as that function, with an offset at or past its size: that's how debuggers pick the nearest symbol.

Add names

Add a line to names.txt: the address minus 0x140000000, then the name.

0x12CC730 CollisionWorld::GetPolys

Then rebuild. Names in names.txt beat every other source, so they also fix a wrong guess.

Rebuild it

python gen.py "C:\path\to\forza_durango_release_final.exe"

It writes out\forza_durango_release_final.pdb in about 40 seconds. It needs Python 3, Windows (for dbghelp.dll) and llvm-pdbutil from LLVM or llvm-mingw, on PATH or named by the LLVM_PDBUTIL environment variable.

To read the names out of the game's code again (after changing derive.py or slots.txt):

python derive.py "C:\path\to\forza_durango_release_final.exe"

That rewrites names-reflect.txt, slots-reflect.txt, slots-code.txt, names-code.txt and functions-found.txt in about half a minute. It needs the capstone disassembler (pip install capstone). To add a vtable layout you know, add lines to slots.txt: the slot number, then Class::Method. A layout you have only worked out by reading the code goes in slots-guess.txt, in the same form.

To gather names from source code and notes on your own disk:

python harvest.py "C:\path\to\forza_durango_release_final.exe" report.txt C:\path\to\your\mods

That rewrites names-found.txt and writes report.txt, listing where each name came from and every address with more than one name. The report holds your file paths, so keep it to yourself.

To keep things out of the shared list, write a harvest-private.txt beside the script (git ignores it): a line dir <folder name> skips every folder of that name, and name <regex> drops any name that matches, such as the name of a mod you haven't released.

Name library code

The game was built with Visual C++ 2012, compiler build 65501, with /O2 /arch:AVX (the guide's chapter 15.6 has the evidence). Code compiled with a compiler of that same build and those flags comes out byte for byte as in the game, apart from the addresses the linker fills in, so library functions can be found by their bytes:

cl /nologo /c /O2 /Gy /GR /EHsc /bigobj /arch:AVX /DNDEBUG stl-corpus.cpp
python libmatch.py "C:\path\to\forza_durango_release_final.exe" stl.txt stl-corpus.obj
python libmatch.py "C:\path\to\forza_durango_release_final.exe" crt.txt msvcrt.lib msvcprt.lib vccorlib.lib
python libnames.py crt.txt stl.txt

libmatch.py takes objects or libraries, masks every relocated field, and names a game function only where a pattern matches whole, at a function's start, in no more than three places. Where a function reads its own object's data (a string, a table), the game's bytes there must match too, which tells apart functions with the same code. A short function with nothing to check (under 40 bytes) counts only between two surer matches from the same object, close together. stl-corpus.cpp instantiates the containers and algorithms the game is likely to use, for element types of common sizes. libnames.py merges the results into names-lib.txt with shorter names. A compiler of any other build gives few or no matches.

Third-party C libraries the game links were built with their own flags. These match:

LibraryVersionFlags
zlib1.2.7/O1 (one function more with /GS-)
SQLite3.6.19/Od, SQLITE_THREADSAFE=0, built for the console (/D_DURANGO /DWINAPI_FAMILY=WINAPI_FAMILY_TV_TITLE /DWIN32_LEAN_AND_MEAN)

Much of a library still doesn't match by its bytes, but the calls give it away. libref.py starts from the matched functions of a C library. A matched function has its relocations in the same places in the game, so what each one points at in the game is the symbol the object names there. From those it follows the calls down: when a named function makes the same number of calls as the object's version, call N in the game is call N in the object. A name found that way is kept only if the two functions are the same size (within a tenth) with the same number of calls, and no other address got the same name.

python libref.py "C:\path\to\forza_durango_release_final.exe" sqlite3.obj deflate.obj trees.obj ...

That writes names-libref.txt: about 560 more SQLite and zlib names. Give it several builds of a library to cover more. It's for C libraries only, where every symbol in the object is the library's own.

How the PDB is made

llvm-pdbutil yaml2pdb writes the names (as public symbols) and the sized functions (as procedures in one module). It leaves out three things debuggers need, which gen.py adds while rewriting the PDB's MSF container:

  • the exe's section headers and a section map, so section:offset pairs become addresses;
  • section contributions that give each code section to that module, or dbghelp ignores the procedures;
  • (in the YAML) an object-name and compiler record at the module's start, and one void() type for every procedure, or lldb ignores the procedures;
  • free-block maps that read 0xFF past the last block, or dbghelp refuses the file.

“The FH2 Modding Guide” by Trinculo54 is licensed under CC BY 4.0; its code samples are under the MIT licence. This page is an unchanged copy (links point to this site) of symbols/README.md at commit bb10508; corrections belong in the original repository.