~ubuntu-branches/ubuntu/precise/dwarves-dfsg/precise

« back to all changes in this revision

Viewing changes to dutil.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Girard
  • Date: 2011-05-02 19:34:31 UTC
  • mfrom: (1.1.1 upstream) (2.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20110502193431-xd7eeb4sarnmyd7e
Tags: 1.9-1
* Acknowledge 1.3-1.1 NMU (thanks to Michael Banck) and resynch with
  Ubuntu release (thanks Bhavani Shankar).
* New upstream release:
  - patch from 1.3-1.1ubuntu1 no longer needed.
  - new manpage for pahole.
  - new program scncopy to copy ELF sections.
  - fixes crash when encountering a pointer in a struct. Closes: #513573.
  - recognizes C++ classes. Closes: #621530.
  - no longer FTBFS with gcc 4.6. Closes: #625158.
* Remove libebl detection and use. Closes: #534529.
* debian/control:
  - bump debhelper level to 7.
  - add Vcs-Git: and Vcs-Browser:
  - bump Standards-Version: to 3.9.2.
  - add zlib1g-dev build dependency.
* debian/copyright: add missing copyright holders.
* debian/rules:
  - allow to be compiled twice in a row.
  - ensure package building aborts if a program is not installed.
  - use dh_prep instead of dh_clean -k.
* debian/dwarves.install:
  - include syscse. Closes: #517180.
  - add ctracer. See README.ctracer for information on how to use it.
* Switch to dpkg-source 3.0 (quilt) format.
* Fix many lintian warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef _DUTIL_H_
2
2
#define _DUTIL_H_ 1
3
 
/* 
4
 
  Copyright (C) 2007 Arnaldo Carvalho de Melo <acme@redhat.com>
5
 
 
6
 
  This program is free software; you can redistribute it and/or modify it
7
 
  under the terms of version 2 of the GNU General Public License as
8
 
  published by the Free Software Foundation.
9
 
*/
10
 
 
11
 
 
12
 
struct fstrlist {
13
 
        void *entries;
14
 
};
15
 
 
16
 
struct fstrlist *fstrlist__new(const char *filename);
17
 
void fstrlist__delete(struct fstrlist *self);
18
 
 
19
 
int fstrlist__has_entry(const struct fstrlist *self, const char *entry);
 
3
/*
 
4
 * Copyright (C) 2007..2009 Arnaldo Carvalho de Melo <acme@redhat.com>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify it
 
7
 * under the terms of version 2 of the GNU General Public License as
 
8
 * published by the Free Software Foundation.
 
9
 *
 
10
 * Some functions came from the Linux Kernel sources, copyrighted by a
 
11
 * cast of dozens, please see the Linux Kernel git history for details.
 
12
 */
 
13
 
 
14
#include <stdbool.h>
 
15
#include <stddef.h>
 
16
#include <elf.h>
 
17
#include <gelf.h>
 
18
#include "rbtree.h"
 
19
 
 
20
#ifndef __unused
 
21
#define __unused __attribute__ ((unused))
 
22
#endif
 
23
 
 
24
#ifndef __pure
 
25
#define __pure __attribute__ ((pure))
 
26
#endif
 
27
 
 
28
#define roundup(x,y) ((((x) + ((y) - 1)) / (y)) * (y))
 
29
 
 
30
static inline __attribute__((const)) bool is_power_of_2(unsigned long n)
 
31
{
 
32
        return (n != 0 && ((n & (n - 1)) == 0));
 
33
}
 
34
 
 
35
/* We need define two variables, argp_program_version_hook and
 
36
   argp_program_bug_address, in all programs.  argp.h declares these
 
37
   variables as non-const (which is correct in general).  But we can
 
38
   do better, it is not going to change.  So we want to move them into
 
39
   the .rodata section.  Define macros to do the trick.  */
 
40
#define ARGP_PROGRAM_VERSION_HOOK_DEF \
 
41
        void (*const apvh) (FILE *, struct argp_state *) \
 
42
        __asm ("argp_program_version_hook")
 
43
#define ARGP_PROGRAM_BUG_ADDRESS_DEF \
 
44
        const char *const apba__ __asm ("argp_program_bug_address")
 
45
 
 
46
struct str_node {
 
47
        struct rb_node rb_node;
 
48
        const char       *s;
 
49
};
 
50
 
 
51
struct strlist {
 
52
        struct rb_root entries;
 
53
        bool dupstr;
 
54
};
 
55
 
 
56
struct strlist *strlist__new(bool dupstr);
 
57
void strlist__delete(struct strlist *self);
 
58
 
 
59
void strlist__remove(struct strlist *self, struct str_node *sn);
 
60
int strlist__load(struct strlist *self, const char *filename);
 
61
int strlist__add(struct strlist *self, const char *str);
 
62
 
 
63
bool strlist__has_entry(struct strlist *self, const char *entry);
 
64
 
 
65
static inline bool strlist__empty(const struct strlist *self)
 
66
{
 
67
        return rb_first(&self->entries) == NULL;
 
68
}
 
69
 
 
70
void *zalloc(const size_t size);
 
71
 
 
72
Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 
73
                             GElf_Shdr *shp, const char *name, size_t *index);
20
74
 
21
75
#endif /* _DUTIL_H_ */