tools/dwarfDbg/dwarfDbgTypeInfo.c
/* we add the tag field and the attr infos to a binary string and make a base64 key out of it */
we add the tag field and the attr infos to a binary string and make a base64 key out of it
we add the tag field and the attr infos to a binary string and make a base64 key out of it
static uint8_t genAttrTypeInfoKey(dwarfDbgPtr_t self, dwAttrTypeInfo_t *dwAttrTypeInfo, char **attrTypeInfoKey) {
  uint8_t result;
  char buf[1024];
  char buf2[50];
  int attrIdx = 0;
  dwAttrType_t *dwAttrType = NULL;
  result = DWARF_DBG_ERR_OK;
  buf[0] = '\0';
  sprintf(buf2, "%04x,", dwAttrTypeInfo->tag);
  strcat(buf, buf2);
  for (attrIdx = 0; attrIdx < dwAttrTypeInfo->numDwAttrType; attrIdx++) {
    dwAttrType = &dwAttrTypeInfo->dwAttrTypes[attrIdx];
    sprintf(buf2, "%04x,%08x,%08x.", dwAttrType->dwType, dwAttrType->value, dwAttrType->refOffset);
    if (strlen(buf) + strlen(buf2) > 1020) {
printf("ERROR buf for key to small\n");
      return DWARF_DBG_ERR_KEY_BUF_TOO_SMALL;
    }
    strcat(buf, buf2);
  }
  *attrTypeInfoKey = strdup(buf);
  return result;
}
static uint8_t genAttrTypeInfoKey ( dwarfDbgPtr_t self , dwAttrTypeInfo_t * dwAttrTypeInfo , char * * attrTypeInfoKey ) { uint8_t result ; char buf [ 1024 ] ; char buf2 [ 50 ] ; int attrIdx = 0 ; dwAttrType_t * dwAttrType = NULL ; result = DWARF_DBG_ERR_OK ; buf [ 0 ] = ' \0 ' ; sprintf ( buf2 , " " , dwAttrTypeInfo -> tag ) ; strcat ( buf , buf2 ) ; for ( attrIdx = 0 ; attrIdx < dwAttrTypeInfo -> numDwAttrType ; attrIdx ++ ) { dwAttrType = & dwAttrTypeInfo -> dwAttrTypes [ attrIdx ] ; sprintf ( buf2 , " " , dwAttrType -> dwType , dwAttrType -> value , dwAttrType -> refOffset ) ; if ( strlen ( buf ) + strlen ( buf2 ) > 1020 ) { printf ( " \n " ) ; return DWARF_DBG_ERR_KEY_BUF_TOO_SMALL ; } strcat ( buf , buf2 ) ; } * attrTypeInfoKey = strdup ( buf ) ; return result ; }
we add the tag field and the attr infos to a binary string and make a base64 key out of it
we add the tag field and the attr infos to a binary string and make a base64 key out of it