DynamoRIO / DynamoRIO/drmemory
Named constants support in drstrace.
- Dominant language
- C
- Stars
- 2.7k
- Forks
- 290
- PR merge metrics
- No merged PRs in 30d
Description
_From [mxm...@gmail.com](https://code.google.com/u/101248221827060668005/) on May 16, 2014 09:39:30_
The question is: How can we add named constants in drstrace? xref issue #1540
If we’re going Linux strace way, we should split all constants by their purpose, like:
typedef struct _lmem_flags {
{LMEM_FIXED, “LMEM_FIXED”}
{LMEM_MOVEABLE, “LMEM_MOVEABLE”}
{LMEM_NOCOMPACT, “LMEM_MOVEABLE”}
{LMEM_NOCOMPACT, “LMEM_NOCOMPACT”}
{LMEM_NODISCARD, “LMEM_NODISCARD”}
{LMEM_ZEROINT, “LMEM_NODISCARD”}
{LMEM_MODIFY, “LMEM_MODIFY”}
........
}
typedef struct _gmem_flags {
{GMEM_FIXED , “GMEM_FIXED”}
{GMEM_MOVEABLE , “GMEM_MOVEABLE”}
.....
}
There are a lot of different constants in Windows (much more than in Linux). So, I think, there should be some automatization. Let’s look next scheme:
typedef struct _lmem_flags {/_local_memory_flags_label_/}
typedef struct _gmem_flags {/_global_memory_flags_label_/}
At the compilation step, cmake starts the special script to fill in all these structures using our labels. Of course, there is still much manual work here (need prepare these labels), but this way allows us avoid manual checking when something changed in Windows headers and etc.
I’m not very good in source code autogeneration techniques but I think, it should work.
_Original issue: http://code.google.com/p/drmemory/issues/detail?id=1550_
Contributor guide
Assessment
This issue has not been assessed yet.