Commit cec40a74 authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

Merge remote-tracking branch 'origin/mq-filter-stack'

parents 18f70a62 8263690e
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -79,11 +79,6 @@ docker_fedora-26-amd64:
    IMG_NAME: "fedora-26-amd64"
  <<: *docker_build

docker_centos-6-amd64:
  variables:
    IMG_NAME: "centos-6-amd64"
  <<: *docker_build

docker_centos-7-amd64:
  variables:
    IMG_NAME: "centos-7-amd64"
@@ -174,13 +169,6 @@ docker_ubuntu-16_04-amd64:
  - linux
  - amd64

.centos-6-amd64: &centos-6-amd64_env
  image: registry.labs.nic.cz/labs/bird:centos-6-amd64
  tags:
  - docker
  - linux
  - amd64

.centos-7-amd64: &centos-7-amd64_env
  image: registry.labs.nic.cz/labs/bird:centos-7-amd64
  tags:
@@ -264,10 +252,6 @@ build-fedora-26-amd64:
  <<: *fedora-26-amd64_env
  <<: *build_job

build-centos-6-amd64:
  <<: *centos-6-amd64_env
  <<: *build_job

build-centos-7-amd64:
  <<: *centos-7-amd64_env
  <<: *build_job
+3 −0
Original line number Diff line number Diff line
@@ -77,6 +77,8 @@ $(daemon): LIBS += $(DAEMON_LIBS)
# Include directories
dirs := client conf doc filter lib nest test $(addprefix proto/,$(protocols)) @sysdep_dirs@

# conf/Makefile declarations needed for all other modules
conf-lex-targets := $(addprefix $(objdir)/conf/,cf-lex.o)
conf-y-targets := $(addprefix $(objdir)/conf/,cf-parse.y keywords.h commands.h)
cf-local = $(conf-y-targets): $(s)config.Y

@@ -100,6 +102,7 @@ endef

clean = $(eval $(call clean_in,$(1)))

# Include main Makefiles of the directories
include $(addsuffix /Makefile,$(addprefix $(srcdir)/,$(dirs)))

# Generic rules
+43 −0
Original line number Diff line number Diff line
dnl ** Additional Autoconf tests for BIRD configure script
dnl ** (c) 1999 Martin Mares <mj@ucw.cz>

AC_DEFUN([BIRD_CHECK_THREAD_LOCAL],
[
  AC_CACHE_CHECK(
    [whether _Thread_local is known],
    [bird_cv_thread_local],
    AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM(
        [
	  _Thread_local static int x = 42;
	],
	[]
      )
    ],
    [bird_cv_thread_local=yes],
    [bird_cv_thread_local=no]
    )
  )
])

AC_DEFUN([BIRD_CHECK_PTHREADS],
[
  bird_tmp_cflags="$CFLAGS"
@@ -131,6 +150,30 @@ AC_DEFUN([BIRD_CHECK_ANDROID_LOG],
  )
])

AC_DEFUN([BIRD_CHECK_LTO],
[
  bird_tmp_cflags="$CFLAGS"
  bird_tmp_ldflags="$LDFLAGS"
  CFLAGS="-flto"
  LDFLAGS="-flto"

  AC_CACHE_CHECK(
    [whether link time optimizer is available],
    [bird_cv_c_lto],
    [
      AC_LINK_IFELSE(
	[AC_LANG_PROGRAM()],
	[bird_cv_c_lto=yes],
	[bird_cv_c_lto=no]
      )
    ]
  )

  CFLAGS="$bird_tmp_cflags"
  LDFLAGS="$bird_tmp_ldflags"
])


