• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BFD_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BFD_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ BFD_ASSERT函数的具体用法?C++ BFD_ASSERT怎么用?C++ BFD_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BFD_ASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _bfd_cgc_strtab_addref

void
_bfd_cgc_strtab_addref (struct cgc_strtab_hash *tab, bfd_size_type idx)
{
  if (idx == 0 || idx == (bfd_size_type) -1)
    return;
  BFD_ASSERT (tab->sec_size == 0);
  BFD_ASSERT (idx < tab->size);
  ++tab->array[idx]->refcount;
}
开发者ID:CyberGrandChallenge,项目名称:binutils,代码行数:9,代码来源:cgc-strtab.c


示例2: _bfd_elf_strtab_delref

void
_bfd_elf_strtab_delref (struct elf_strtab_hash *tab, bfd_size_type idx)
{
  if (idx == 0 || idx == (bfd_size_type) -1)
    return;
  BFD_ASSERT (tab->sec_size == 0);
  BFD_ASSERT (idx < tab->size);
  BFD_ASSERT (tab->array[idx]->refcount > 0);
  --tab->array[idx]->refcount;
}
开发者ID:0mp,项目名称:freebsd,代码行数:10,代码来源:elf-strtab.c


示例3: _bfd_elf_strtab_offset

bfd_size_type
_bfd_elf_strtab_offset (struct elf_strtab_hash *tab, bfd_size_type idx)
{
  struct elf_strtab_hash_entry *entry;

  if (idx == 0)
    return 0;
  BFD_ASSERT (idx < tab->size);
  BFD_ASSERT (tab->sec_size);
  entry = tab->array[idx];
  BFD_ASSERT (entry->refcount > 0);
  entry->refcount--;
  return tab->array[idx]->u.index;
}
开发者ID:0mp,项目名称:freebsd,代码行数:14,代码来源:elf-strtab.c


示例4: bfd_plugin_object_p

static const bfd_target *
bfd_plugin_object_p (bfd *abfd)
{
  int claimed = 0;
  int t = load_plugin ();
  struct ld_plugin_input_file file;
  if (!t)
    return NULL;

  file.name = abfd->filename;

  if (abfd->iostream)
    {
      file.fd = fileno ((FILE *) abfd->iostream);
      file.offset = 0;
      file.filesize = 0; /*FIXME*/
    }
  else
    {
      bfd *archive = abfd->my_archive;
      BFD_ASSERT (archive);
      file.fd = fileno ((FILE *) archive->iostream);
      file.offset = abfd->origin;
      file.filesize = arelt_size (abfd);

    }
  file.handle = abfd;
  claim_file (&file, &claimed);
  if (!claimed)
    return NULL;

  return abfd->xvec;
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:33,代码来源:plugin.c


示例5: _bfd_write_stab_strings

bfd_boolean
_bfd_write_stab_strings (bfd *output_bfd, struct stab_info *sinfo)
{
  if (bfd_is_abs_section (sinfo->stabstr->output_section))
    /* The section was discarded from the link.  */
    return TRUE;

  BFD_ASSERT ((sinfo->stabstr->output_offset
	       + _bfd_stringtab_size (sinfo->strings))
	      <= sinfo->stabstr->output_section->size);

  if (bfd_seek (output_bfd,
		(file_ptr) (sinfo->stabstr->output_section->filepos
			    + sinfo->stabstr->output_offset),
		SEEK_SET) != 0)
    return FALSE;

  if (! _bfd_stringtab_emit (output_bfd, sinfo->strings))
    return FALSE;

  /* We no longer need the stabs information.  */
  _bfd_stringtab_free (sinfo->strings);
  bfd_hash_table_free (&sinfo->includes);

  return TRUE;
}
开发者ID:freebsd-riscv,项目名称:riscv-binutils-gdb,代码行数:26,代码来源:stabs.c


示例6: MY

static bfd_boolean
MY(write_object_contents) (bfd *abfd)
{
  struct external_exec exec_bytes;
  struct internal_exec *execp = exec_hdr (abfd);

  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;

  BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_ns32k);
  switch (bfd_get_mach (abfd))
    {
    case 32032:
      N_SET_MACHTYPE (execp, M_NS32032);
      break;
    case 32532:
    default:
      N_SET_MACHTYPE (execp, M_NS32532);
      break;
    }
  N_SET_FLAGS (execp, aout_backend_info (abfd)->exec_hdr_flags);

  WRITE_HEADERS (abfd, execp);

  return TRUE;
}
开发者ID:eepp,项目名称:binutils-gdb,代码行数:25,代码来源:pc532-mach.c


