static int firestep_writeCore(const char *buf, size_t bufsize) { char message[WRITEBUFMAX+4]; if (bufsize > WRITEBUFMAX) { memcpy(message, buf, WRITEBUFMAX); message[WRITEBUFMAX] = '.'; message[WRITEBUFMAX+1] = '.'; message[WRITEBUFMAX+2] = '.'; message[WRITEBUFMAX+3] = 0; } else { memcpy(message, buf, bufsize); message[bufsize] = 0; } char *s; for (s = message; *s; s++) { switch (*s) { case '\n': case '\r': *s = ' '; break; } } LOGDEBUG1("firestep_write %s start", message); ssize_t rc = write(fdwTinyG, buf, bufsize); if (rc == bufsize) { LOGINFO2("firestep_write %s (%ldB)", message, bufsize); } else { LOGERROR2("firestep_write %s -> [%ld]", message, rc); } return rc < 0 ? rc : 0; }
int firefuse_write(const char *path, const char *buf, size_t bufsize, off_t offset, struct fuse_file_info *fi) { LOGTRACE1("firefuse_write(%s)", path); if (!buf) { LOGERROR1("firefuse_write %s -> null buffer", path); return EINVAL; } if (is_cv_path(path)) { return cve_write(path, buf, bufsize, offset, fi); } if (offset) { LOGERROR2("firefuse_write %s -> non-zero offset:%ld", path, (long) offset); return EINVAL; } if (is_cnc_path(path)) { return cnc_write(path, buf, bufsize, offset, fi); } if (strcmp(path, ECHO_PATH) == 0) { if (bufsize > MAX_ECHO) { sprintf(echoBuf, "firefuse_write %s -> string too long (%ld > %d bytes)", path, bufsize, MAX_ECHO); LOGERROR1("%s", echoBuf); return EINVAL; } memcpy(echoBuf, buf, bufsize); echoBuf[bufsize] = 0; LOGINFO2("firefuse_write %s -> %s", path, echoBuf); } else if (strcmp(path, FIRELOG_PATH) == 0) { switch (buf[0]) { case 'E': case 'e': case '0': firelog_level(FIRELOG_ERROR); break; case 'W': case 'w': case '1': firelog_level(FIRELOG_WARN); break; case 'I': case 'i': case '2': firelog_level(FIRELOG_INFO); break; case 'D': case 'd': case '3': firelog_level(FIRELOG_DEBUG); break; case 'T': case 't': case '4': firelog_level(FIRELOG_TRACE); break; } } else if (strcmp(path, FIRESTEP_PATH) == 0) { firestep_write(buf, bufsize); } return bufsize; }
STDMETHODIMP CorProfiler::ModuleAttachedToAssembly(ModuleID module, AssemblyID assembly) { String moduleName = CorHelper::GetModuleName(m_profilerInfo, module); String assemblyName = CorHelper::GetAssemblyName(m_profilerInfo, assembly); LOGINFO4(PROFILER_CALL_METHOD, "Module %X (%s) attached to assembly %X (%s)", module, moduleName.length() == 0 ? _T("noname") : moduleName.c_str(), assembly, assemblyName.length() == 0 ? _T("noname") : assemblyName.c_str()); if (!m_instrumentator.IsAssemblyAcceptable(assemblyName)) { LOGINFO2(SKIP_BY_RULES, " module '%s' was skipped, because no include rule was specified for this assembly '%s'", moduleName.length() == 0 ? _T("noname") : moduleName.c_str(), assemblyName.length() == 0 ? _T("noname") : assemblyName.c_str()); return S_OK; } m_instrumentator.InstrumentModule(module, moduleName.c_str(), m_profilerInfo, m_binder); return S_OK; }
static int firestep_readchar(int c) { switch (c) { case EOF: inbuf[inbuflen] = 0; inbuflen = 0; LOGERROR1("firestep_readchar %s[EOF]", inbuf); return 0; case '\n': inbuf[inbuflen] = 0; if (inbuflen) { // discard blank lines if (strncmp("{\"sr\"",inbuf, 5) == 0) { LOGDEBUG2("firestep_readchar %s (%dB)", inbuf, inbuflen); } else { LOGINFO2("firestep_readchar %s (%dB)", inbuf, inbuflen); } } else { inbufEmptyLine++; if (inbufEmptyLine % 1000 == 0) { LOGWARN1("firestep_readchar skipped %ld blank lines", inbufEmptyLine); } } inbuflen = 0; break; case '\r': // skip break; case 'a': case 'A': case 'b': case 'B': case 'c': case 'C': case 'd': case 'D': case 'e': case 'E': case 'f': case 'F': case 'g': case 'G': case 'h': case 'H': case 'i': case 'I': case 'j': case 'J': case 'k': case 'K': case 'l': case 'L': case 'm': case 'M': case 'n': case 'N': case 'o': case 'O': case 'p': case 'P': case 'q': case 'Q': case 'r': case 'R': case 's': case 'S': case 't': case 'T': case 'u': case 'U': case 'v': case 'V': case 'w': case 'W': case 'x': case 'X': case 'y': case 'Y': case 'z': case 'Z': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': case '-': case '_': case '/': case '{': case '}': case '(': case ')': case '[': case ']': case '<': case '>': case '"': case '\'': case ':': case ',': case ' ': case '\t': if (c == '{') { if (jsonDepth++ <= 0) { jsonLen = 0; } ADD_JSON(c); } else if (c == '}') { ADD_JSON(c); if (--jsonDepth < 0) { LOGWARN1("Invalid JSON %s", jsonBuf); return 0; } } else { ADD_JSON(c); } if (inbuflen >= INBUFMAX) { inbuf[INBUFMAX] = 0; LOGERROR1("firestep_readchar overflow %s", inbuf); break; } else { inbuf[inbuflen] = c; inbuflen++; LOGTRACE2("firestep_readchar %x %c", (int) c, (int) c); } break; default: // discard unexpected character (probably wrong baud rate) LOGTRACE2("firestep_readchar %x ?", (int) c, (int) c); break; } return 1; }
STDMETHODIMP CorProfiler::ModuleUnloadStarted( ModuleID moduleId) { String moduleName = CorHelper::GetModuleName(m_profilerInfo, moduleId); LOGINFO2(PROFILER_CALL_METHOD, "Module %X unloaded (%s)", moduleId, moduleName.length() == 0 ? _T("noname") : moduleName.c_str()); m_instrumentator.UnloadModule(moduleId); return S_OK; }
STDMETHODIMP CorProfiler::ModuleLoadFinished(ModuleID moduleId, HRESULT hrStatus) { String moduleName = CorHelper::GetModuleName(m_profilerInfo, moduleId); LOGINFO2(PROFILER_CALL_METHOD, "Module %X loaded (%s)", moduleId, moduleName.length() == 0 ? _T("noname") : moduleName.c_str()); return S_OK; }
STDMETHODIMP CorProfiler::ClassUnloadStarted(ClassID classId) { String className = CorHelper::GetClassName(m_profilerInfo, classId); LOGINFO2(PROFILER_CALL_METHOD, "Class %X unloaded (%s)", classId, className.length() == 0 ? _T("noname") : className.c_str()); return S_OK; }
STDMETHODIMP CorProfiler::ClassLoadFinished(ClassID classId, HRESULT hrStatus) { String className = CorHelper::GetClassName(m_profilerInfo, classId); LOGINFO2(PROFILER_CALL_METHOD, "Class %X loaded (%s)", classId, className.length() == 0 ? _T("noname") : className.c_str()); m_instrumentator.UpdateClassCode(classId, m_profilerInfo, m_binder); return S_OK; }
STDMETHODIMP CorProfiler::AssemblyUnloadStarted(AssemblyID assemblyId) { String asmName = CorHelper::GetAssemblyName(m_profilerInfo, assemblyId); LOGINFO2(PROFILER_CALL_METHOD, "Assembly %X unloaded (%s)", assemblyId, asmName.length() == 0 ? _T("noname") : asmName.c_str()); return S_OK; }