AC_DEFUN([BIRD_CHECK_GCC_OPTION],
[
  bird_tmp_cflags="$CFLAGS"

bird-gdb.py

0 → 100644
+153 −0
Original line number Diff line number Diff line
class BIRDPrinter:
    def __init__(self, val):
        self.val = val

    @classmethod
    def lookup(cls, val):
        if val.type.code != cls.typeCode:
            return None
        if val.type.tag != cls.typeTag:
            return None

        return cls(val)


class BIRDFValPrinter(BIRDPrinter):
    "Print BIRD\s struct f_val"
    typeCode = gdb.TYPE_CODE_STRUCT
    typeTag = "f_val"

    codemap = {
            "T_INT": "i",
            "T_BOOL": "i",
            "T_PAIR": "i",
            "T_QUAD": "i",
            "T_ENUM_RTS": "i",
            "T_ENUM_BGP_ORIGIN": "i",
            "T_ENUM_SCOPE": "i",
            "T_ENUM_RTC": "i",
            "T_ENUM_RTD": "i",
            "T_ENUM_ROA": "i",
            "T_ENUM_NETTYPE": "i",
            "T_ENUM_RA_PREFERENCE": "i",
            "T_IP": "ip",
            "T_NET": "net",
            "T_STRING": "s",
            "T_PATH_MASK": "path_mask",
            "T_PATH": "ad",
            "T_CLIST": "ad",
            "T_EC": "ec",
            "T_ECLIST": "ad",
            "T_LC": "lc",
            "T_LCLIST": "ad",
            "T_RD": "ec",
            "T_PATH_MASK_ITEM": "pmi",
            "T_SET": "t",
            "T_PREFIX_SET": "ti",
            }

    def to_string(self):
        code = self.val['type']
        if code.type.code != gdb.TYPE_CODE_ENUM or code.type.tag != "f_type":
            raise Exception("Strange 'type' element in f_val")

        if str(code) == "T_VOID":
            return "T_VOID"
        else:
            return "(%(c)s) %(v)s" % { "c": code, "v": self.val['val'][self.codemap[str(code)]] }

    def display_hint(self):
        return "map"

class BIRDFValStackPrinter(BIRDPrinter):
    "Print BIRD's struct f_val_stack"
    typeCode = gdb.TYPE_CODE_STRUCT
    typeTag = "f_val_stack"

    def to_string(self):
        cnt = self.val['cnt']
        return ("Value stack (%(cnt)d):\n\t" % { "cnt": cnt }) + \
                "\n\t".join([ (".val[%(n) 3d] = " % { "n": n}) + str(self.val['val'][n]) for n in range(cnt-1, -1, -1) ])

    def display_hint(self):
        return "map"

class BIRDFInstPrinter(BIRDPrinter):
    "Print BIRD's struct f_inst"
    typeCode = gdb.TYPE_CODE_STRUCT
    typeTag = "f_inst"

    def to_string(self):
        code = self.val['fi_code']
        if str(code) == "FI_NOP":
            return str(code) + ": " + str(self.val.cast(gdb.lookup_type("const char [%(siz)d]" % { "siz": self.val.type.sizeof })))
        return "%(code)s:\t%(lineno) 6dL\t%(size)6dS\tnext = %(next)s: .i_%(code)s = %(union)s" % {
                "code": str(code),
                "lineno": self.val['lineno'],
                "size": self.val['size'],
                "next": str(self.val['next']),
                "union": str(self.val['i_' + str(code)])
                }

# def children(self): # children iterator
    def display_hint(self):
        return "map"

class BIRDFLineItemPrinter(BIRDPrinter):
    "Print BIRD's struct f_line_item"
    typeCode = gdb.TYPE_CODE_STRUCT
    typeTag = "f_line_item"

    def to_string(self):
        code = self.val['fi_code']
        if str(code) == "FI_NOP":
            return str(code) + ": " + str(self.val.cast(gdb.lookup_type("const char [%(siz)d]" % { "siz": self.val.type.sizeof })))
        return "%(code)s:\t%(lineno) 6dL\t%(flags)2dF: .i_%(code)s = %(union)s" % {
                "code": str(code),
                "lineno": self.val['lineno'],
                "flags": self.val['flags'],
                "union": str(self.val['i_' + str(code)])
                }

class BIRDFLinePrinter(BIRDPrinter):
    "Print BIRD's struct f_line"
    typeCode = gdb.TYPE_CODE_STRUCT
    typeTag = "f_line"

    def to_string(self):
        cnt = self.val['len']
        return ("FLine (%(cnt)d, args=%(args)d): " % { "cnt": cnt, "args" : self.val['args'] } + \
                ", ".join([
                    ".items[%(n) 3d] = %(code)s" % {
                        "n": n,
                        "code": str(self.val['items'][n]['fi_code']),
                    } if n % 8 == 0 else str(self.val['items'][n]['fi_code']) for n in range(cnt)]))
        

class BIRDFExecStackPrinter(BIRDPrinter):
    "Print BIRD's struct f_exec_stack"
    typeCode = gdb.TYPE_CODE_STRUCT
    typeTag = "f_exec_stack"

    def to_string(self):
        cnt = self.val['cnt']
        return ("Exec stack (%(cnt)d):\n\t" % { "cnt": cnt }) + \
                "\n\t".join([ ".item[%(n) 3d] = %(retflag)d V%(ventry) 3d P%(pos) 4d %(line)s" % {
                    "retflag": self.val['item'][n]['emask'],
                    "ventry": self.val['item'][n]['ventry'],
                    "pos": self.val['item'][n]['pos'],
                    "line": str(self.val['item'][n]['line'].dereference()),
                    "n": n
                        } for n in range(cnt-1, -1, -1) ])

def register_printers(objfile):
    objfile.pretty_printers.append(BIRDFInstPrinter.lookup)
    objfile.pretty_printers.append(BIRDFValPrinter.lookup)
    objfile.pretty_printers.append(BIRDFValStackPrinter.lookup)
    objfile.pretty_printers.append(BIRDFLineItemPrinter.lookup)
    objfile.pretty_printers.append(BIRDFLinePrinter.lookup)
    objfile.pretty_printers.append(BIRDFExecStackPrinter.lookup)

register_printers(gdb.current_objfile())

print("BIRD pretty printers loaded OK.")
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ src := commands.c util.c client.c
obj := $(src-o-files)

$(all-client)
$(conf-y-targets): $(s)cmds.Y

$(exedir)/birdc: $(o)birdc.o
$(exedir)/birdc: LIBS += $(CLIENT_LIBS)
Loading