示例7: decompress_contents

static bfd_boolean
decompress_contents (bfd_byte *compressed_buffer,
		     bfd_size_type compressed_size,
		     bfd_byte *uncompressed_buffer,
		     bfd_size_type uncompressed_size)
{
  z_stream strm;
  int rc;

  /* It is possible the section consists of several compressed
     buffers concatenated together, so we uncompress in a loop.  */
  strm.zalloc = NULL;
  strm.zfree = NULL;
  strm.opaque = NULL;
  strm.avail_in = compressed_size - 12;
  strm.next_in = (Bytef*) compressed_buffer + 12;
  strm.avail_out = uncompressed_size;

  BFD_ASSERT (Z_OK == 0);
  rc = inflateInit (&strm);
  while (strm.avail_in > 0 && strm.avail_out > 0)
    {
      if (rc != Z_OK)
	break;
      strm.next_out = ((Bytef*) uncompressed_buffer
                       + (uncompressed_size - strm.avail_out));
      rc = inflate (&strm, Z_FINISH);
      if (rc != Z_STREAM_END)
	break;
      rc = inflateReset (&strm);
    }
  rc |= inflateEnd (&strm);
  return rc == Z_OK && strm.avail_out == 0;
}
开发者ID:5kg,项目名称:gdb,代码行数:34,代码来源:compress.c


示例8: _bfd_elf_strtab_restore_size

/* Downsizes strtab.  Entries from IDX up to the current size are
   removed from the array.  */
void
_bfd_elf_strtab_restore_size (struct elf_strtab_hash *tab, bfd_size_type idx)
{
  bfd_size_type curr_size = tab->size;

  BFD_ASSERT (tab->sec_size == 0);
  BFD_ASSERT (idx <= curr_size);
  tab->size = idx;
  for (; idx < curr_size; ++idx)
    {
      /* We don't remove entries from the hash table, just set their
	 REFCOUNT to zero.  Setting LEN zero will result in the size
	 growing if the entry is added again.  See _bfd_elf_strtab_add.  */
      tab->array[idx]->refcount = 0;
      tab->array[idx]->len = 0;
    }
}
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:19,代码来源:elf-strtab.c


示例9: mcore_elf_set_private_flags

static bfd_boolean
mcore_elf_set_private_flags (bfd * abfd, flagword flags)
{
  BFD_ASSERT (! elf_flags_init (abfd)
	      || elf_elfheader (abfd)->e_flags == flags);

  elf_elfheader (abfd)->e_flags = flags;
  elf_flags_init (abfd) = TRUE;
  return TRUE;
}
开发者ID:5432935,项目名称:crossbridge,代码行数:10,代码来源:elf32-mcore.c


示例10: _bfd_elf_strtab_restore

void
_bfd_elf_strtab_restore (struct elf_strtab_hash *tab, void *buf)
{
  size_t idx, curr_size = tab->size;
  struct strtab_save *save = (struct strtab_save *) buf;

  BFD_ASSERT (tab->sec_size == 0);
  BFD_ASSERT (save->size <= curr_size);
  tab->size = save->size;
  for (idx = 1; idx < save->size; ++idx)
    tab->array[idx]->refcount = save->refcount[idx];

  for (; idx < curr_size; ++idx)
    {
      /* We don't remove entries from the hash table, just set their
	 REFCOUNT to zero.  Setting LEN zero will result in the size
	 growing if the entry is added again.  See _bfd_elf_strtab_add.  */
      tab->array[idx]->refcount = 0;
      tab->array[idx]->len = 0;
    }
}
开发者ID:T-J-Teru,项目名称:binutils-gdb,代码行数:21,代码来源:elf-strtab.c


示例11: i370_elf_howto_init

static void
i370_elf_howto_init (void)
{
  unsigned int i, type;

  for (i = 0; i < sizeof (i370_elf_howto_raw) / sizeof (i370_elf_howto_raw[0]); i++)
    {
      type = i370_elf_howto_raw[i].type;
      BFD_ASSERT (type < sizeof (i370_elf_howto_table) / sizeof (i370_elf_howto_table[0]));
      i370_elf_howto_table[type] = &i370_elf_howto_raw[i];
    }
}
开发者ID:CromFr,项目名称:gdb,代码行数:12,代码来源:elf32-i370.c


示例12: s390_got_pointer

static inline bfd_vma
s390_got_pointer (struct bfd_link_info *info)
{
  struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info);
  bfd_vma got_pointer;

  BFD_ASSERT (htab && htab->elf.hgot);

  got_pointer = (htab->elf.hgot->root.u.def.section->output_section->vma
		 + htab->elf.hgot->root.u.def.section->output_offset);
  /* Our ABI requires the GOT pointer to point at the very beginning
     of the global offset table.  */
  BFD_ASSERT (got_pointer
	      <= (htab->elf.sgot->output_section->vma
		  + htab->elf.sgot->output_offset));
  BFD_ASSERT (got_pointer
	      <= (htab->elf.sgotplt->output_section->vma
		  + htab->elf.sgotplt->output_offset));

  return got_pointer;
}
开发者ID:mattstock,项目名称:binutils-bexkat1,代码行数:21,代码来源:elf-s390-common.c


示例13: _bfd_elf_strtab_add

bfd_size_type
_bfd_elf_strtab_add (struct elf_strtab_hash *tab,
		     const char *str,
		     bfd_boolean copy)
{
  register struct elf_strtab_hash_entry *entry;

  /* We handle this specially, since we don't want to do refcounting
     on it.  */
  if (*str == '\0')
    return 0;

  BFD_ASSERT (tab->sec_size == 0);
  entry = (struct elf_strtab_hash_entry *)
	  bfd_hash_lookup (&tab->table, str, TRUE, copy);

  if (entry == NULL)
    return (bfd_size_type) -1;

  entry->refcount++;
  if (entry->len == 0)
    {
      entry->len = strlen (str) + 1;
      /* 2G strings lose.  */
      BFD_ASSERT (entry->len > 0);
      if (tab->size == tab->alloced)
	{
	  bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
	  tab->alloced *= 2;
	  tab->array = (struct elf_strtab_hash_entry **)
              bfd_realloc_or_free (tab->array, tab->alloced * amt);
	  if (tab->array == NULL)
	    return (bfd_size_type) -1;
	}

      entry->u.index = tab->size++;
      tab->array[entry->u.index] = entry;
    }
  return entry->u.index;
}
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:40,代码来源:elf-strtab.c


示例14: bfd_seek

int
bfd_seek (bfd *abfd, file_ptr position, int direction)
{
  int result;
  ufile_ptr offset = 0;

  while (abfd->my_archive != NULL
	 && !bfd_is_thin_archive (abfd->my_archive))
    {
      offset += abfd->origin;
      abfd = abfd->my_archive;
    }

  if (abfd->iovec == NULL)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return -1;
    }

  /* For the time being, a BFD may not seek to it's end.  The problem
     is that we don't easily have a way to recognize the end of an
     element in an archive.  */
  BFD_ASSERT (direction == SEEK_SET || direction == SEEK_CUR);

  if (direction != SEEK_CUR)
    position += offset;

  if ((direction == SEEK_CUR && position == 0)
      || (direction == SEEK_SET && (ufile_ptr) position == abfd->where))
    return 0;

  result = abfd->iovec->bseek (abfd, position, direction);
  if (result != 0)
    {
      /* An EINVAL error probably means that the file offset was
	 absurd.  */
      if (errno == EINVAL)
	bfd_set_error (bfd_error_file_truncated);
      else
	bfd_set_error (bfd_error_system_call);
    }
  else
    {
      /* Adjust `where' field.  */
      if (direction == SEEK_CUR)
	abfd->where += position;
      else
	abfd->where = position;
    }

  return result;
}
开发者ID:T-J-Teru,项目名称:binutils-gdb,代码行数:52,代码来源:bfdio.c


示例15: s390_gotplt_offset

static inline bfd_vma
s390_gotplt_offset (struct bfd_link_info *info)
{
  struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info);

  /* The absolute address of the .got.plt in the target image.  */
  bfd_vma gotplt_address = (htab->elf.sgotplt->output_section->vma
			    + htab->elf.sgotplt->output_offset);

  /* GOT offset must not be negative.  */
  BFD_ASSERT (s390_got_pointer (info) <= gotplt_address);
  return gotplt_address - s390_got_pointer (info);
}
开发者ID:mattstock,项目名称:binutils-bexkat1,代码行数:13,代码来源:elf-s390-common.c


示例16: spu_compatible

static const bfd_arch_info_type *
spu_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
{
  BFD_ASSERT (a->arch == bfd_arch_spu);
  switch (b->arch)
    {
    default:
      return NULL;
    case bfd_arch_spu:
      return bfd_default_compatible (a, b);
    }
  /*NOTREACHED*/
}
开发者ID:0mp,项目名称:freebsd,代码行数:13,代码来源:cpu-spu.c


示例17: bfd_cache_init

bfd_boolean
bfd_cache_init (bfd *abfd)
{
  BFD_ASSERT (abfd->iostream != NULL);
  if (open_files >= BFD_CACHE_MAX_OPEN)
    {
      if (! close_one ())
	return FALSE;
    }
  abfd->iovec = &cache_iovec;
  insert (abfd);
  ++open_files;
  return TRUE;
}
开发者ID:davearrama,项目名称:gdb,代码行数:14,代码来源:cache.c


示例18: bfd_perform_slip

void
bfd_perform_slip (bfd *abfd,
		  unsigned int slip,
		  asection *input_section,
		  bfd_vma value)
{
  asymbol **s;

  s = _bfd_generic_link_get_symbols (abfd);
  BFD_ASSERT (s != (asymbol **) NULL);

  /* Find all symbols past this point, and make them know
     what's happened.  */
  while (*s)
    {
      asymbol *p = *s;
      if (p->section == input_section)
	{
	  /* This was pointing into this section, so mangle it.  */
	  if (p->value > value)
	    {
	      p->value -= slip;
	      if (p->udata.p != NULL)
		{
		  struct generic_link_hash_entry *h;

		  h = (struct generic_link_hash_entry *) p->udata.p;
		  BFD_ASSERT (h->root.type == bfd_link_hash_defined
			      || h->root.type == bfd_link_hash_defweak);
		  h->root.u.def.value -= slip;
		  BFD_ASSERT (h->root.u.def.value == p->value);
		}
	    }
	}
      s++;
    }
}
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:37,代码来源:reloc16.c


示例19: bfd_free_window

void
bfd_free_window(bfd_window *windowp)
{
  bfd_window_internal *i = windowp->i;

  windowp->i = 0;
  windowp->data = 0;

  if (i == 0)
    return;

  i->refcount--;
  if (debug_windows)
    fprintf(stderr, "freeing window @%p<%p,%lx,%p>\n",
	    (void *)windowp, windowp->data, (unsigned long)windowp->size,
            (void *)windowp->i);
  if (i->refcount > 0)
    return;

  switch (i->mapped) {

  case 2:
      i->data = NULL;
      break;

  case 1:
#if HAVE_MMAP
    munmap(i->data, (size_t)i->size);
    i->data = NULL;
#else
    abort();
#endif /* HAVE_MMAP */

  case 0:
#if defined(HAVE_MPROTECT) && HAVE_MPROTECT
    mprotect(i->data, i->size, (PROT_READ | PROT_WRITE));
#endif /* HAVE_MPROTECT */
    free(i->data);
    i->data = NULL;
    break;

  default:
    BFD_ASSERT((i->mapped == 0) || (i->mapped == 1) || (i->mapped == 2));
  }

  /* There should be no more references to i at this point: */
  free(i);
}
开发者ID:dougmencken,项目名称:apple-gdb-1824,代码行数:48,代码来源:bfdwin.c


示例20: mcore_elf_howto_init

/* Initialize the mcore_elf_howto_table, so that linear accesses can be done.  */
static void
mcore_elf_howto_init ()
{
  unsigned int i;

  for (i = NUM_ELEM (mcore_elf_howto_raw); i--;)
    {
      unsigned int type;

      type = mcore_elf_howto_raw[i].type;

      BFD_ASSERT (type < NUM_ELEM (mcore_elf_howto_table));

      mcore_elf_howto_table [type] = & mcore_elf_howto_raw [i];
    }
}
开发者ID:Rukanth,项目名称:dd-wrt,代码行数:17,代码来源:elf32-mcore.c



注:本文中的BFD_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BFS函数代码示例发布时间:2022-05-30
下一篇:
C++ BF函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap