⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 targets.texi

📁 这个是LINUX下的GDB调度工具的源码
💻 TEXI
📖 第 1 页 / 共 2 页
字号:
@section Targets@strong{Description}@*Each port of BFD to a different machine requires the creationof a target back end. All the back end provides to the rootpart of BFD is a structure containing pointers to functionswhich perform certain low level operations on files. BFDtranslates the applications's requests through a pointer intocalls to the back end routines.When a file is opened with @code{bfd_openr}, its format andtarget are unknown. BFD uses various mechanisms to determinehow to interpret the file. The operations performed are:@itemize @bullet@itemCreate a BFD by calling the internal routine@code{_bfd_new_bfd}, then call @code{bfd_find_target} with thetarget string supplied to @code{bfd_openr} and the new BFD pointer.@itemIf a null target string was provided to @code{bfd_find_target},look up the environment variable @code{GNUTARGET} and usethat as the target string.@itemIf the target string is still @code{NULL}, or the target string is@code{default}, then use the first item in the target vectoras the target type, and set @code{target_defaulted} in the BFD tocause @code{bfd_check_format} to loop through all the targets.@xref{bfd_target}.  @xref{Formats}.@itemOtherwise, inspect the elements in the target vectorone by one, until a match on target name is found. When found,use it.@itemOtherwise return the error @code{bfd_error_invalid_target} to@code{bfd_openr}.@item@code{bfd_openr} attempts to open the file using@code{bfd_open_file}, and returns the BFD.@end itemizeOnce the BFD has been opened and the target selected, the fileformat may be determined. This is done by calling@code{bfd_check_format} on the BFD with a suggested format.If @code{target_defaulted} has been set, each possible targettype is tried to see if it recognizes the specified format.@code{bfd_check_format} returns @code{TRUE} when the caller guesses right.@menu* bfd_target::@end menu@node bfd_target,  , Targets, Targets@subsection bfd_target@strong{Description}@*This structure contains everything that BFD knows about atarget. It includes things like its byte order, name, and whichroutines to call to do various operations.Every BFD points to a target structure with its @code{xvec}member.The macros below are used to dispatch to functions through the@code{bfd_target} vector. They are used in a number of macros furtherdown in @file{bfd.h}, and are also used when calling variousroutines by hand inside the BFD implementation.  The @var{arglist}argument must be parenthesized; it contains all the argumentsto the called function.They make the documentation (more) unpleasant to read, so ifsomeone wants to fix this and not break the above, please do.@example#define BFD_SEND(bfd, message, arglist) \  ((*((bfd)->xvec->message)) arglist)#ifdef DEBUG_BFD_SEND#undef BFD_SEND#define BFD_SEND(bfd, message, arglist) \  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \    ((*((bfd)->xvec->message)) arglist) : \    (bfd_assert (__FILE__,__LINE__), NULL))#endif@end exampleFor operations which index on the BFD format:@example#define BFD_SEND_FMT(bfd, message, arglist) \  (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)#ifdef DEBUG_BFD_SEND#undef BFD_SEND_FMT#define BFD_SEND_FMT(bfd, message, arglist) \  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \   (bfd_assert (__FILE__,__LINE__), NULL))#endif@end exampleThis is the structure which defines the type of BFD this is.  The@code{xvec} member of the struct @code{bfd} itself points here.  Eachmodule that implements access to a different target under BFD,defines one of these.FIXME, these names should be rationalised with the names ofthe entry points which call them. Too bad we can't have onemacro to define them both!@exampleenum bfd_flavour@{  bfd_target_unknown_flavour,  bfd_target_aout_flavour,  bfd_target_coff_flavour,  bfd_target_ecoff_flavour,  bfd_target_xcoff_flavour,  bfd_target_elf_flavour,  bfd_target_ieee_flavour,  bfd_target_nlm_flavour,  bfd_target_oasys_flavour,  bfd_target_tekhex_flavour,  bfd_target_srec_flavour,  bfd_target_ihex_flavour,  bfd_target_som_flavour,  bfd_target_os9k_flavour,  bfd_target_versados_flavour,  bfd_target_msdos_flavour,  bfd_target_ovax_flavour,  bfd_target_evax_flavour,  bfd_target_mmo_flavour,  bfd_target_mach_o_flavour,  bfd_target_pef_flavour,  bfd_target_pef_xlib_flavour,  bfd_target_sym_flavour@};enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @};/* Forward declaration.  */typedef struct bfd_link_info _bfd_link_info;typedef struct bfd_target@{  /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  */  char *name; /* The "flavour" of a back end is a general indication about    the contents of a file.  */  enum bfd_flavour flavour;  /* The order of bytes within the data area of a file.  */  enum bfd_endian byteorder; /* The order of bytes within the header parts of a file.  */  enum bfd_endian header_byteorder;  /* A mask of all the flags which an executable may have set -     from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}.  */  flagword object_flags; /* A mask of all the flags which a section may have set - from    the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}.  */  flagword section_flags; /* The character normally found at the front of a symbol.    (if any), perhaps `_'.  */  char symbol_leading_char; /* The pad character for file names within an archive header.  */  char ar_pad_char;  /* The maximum number of characters in an archive header.  */  unsigned short ar_max_namelen;  /* Entries for byte swapping for data. These are different from the     other entry points, since they don't take a BFD asthe first argument.     Certain other handlers could do the same.  */  bfd_uint64_t   (*bfd_getx64) (const void *);  bfd_int64_t    (*bfd_getx_signed_64) (const void *);  void           (*bfd_putx64) (bfd_uint64_t, void *);  bfd_vma        (*bfd_getx32) (const void *);  bfd_signed_vma (*bfd_getx_signed_32) (const void *);  void           (*bfd_putx32) (bfd_vma, void *);  bfd_vma        (*bfd_getx16) (const void *);  bfd_signed_vma (*bfd_getx_signed_16) (const void *);  void           (*bfd_putx16) (bfd_vma, void *);  /* Byte swapping for the headers.  */  bfd_uint64_t   (*bfd_h_getx64) (const void *);  bfd_int64_t    (*bfd_h_getx_signed_64) (const void *);  void           (*bfd_h_putx64) (bfd_uint64_t, void *);  bfd_vma        (*bfd_h_getx32) (const void *);  bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);  void           (*bfd_h_putx32) (bfd_vma, void *);  bfd_vma        (*bfd_h_getx16) (const void *);  bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);  void           (*bfd_h_putx16) (bfd_vma, void *);  /* Format dependent routines: these are vectors of entry points     within the target vector structure, one for each format to check.  */  /* Check the format of a file being read.  Return a @code{bfd_target *} or zero.  */  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);  /* Set the format of a file being written.  */  bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);  /* Write cached information into a file being written, at @code{bfd_close}.  */  bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);@end exampleThe general target vector.  These vectors are initialized using theBFD_JUMP_TABLE macros.@example  /* Generic entry points.  */#define BFD_JUMP_TABLE_GENERIC(NAME) \  NAME##_close_and_cleanup, \  NAME##_bfd_free_cached_info, \  NAME##_new_section_hook, \  NAME##_get_section_contents, \  NAME##_get_section_contents_in_window  /* Called when the BFD is being closed to do any necessary cleanup.  */  bfd_boolean (*_close_and_cleanup) (bfd *);  /* Ask the BFD to free all cached information.  */  bfd_boolean (*_bfd_free_cached_info) (bfd *);  /* Called when a new section is created.  */  bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);  /* Read the contents of a section.  */  bfd_boolean (*_bfd_get_section_contents)    (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);  bfd_boolean (*_bfd_get_section_contents_in_window)    (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);  /* Entry points to copy private data.  */#define BFD_JUMP_TABLE_COPY(NAME) \  NAME##_bfd_copy_private_bfd_data, \  NAME##_bfd_merge_private_bfd_data, \  NAME##_bfd_copy_private_section_data, \  NAME##_bfd_copy_private_symbol_data, \  NAME##_bfd_copy_private_header_data, \  NAME##_bfd_set_private_flags, \  NAME##_bfd_print_private_bfd_data  /* Called to copy BFD general private data from one object file     to another.  */  bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);  /* Called to merge BFD general private data from one object file     to a common output file when linking.  */  bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);  /* Called to copy BFD private section data from one object file     to another.  */  bfd_boolean (*_bfd_copy_private_section_data)    (bfd *, sec_ptr, bfd *, sec_ptr);  /* Called to copy BFD private symbol data from one symbol     to another.  */  bfd_boolean (*_bfd_copy_private_symbol_data)    (bfd *, asymbol *, bfd *, asymbol *);  /* Called to copy BFD private header data from one object file     to another.  */  bfd_boolean (*_bfd_copy_private_header_data)    (bfd *, bfd *);  /* Called to set private backend flags.  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -