本文整理匯總了C++中BLOCK_START函數的典型用法代碼示例。如果您正苦於以下問題:C++ BLOCK_START函數的具體用法?C++ BLOCK_START怎麽用?C++ BLOCK_START使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BLOCK_START函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: mm_is_handle
/*
* Determina si el objeto dado representa un handle
* que apunta al interior de alguno de los bloques
* administrados por el memory manager:
*
* - El OBJ_FLAG_HANDLE debe estar en 1.
* - El puntero debe estar dentro de alguno de los
* bloques (busqueda binaria).
* - El objeto apuntado debe ser el primero de la
* estructura. (En el esquema de manejo de memoria
* elegido no se permiten punteros "internos" a
* la mitad de una estructura).
*
* Pre: el arreglo de bloques de mm debe estar ordenado
* por BLOCK_START de menor a mayor.
*/
int mm_is_handle(MM *mm, Obj obj) {
Block **blocks = mm->blocks;
if (!(obj & OBJ_FLAG_HANDLE)) {
/* not a handle */
return 0;
}
if (BLOCK_START(0) > obj) {
return 0;
}
uint64 index_left = 0;
uint64 index_right = mm->nblocks;
while (index_right - index_left > 1) {
uint64 mid = index_left + (index_right - index_left) / 2;
if (BLOCK_START(mid) <= obj) {
index_left = mid;
} else {
index_right = mid;
}
}
return BLOCK_START(index_left) <= obj
&& obj < BLOCK_START(index_left) + BLOCK_SIZE_IN_BYTES(index_left)
&& !(*OBJ_HANDLE_TO_PTR(obj) & OBJ_FLAG_CONTINUE);
}
示例2: mm_sort_blocks
void mm_sort_blocks(Block **blocks, int begin, int end) {
if (begin + 1 >= end) {
return;
}
uint64 pivot_index = random() % (end - begin) + begin;
uint64 pivot_value = BLOCK_START(pivot_index);
uint64 index_left = begin;
uint64 index_right = end;
while (index_left < index_right) {
if (BLOCK_START(index_left) <= pivot_value) {
index_left++;
} else {
Block *tmp = blocks[index_left];
blocks[index_left] = blocks[index_right - 1];
blocks[index_right - 1] = tmp;
index_right--;
}
}
mm_sort_blocks(blocks, begin, index_left);
mm_sort_blocks(blocks, index_left, end);
}
示例3: contained_in
int
contained_in (const struct block *a, const struct block *b)
{
if (!a || !b)
return 0;
return BLOCK_START (a) >= BLOCK_START (b)
&& BLOCK_END (a) <= BLOCK_END (b);
}
示例4: BLOCK_START
void ConnectionDialog::safeDraw(Graphics *const graphics)
{
BLOCK_START("ConnectionDialog::draw")
// Don't draw the window background, only draw the children
safeDrawChildren(graphics);
BLOCK_END("ConnectionDialog::draw")
}
示例5: block_starts_and_ends
/* Return a 1 if any of the address ranges for block BL begins with START
and any of the address ranges for BL ends with END; return a 0 otherwise. */
int
block_starts_and_ends (struct block *bl, CORE_ADDR start, CORE_ADDR end)
{
int retval;
int start_found = 0;
int end_found = 0;
if (!BLOCK_RANGES (bl))
retval = BLOCK_START (bl) == start && BLOCK_END (bl) == end;
else
{
int i;
for (i = 0;
i < BLOCK_RANGES (bl)->nelts && !start_found && !end_found;
i++)
{
if (BLOCK_RANGE_START (bl, i) == start)
start_found = 1;
if (BLOCK_RANGE_END (bl, i) == end)
end_found = 1;
}
retval = start_found && end_found;
}
return retval;
}
示例6: BLOCK_START
void GeneralHandler::flushNetwork()
{
if (!mNetwork)
return;
BLOCK_START("GeneralHandler::flushNetwork 1")
mNetwork->flush();
BLOCK_END("GeneralHandler::flushNetwork 1")
mNetwork->dispatchMessages();
BLOCK_START("GeneralHandler::flushNetwork 3")
if (mNetwork->getState() == Network::NET_ERROR)
{
if (!mNetwork->getError().empty())
{
errorMessage = mNetwork->getError();
}
else
{
// TRANSLATORS: error message
errorMessage = _("Got disconnected from server!");
}
Client::setState(STATE_ERROR);
}
BLOCK_END("GeneralHandler::flushNetwork 3")
}
示例7: inside_main_func
int
inside_main_func (CORE_ADDR pc)
{
if (pc == 0)
return 1;
if (symfile_objfile == 0)
return 0;
/* If the addr range is not set up at symbol reading time, set it up now.
This is for FRAME_CHAIN_VALID_ALTERNATE. I do this for coff, because
it is unable to set it up and symbol reading time. */
if (symfile_objfile->ei.main_func_lowpc == INVALID_ENTRY_LOWPC &&
symfile_objfile->ei.main_func_highpc == INVALID_ENTRY_HIGHPC)
{
struct symbol *mainsym;
mainsym = lookup_symbol (main_name (), NULL, VAR_NAMESPACE, NULL, NULL);
if (mainsym && SYMBOL_CLASS (mainsym) == LOC_BLOCK)
{
symfile_objfile->ei.main_func_lowpc =
BLOCK_START (SYMBOL_BLOCK_VALUE (mainsym));
symfile_objfile->ei.main_func_highpc =
BLOCK_END (SYMBOL_BLOCK_VALUE (mainsym));
}
}
return (symfile_objfile->ei.main_func_lowpc <= pc &&
symfile_objfile->ei.main_func_highpc > pc);
}
示例8: block_innermost_frame
struct frame_info *
block_innermost_frame (const struct block *block)
{
struct frame_info *frame;
CORE_ADDR start;
CORE_ADDR end;
if (block == NULL)
return NULL;
start = BLOCK_START (block);
end = BLOCK_END (block);
frame = get_selected_frame_if_set ();
if (frame == NULL)
frame = get_current_frame ();
while (frame != NULL)
{
struct block *frame_block = get_frame_block (frame, NULL);
if (frame_block != NULL && contained_in (frame_block, block))
return frame;
frame = get_prev_frame (frame);
}
return NULL;
}
示例9: block_innermost_frame
struct frame_info *
block_innermost_frame (struct block *block)
{
struct frame_info *frame;
CORE_ADDR start;
CORE_ADDR end;
CORE_ADDR calling_pc;
if (block == NULL)
return NULL;
start = BLOCK_START (block);
end = BLOCK_END (block);
frame = NULL;
while (1)
{
frame = get_prev_frame (frame);
if (frame == NULL)
return NULL;
calling_pc = get_frame_address_in_block (frame);
if (calling_pc >= start && calling_pc < end)
return frame;
}
}
示例10: get_pc_function_start
CORE_ADDR
get_pc_function_start (CORE_ADDR pc)
{
struct block *bl;
struct minimal_symbol *msymbol;
bl = block_for_pc (pc);
if (bl)
{
struct symbol *symbol = block_linkage_function (bl);
if (symbol)
{
bl = SYMBOL_BLOCK_VALUE (symbol);
return BLOCK_START (bl);
}
}
msymbol = lookup_minimal_symbol_by_pc (pc);
if (msymbol)
{
CORE_ADDR fstart = SYMBOL_VALUE_ADDRESS (msymbol);
if (find_pc_section (fstart))
return fstart;
}
return 0;
}
示例11: find_proc_desc
static struct mdebug_extra_func_info *
find_proc_desc (CORE_ADDR pc)
{
struct block *b = block_for_pc (pc);
struct mdebug_extra_func_info *proc_desc = NULL;
struct symbol *sym = NULL;
if (b)
{
CORE_ADDR startaddr;
find_pc_partial_function (pc, NULL, &startaddr, NULL);
if (startaddr > BLOCK_START (b))
/* This is the "pathological" case referred to in a comment in
print_frame_info. It might be better to move this check into
symbol reading. */
sym = NULL;
else
sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0, NULL);
}
if (sym)
{
proc_desc = (struct mdebug_extra_func_info *) SYMBOL_VALUE (sym);
/* If we never found a PDR for this function in symbol reading,
then examine prologues to find the information. */
if (proc_desc->pdr.framereg == -1)
proc_desc = NULL;
}
return proc_desc;
}
示例12: BLOCK_START
void ConnectionDialog::draw(gcn::Graphics *graphics)
{
BLOCK_START("ConnectionDialog::draw")
// Don't draw the window background, only draw the children
drawChildren(graphics);
BLOCK_END("ConnectionDialog::draw")
}
示例13: there_is_a_visible_common_named
static int
there_is_a_visible_common_named (char *comname)
{
SAVED_F77_COMMON_PTR the_common;
struct frame_info *fi;
char *funname = 0;
struct symbol *func;
if (comname == NULL)
error ("Cannot deal with NULL common name!");
fi = deprecated_selected_frame;
if (fi == NULL)
error ("No frame selected");
/* The following is generally ripped off from stack.c's routine
print_frame_info() */
func = find_pc_function (fi->pc);
if (func)
{
/* In certain pathological cases, the symtabs give the wrong
function (when we are in the first function in a file which
is compiled without debugging symbols, the previous function
is compiled with debugging symbols, and the "foo.o" symbol
that is supposed to tell us where the file with debugging symbols
ends has been truncated by ar because it is longer than 15
characters).
So look in the minimal symbol tables as well, and if it comes
up with a larger address for the function use that instead.
I don't think this can ever cause any problems; there shouldn't
be any minimal symbols in the middle of a function.
FIXME: (Not necessarily true. What about text labels) */
struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
if (msymbol != NULL
&& (SYMBOL_VALUE_ADDRESS (msymbol)
> BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
funname = DEPRECATED_SYMBOL_NAME (msymbol);
else
funname = DEPRECATED_SYMBOL_NAME (func);
}
else
{
struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (fi->pc);
if (msymbol != NULL)
funname = DEPRECATED_SYMBOL_NAME (msymbol);
}
the_common = find_common_for_function (comname, funname);
return (the_common ? 1 : 0);
}
示例14: BLOCK_START
void Minimap::setMap(const Map *const map)
{
BLOCK_START("Minimap::setMap")
std::string caption;
if (map)
caption = map->getName();
if (caption.empty())
{
// TRANSLATORS: mini map window name
caption = _("Map");
}
setCaption(caption);
deleteMapImage();
if (map)
{
if (config.getBoolValue("showExtMinimaps"))
{
SDL_Surface *const surface = MSDL_CreateRGBSurface(SDL_SWSURFACE,
map->getWidth(), map->getHeight(), 32,
0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000);
if (!surface)
{
if (!isSticky())
setVisible(Visible_false);
BLOCK_END("Minimap::setMap")
return;
}
// I'm not sure if the locks are necessary since it's a SWSURFACE
SDL_LockSurface(surface);
int* data = static_cast<int*>(surface->pixels);
if (!data)
{
if (!isSticky())
setVisible(Visible_false);
BLOCK_END("Minimap::setMap")
return;
}
const int size = surface->h * surface->w;
const int mask = (BlockMask::WALL | BlockMask::AIR
| BlockMask::WATER);
for (int ptr = 0; ptr < size; ptr ++)
*(data ++) = -!(map->mMetaTiles[ptr].blockmask & mask);
SDL_UnlockSurface(surface);
mMapImage = imageHelper->load(surface);
mMapImage->setAlpha(settings.guiAlpha);
mCustomMapImage = true;
MSDL_FreeSurface(surface);
}
else
{
示例15: blpy_get_start
static PyObject *
blpy_get_start (PyObject *self, void *closure)
{
const struct block *block = NULL;
BLPY_REQUIRE_VALID (self, block);
return gdb_py_object_from_ulongest (BLOCK_START (block));
}