MCPcopy Create free account
hub / github.com/GJDuck/e9patch / sendArgumentDataMetadata

Function sendArgumentDataMetadata

src/e9tool/e9metadata.cpp:2030–2124  ·  view source on GitHub ↗

* Send argument data metadata. */

Source from the content-addressed store, hash-verified

2028 * Send argument data metadata.
2029 */
2030static void sendArgumentDataMetadata(FILE *out, const char *name,
2031 const ELF *elf, const Argument &arg, size_t i, const InstrInfo *I,
2032 int regno)
2033{
2034 switch (arg.kind)
2035 {
2036 case ARGUMENT_CSV:
2037 {
2038 MatchVal val = getCSVValue(I->address, arg.name, arg.value);
2039 if (val.type == MATCH_TYPE_STRING)
2040 {
2041 fprintf(out, "\".Lstr%d@%s\",{\"string\":", regno, name);
2042 sendString(out, val.str);
2043 fputs("},", out);
2044 }
2045 break;
2046 }
2047 case ARGUMENT_STRING:
2048 fprintf(out, "\".Lstr%d@%s\",{\"string\":", regno, name);
2049 sendString(out, arg.name);
2050 fputs("},", out);
2051 break;
2052 case ARGUMENT_ASM:
2053 if (arg.duplicate)
2054 return;
2055 fprintf(out, "\".Lasm@%s\",", name);
2056 sendAsmStrData(out, I, /*newline=*/false);
2057 putc(',', out);
2058 break;
2059 case ARGUMENT_BYTES:
2060 if (arg.duplicate)
2061 return;
2062 fprintf(out, "\".Lbytes@%s\",", name);
2063 sendBytesData(out, I->data, I->size);
2064 fputc(',', out);
2065 break;
2066 case ARGUMENT_OP: case ARGUMENT_SRC: case ARGUMENT_DST:
2067 case ARGUMENT_IMM: case ARGUMENT_REG: case ARGUMENT_MEM:
2068 {
2069 if (!arg.ptr)
2070 return;
2071 Access access = (arg.kind == ARGUMENT_SRC? ACCESS_READ:
2072 (arg.kind == ARGUMENT_DST? ACCESS_WRITE: 0));
2073 OpType type = (arg.kind == ARGUMENT_IMM? OPTYPE_IMM:
2074 (arg.kind == ARGUMENT_REG? OPTYPE_REG:
2075 (arg.kind == ARGUMENT_MEM? OPTYPE_MEM:
2076 OPTYPE_INVALID)));
2077 const OpInfo *op = getOperand(I, (int)arg.value, type, access);
2078 sendOperandDataMetadata(out, name, I, op, regno);
2079 break;
2080 }
2081 case ARGUMENT_F:
2082 {
2083 if (arg.field != FIELD_NAME || arg.duplicate)
2084 return;
2085 const F *f = findF(elf->fs, i);
2086 if (f == nullptr || f->name == nullptr)
2087 return;

Callers 1

sendCallMetadataMethod · 0.85

Calls 13

getCSVValueFunction · 0.85
fputsFunction · 0.85
sendAsmStrDataFunction · 0.85
putcFunction · 0.85
sendBytesDataFunction · 0.85
fputcFunction · 0.85
getOperandFunction · 0.85
sendOperandDataMetadataFunction · 0.85
getAbsnameFunction · 0.85
getBasenameFunction · 0.85
getDirnameFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected