Comments (8)
I suppose using
uint32_t
instead ofunsigned long
anduint16_t
instead ofunsigned short
makes it closer (on Linux) to what's intended. But I wonder if all the types in PDB_Types.h are layout-sensitive.
Yes, that definitely should be changed, both for the IMAGE_SECTION_HEADER and GUID declarations. Those were taken verbatim from the corresponding headers, but should be replaced with declarations using types from cstdint.
Other type declarations should be fine, since they're all defined in terms of cstdint types.
I can add static_asserts though to make sure.
from raw_pdb.
from raw_pdb.
Someone on reddit gave it a try and needed a few changes (though I don't know which)
That was me.
I tried again and needed a few tweaks. Mostly I hacked around things, so I doubt you'd want my patch verbatim. Also, it would be simpler perhaps to use clang, some of the changes are just to handle GCC.
You'd have to replace the _BitScanForward intrinsic
You can replace it withffsl
on Linux.
The library does not pull in any Windows-specific header.
Actually I think<intrin.h>
is Windows-specific. I guess it's related to the bit scan thing.
Also there's this:
// this matches the definition in guiddef.h, but we don't want to pull that in
struct GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
};
static_assert(sizeof(GUID) == 16u, "Size mismatch.");
This causes an assert on Linux:
PDB_Types.h:26:36: error: static assertion failed: Size mismatch.
26 | static_assert(sizeof(GUID) == 16u, "Size mismatch.");
| ~~~~~~~~~~~~~^~~~~~
There's another assert as well:
from raw_pdb.
Dang it, hit enter too soon.
PDB_Types.h:47:52: error: static assertion failed: Size mismatch.
47 | static_assert(sizeof(IMAGE_SECTION_HEADER) == 40u, "Size mismatch.");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
In particular the GUID
type comes out as:
(gdb) ptype/o GUID
/* offset | size */ type = struct GUID {
/* 0 | 8 */ unsigned long Data1;
/* 8 | 2 */ unsigned short Data2;
/* 10 | 2 */ unsigned short Data3;
/* 12 | 8 */ unsigned char Data4[8];
/* XXX 4-byte padding */
/* total size (bytes): 24 */
}
from raw_pdb.
I suppose using uint32_t
instead of unsigned long
and uint16_t
instead of unsigned short
makes it closer (on Linux) to what's intended. But I wonder if all the types in PDB_Types.h are layout-sensitive.
from raw_pdb.
Worth noting that if this is mapping directly from the file, then for a full port to Linux it will have to byte-swap the data for big-endian hosts. With newer versions of gcc you can use the scalar_storage_order
attribute to do this without extra source, though there are some limitations.
from raw_pdb.
Thank you everybody for the pointers. We got it to compile and a simple test program executed. Should we end up pursuing this seriously (and thus, verify it is actually solid), we will provide a PR
from raw_pdb.
Linux support has been added in f1781c2.
from raw_pdb.
Related Issues (20)
- Crash when trying to read symbols from `LLVMCodeGen.pdb` HOT 3
- Can't build HOT 3
- How to get type size HOT 1
- Rewrite PDBs? HOT 11
- Examples fail to compile on Ubuntu 22.04.2 HOT 2
- Unhandled TypeRecordKind 0x1609 HOT 11
- Default MSFStream Type - CoalescedMSFStream vs DirectMSFStream HOT 2
- Unhandled TypeRecordKind 0x110B HOT 3
- ExampleFunctionSymbols trampling HOT 2
- Unhandled record kind 0x1179 HOT 6
- ExampleTypes assert in DisplayFields() HOT 4
- Qt6WebEngineCore.pdb error HOT 18
- Why are so many rva the same, but the functions are different
- jpeg62.pdb bug HOT 2
- Microsoft.VisualStudio.Coverage.Monitor.pdb bug HOT 9
- I am not sure I understand the validity of PDB_NO_ALIAS HOT 2
- Can a pdb file be modified? HOT 2
- wrong offset HOT 6
- Unhandled record kind 0x117C with block level 1 HOT 1
- When the C++20 standard is selected for compilation, a warning appears HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raw_pdb.