void sys_string_acquire(sys_strings_t *strings, int index, const char *name, int max_len) { sys_string_t *str = strings->strings + index; if (index < 0 || index >= SYS_STRINGS_MAX) { fprintf(stderr, "[SYSSTR] Error: Attempt to acquire string #%d\n", index); BREAKPOINT(); } if (str->name && (strcmp(name, str->name) || (str->max_size != max_len))) { fprintf(stderr, "[SYSSTR] Error: Attempt to re-acquire existing string #%d;" "was '%s', tried to claim as '%s'\n", index, str->name, name); BREAKPOINT(); } str->name = strdup(name); str->max_size = max_len; str->value = (char*)sci_malloc(max_len + 1); str->value[0] = 0; /* Set to empty string */ }
void UniformBuffer::Create( const GLSLShaderProgram* shaderProgram, const GLchar* const uniformBufferName, const GLchar** const uniformSubNames, const GLshort numUniforms) { m_numUniforms = numUniforms; glGetActiveUniformBlockiv( shaderProgram->GetID(), shaderProgram->GetUniformBlockIndex(uniformBufferName), GL_UNIFORM_BLOCK_DATA_SIZE, &m_sizeInBytes); if(m_sizeInBytes == 0) BREAKPOINT(UniformBuffer Create UniformBuffer has no size); m_buffer = new GLubyte[m_sizeInBytes]; // get offsets per uniform GLuint* indices = new GLuint[m_numUniforms]; glGetUniformIndices( shaderProgram->GetID(), m_numUniforms, uniformSubNames, indices); // validate the indices for( GLuint i = 0; i < m_numUniforms; ++i) { if(indices[i] == GLuint(0 - 1)) BREAKPOINT(UniformBuffer Create not all the uniforms are used in the shader and thus excist); } m_offsets = new GLint[m_numUniforms]; glGetActiveUniformsiv( shaderProgram->GetID(), m_numUniforms, indices, GL_UNIFORM_OFFSET, m_offsets); delete indices; glGenBuffers( 1, &m_handle); }
UniformBuffer::~UniformBuffer( void) { if(m_handle != 0) BREAKPOINT(Uniform buffer was not yet destroyed); if(m_buffer != NULL) BREAKPOINT(Uniform buffer was not yet destroyed); if(m_offsets != NULL) BREAKPOINT(Uniform buffer was not yet destroyed); }
void kmain(s64 magic, s64 info) { //vga_clear(COLOR_BLACK); idt_init(); isr_init(); serial_init(); set_debug_traps(); BREAKPOINT(); cpuid_print(); multiboot(magic, info); kmem_map(); page_init(); kmalloc_init(); //vesa_init(); root_init(); pci_init(); vm_init(); syscall_init(); timer_init(); kbd_init(); //mouse_init(); console_init(); create_kthread(NULL, idle_thread, THREAD_PRI_LOW, NULL, NULL); create_kthread(NULL, init_thread, THREAD_PRI_NORMAL, NULL, NULL); thread_schedule(); }
void GLContextWin32::Destroy( void) { // delete context if( !wglDeleteContext(m_glContextHandle)) BREAKPOINT(GLContext could not be deleted properly); m_glContextHandle = NULL; }
static int check_crtc (qxl_screen_t *qxl) { int i, count = 0; xf86CrtcPtr crtc; if (qxl->crtcs == NULL) { return 0; } for (i = 0 ; i < qxl->num_heads; ++i) { crtc = qxl->crtcs[i]; if (!crtc->enabled || crtc->mode.CrtcHDisplay == 0 || crtc->mode.CrtcVDisplay == 0) { continue; } count++; } #if 0 if (count == 0) { ErrorF ("check crtc failed, count == 0!!\n"); BREAKPOINT (); } #endif return count; }
int check_node(btree_node *node, uint64_t min, uint64_t max){ if(node->n_keys < min_keys){ HERE_FMT_ONCE("Too few keys in a node\n"); BREAKPOINT(); return -1; } if(node->n_keys > max_keys){ HERE_FMT_ONCE("Too many keys in a node\n"); BREAKPOINT(); return -1; } if(is_leaf(node)){ return check_leaf(node, min, max); } else { return check_internal(node, min, max); } }
void breakpoint (void) { if (initialized) { BREAKPOINT (); } waitabit (); }
void UniformBuffer::Destroy( void) { if(m_handle == 0) BREAKPOINT(Uniform buffer was already destroyed before or does not yet excist); if(m_buffer == NULL) BREAKPOINT(Uniform buffer was already destroyed before or does not yet excist); if(m_offsets == NULL) BREAKPOINT(Uniform buffer was already destroyed before or does not yet excist); glDeleteBuffers( 1, &m_handle); m_handle = 0; delete m_buffer; m_buffer = NULL; delete m_offsets; m_offsets = NULL; }
void UniformBuffer::SetUniform( const GLuint index, const GLvoid* data, const GLuint dataSizeInBytes) { if( m_handle == 0 || m_buffer == NULL) BREAKPOINT( UniformBuffer is not yet created!); if( index >= m_numUniforms) BREAKPOINT( UniformBuffer SetUniform index is bigger then ammount of uniforms); const GLuint endOfMemWrite = m_offsets[index] + dataSizeInBytes; GLuint endOfBufferSegment = m_sizeInBytes; if(GLint(m_numUniforms) - 1 - GLint(index) > 0) endOfBufferSegment = m_offsets[index + 1]; if(endOfMemWrite > endOfBufferSegment) BREAKPOINT(UniformBuffer SetUniform memcpy overflow); memcpy( m_buffer + m_offsets[index], data, dataSizeInBytes); }
int check_leaf(btree_node *node, uint64_t min, uint64_t max){ int i; if(node->n_keys > max_keys || node->n_keys < min_keys){ HERE_FMT("Invalid number of keys %ld in leaf node\n",node->n_keys); return -1; } for(i=0;i<node->n_keys;i++){ if(node->keys[i] < min){ HERE_FMT_ONCE("key %d = %lu < min = %lu\n", i, node->keys[i], min); BREAKPOINT(); return -1; } if(node->keys[i] > max){ HERE_FMT_ONCE("key %d = %lu > max = %lu\n", i, node->keys[i], max); BREAKPOINT(); return -1; } min = node->keys[i]; } return 0; }
INTN DbgAssert ( IN CHAR8 *FileName, IN INTN LineNo, IN CHAR8 *Description ) { DbgPrint (D_ERROR, (CHAR8 *)"%EASSERT FAILED: %a(%d): %a%N\n", FileName, LineNo, Description); BREAKPOINT(); return 0; }
/* Breakpoint if there's a break sent on the serial port */ static void kgdb_break_interrupt(int irq, void *ptr, struct pt_regs *regs) { struct sci_port *port = ptr; unsigned short status = sci_in(port, SCxSR); if (status & SCxSR_BRK(port)) { /* Break into the debugger if a break is detected */ BREAKPOINT(); /* Clear */ sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port)); } }
static irqreturn_t sci_br_interrupt(int irq, void *ptr) { struct uart_port *port = ptr; /* Handle BREAKs */ sci_handle_breaks(port); #ifdef CONFIG_SH_KGDB /* Break into the debugger if a break is detected */ BREAKPOINT(); #endif sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port)); return IRQ_HANDLED; }
int sys_string_set(sys_strings_t *strings, int index, const char *value) { sys_string_t *str = strings->strings + index; if (index < 0 || index >= SYS_STRINGS_MAX || !str->name) { fprintf(stderr, "[SYSSTR] Error: Attempt to write to invalid/unused string #%d\n", index); BREAKPOINT(); return 1; } strncpy(str->value, value, str->max_size); str->value[str->max_size] = 0; /* Make sure to terminate */ return 0; }
/* This function will generate a breakpoint exception. It is used at the beginning of a program to sync up with a debugger and can be used otherwise as a quick means to stop program execution and "break" into the debugger. */ void breakpoint() { if (initialized){ BREAKPOINT(); } else{ uint32_t f; /* dump stack */ f = bsp_fsave(); while(1); bsp_frestore(f); } // waitabit(); }
void Texture2D::UpdateSubRegion( const unsigned int xOffset, const unsigned int yOffset, const unsigned int width, const unsigned int height, const char* const data) { #ifdef DEBUG if( m_hasMipMaps ) printf("Update can be done but mipmaps stay uneffected\n"); #endif if( !m_isOnGPU) BREAKPOINT(Texture is not on GPU); // select internal format GLenum type = GL_UNSIGNED_BYTE; GLint internalFormat = 0; switch(m_componentSizeInBytes) { case 1: // unsigned char buffer internalFormat = m_numComponents == 4 ? GL_RGBA8 : GL_RGB8; internalFormat = m_numComponents == 1 ? GL_R8 : internalFormat; type = GL_UNSIGNED_BYTE; break; case 2: // half float point buffer internalFormat = m_numComponents == 4 ? GL_RGBA16F : GL_RGB16F; internalFormat = m_numComponents == 1 ? GL_R16F : internalFormat; type = GL_FLOAT; break; case 4: // floating point buffer internalFormat = m_numComponents == 4 ? GL_RGBA32F : GL_RGB32F; internalFormat = m_numComponents == 1 ? GL_R32F : internalFormat; type = GL_FLOAT; break; } // select format from RGBA, RGB or RED GLenum format = m_numComponents == 4 ? GL_RGBA : GL_RGB; format = m_numComponents == 1 ? GL_RED : m_numComponents; Bind(); glTexSubImage2D(GL_TEXTURE_2D, 0, (GLint)xOffset, (GLint)yOffset, (GLsizei)width, (GLsizei)height, format, type, (GLvoid*)data ); UnBind(); }
void TestManager::testFailed(const Test* test) { auto t = std::find_if( m_tests.begin(), m_tests.end(), [test](const TestEntry& entry) { return entry.m_test == test; } ); CORE_ASSERT(t != m_tests.cend(), "Failing test not registred."); ++(t->m_fails); // The program will break here if you enabled the "break on failure" option. if (m_options.m_breakOnFailure) { BREAKPOINT(0); } }
int check_internal(btree_node *node, uint64_t min, uint64_t max){ int i; int leaf_status = is_leaf(node->children[0]); uint64_t true_max = max; max = node->keys[0]; for(i=0;i<node->n_keys+1;i++){ WARN_ON_ONCE(min > max); if(max > true_max){ HERE(); BREAKPOINT(); } if(leaf_status != is_leaf(node->children[i])){ HERE_FMT("All leaves are not the same depth"); return -1; } int err = check_node(node->children[i], min, max); if(err){ return err; } min = max; max = (i+1 == node->n_keys ? true_max : node->keys[i+1]); } return 0; }
void breakpoint () { if (initialized) BREAKPOINT (); }
static void AUXBUF_FILL_HELPER(gfxr_pic_t *pic, int old_xl, int old_xr, int y, int dy, int clipmask, int control, int sci_titlebar_size) { int xl, xr; int oldytotal = y * 320; #ifdef DRAW_SCALED unsigned const char fillmask = CLIPMASK_HARD_BOUND | 0x78; #else unsigned const char fillmask = CLIPMASK_HARD_BOUND | 0x84; #endif do { int ytotal = oldytotal + (320 * dy); int xcont; int state; y += dy; if (y < sci_titlebar_size || y > 199) return; xl = old_xl; if (!(pic->aux_map[ytotal + xl] & clipmask)) { /* go left */ while (xl && !(pic->aux_map[ytotal + xl - 1] & clipmask)) --xl; } else /* go right and look for the first valid spot */ while ((xl <= old_xr) && (pic->aux_map[ytotal + xl] & clipmask)) ++xl; if (xl > old_xr) /* No fillable strip above the last one */ return; if ((ytotal + xl) < 0) { fprintf(stderr,"AARGH-%d\n", __LINE__); BREAKPOINT(); } xr = xl; while (xr < 320 && !(pic->aux_map[ytotal + xr] & clipmask)) { pic->aux_map[ytotal + xr] |= fillmask; ++xr; } if ((ytotal + xr) > 64000) { fprintf(stderr,"AARGH-%d\n", __LINE__); BREAKPOINT(); } --xr; if (xr < xl) return; /* Check whether we need to recurse on branches in the same direction */ if ((y > sci_titlebar_size && dy < 0) || (y < 199 && dy > 0)) { state = 0; xcont = xr + 1; while (xcont <= old_xr) { if (pic->aux_map[ytotal + xcont] & clipmask) state = 0; else if (!state) { /* recurse */ state = 1; AUXBUF_FILL_HELPER(pic, xcont, old_xr, y - dy, dy, clipmask, control, sci_titlebar_size); } ++xcont; } } /* Check whether we need to recurse on backward branches: */ /* left */ if (xl < old_xl - 1) { state = 0; for (xcont = old_xl - 1; xcont >= xl; xcont--) { if (pic->aux_map[oldytotal + xcont] & clipmask) state = xcont; else if (state) { /* recurse */ AUXBUF_FILL_HELPER(pic, xcont, state, y, -dy, clipmask, control, sci_titlebar_size); state = 0; } } } /* right */ if (xr > old_xr + 1) { state = 0; for (xcont = old_xr + 1; xcont <= xr; xcont++) { if (pic->aux_map[oldytotal + xcont] & clipmask) state = xcont; else if (state) { /* recurse */ AUXBUF_FILL_HELPER(pic, state, xcont, y, -dy, clipmask, control, sci_titlebar_size); state = 0; } } } if ((ytotal + xl) < 0) { fprintf(stderr,"AARGH-%d\n", __LINE__); BREAKPOINT() } if ((ytotal + xr+1) > 64000) { fprintf(stderr,"AARGH-%d\n", __LINE__); BREAKPOINT(); } if (control) memset(pic->control_map->index_data + ytotal + xl, control, xr-xl+1); oldytotal = ytotal; old_xr = xr; old_xl = xl; } while (1);