Open derekbruening opened 9 years ago
From mxm...@gmail.com on May 19, 2014 03:15:03
PART 2
Also, there should be a way to obtain constant type (lmem, gmem and etc) by syscall name. To do that, we can provide additional tables, which are look like (please don't pay attention on names):
typedef flags_list_t { { int flag_sequence_number; /* flag argument # in syscall / int flag_type_id; flags_list_t _flag_list_next; }; typedef syscall_flags_t { { some_hash syscall_hash; flags_list_t list_of_flags; };
flags_global_t flagstable = { { /* LMEM flags / ID; /additional information. We may exclude this one. / {LMEM_FIXED, "LMEM_FIXED"}, {LMEM_MOVEABLE, "LMEMMOVEABLE"} }, { / GMEM table _/ ID; /_additional information */ {GMEM_FIXED, "GMEM_FIXED"} {GMEM_MOVEABLE, "GMEM_MOVEABLE"} }, };
So, we made two structures to decrease memory allocation.
Also, there is a way to search related data in files in drmemory folder but I think, it isn't nice solution.
From bruen...@google.com on May 19, 2014 07:29:47
Since drsyscall is supposed to provide string names for each type for structs, could it provide the name here as well, and the client could look up the integer-to-value-name table from that name (via hashtable)? So for "IN ULONG Protect" in NtAllocateVirtualMemory, drsyscall would say DRSYS_TYPE_UNSIGNEDINT and size 4 and type name "PAGE
From mxm...@gmail.com on May 19, 2014 09:22:58
Yes, I think, this way is better than my previous. We can use hashtable to fast search first entry in the class of values (e.g. "PAGE_NOACCESS").
From mxm...@gmail.com on May 29, 2014 01:23:44
There is a question on ACCESS_MASK and other such types representation. This mask combines several flag types (e.g. DELETE & FILE_READ_DATA). We may fill such cases in drsyscall by using | symbol. (e.g. ,"DELETE|FILE_READ_DATA").
From mxm...@gmail.com on June 06, 2014 01:14:33
There are entries with the same values in the one structure. We should resolve such cases.
From mxm...@gmail.com 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_flagslabel/} typedef struct _gmem_flags {/_global_memory_flagslabel/}
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