Sha256: 63a0452a5df49d229abbf7875e7472d2819a66b531bc9cc5bedd8d63b2503c91

Contents?: true

Size: 1.17 KB

Versions: 34

Compression:

Stored size: 1.17 KB

Contents

#include "attach.h"

#ifndef __GNUC__
#define __asm__ asm
#endif

/*
We need to prevent compiler from optimizing this function calls. For more details
see "noinline" section here: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
*/
static void
#if defined(_MSC_VER)
__declspec(noinline)
__func_to_set_breakpoint_at()
{
}
#else
__attribute__((noinline))
__func_to_set_breakpoint_at()
{
    __asm__("");
}
#endif

static void
__catch_line_event(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass)
{
    (void)sizeof(evflag);
    (void)sizeof(self);
    (void)sizeof(mid);
    (void)sizeof(klass);

    rb_remove_event_hook(__catch_line_event);
    if (rb_during_gc())
        return;
    __func_to_set_breakpoint_at();
}

int
debase_start_attach()
{
    if (rb_during_gc())
        return 1;
    rb_add_event_hook(__catch_line_event, RUBY_EVENT_LINE, (VALUE) NULL);
    return 0;
}

void
debase_rb_eval(const char *string_to_eval)
{
    rb_eval_string_protect(string_to_eval, NULL);
}

void
Init_attach()
{
  /*
  The only purpose of this library is to be dlopen'ed inside
  gdb/lldb. So no initialization here, you should directly
  call functions above.
  */
}

Version data entries

34 entries across 23 versions & 3 rubygems

Version Path
debase-0.2.7 ext/attach/attach.c
debase-0.2.6 ext/attach/attach.c
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/debase-0.2.5.beta2/ext/attach/attach.c
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/debase-0.2.5.beta1/ext/attach/attach.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/debase-0.2.5.beta1/ext/attach/attach.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c
debase-0.2.5.beta2 ext/attach/attach.c
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/debase-0.2.4.1/ext/attach/attach.c