Skip to content
Permalink
Browse files
Add helper functions to use gdb reverse-next.
On my machine, gdb reverse-next does not work with memcpy and memset.
Add naive implementation of those functions to override.
  • Loading branch information
matz committed Jun 15, 2017
1 parent b979226 commit bb1bfaa2fbc693a7185226737022d5d74b97a1de
Showing 1 changed file with 27 additions and 0 deletions.
@@ -1178,6 +1178,33 @@ MRB_API void mrb_show_copyright(mrb_state *mrb);

MRB_API mrb_value mrb_format(mrb_state *mrb, const char *format, ...);

#if 0
/* memcpy and memset does not work with gdb reverse-next on my box */
/* use naive memcpy and memset instead */
#undef memcpy
#undef memset
static inline void*
mrbmemcpy(void *dst, const void *src, size_t n)
{
char *d = dst;
const char *s = src;
while (n--)
*d++ = *s++;
return d;
}
#define memcpy(a,b,c) mrbmemcpy(a,b,c)

static inline void*
mrbmemset(void *s, int c, size_t n)
{
char *t = s;
while (n--)
*t++ = c;
return s;
}
#define memset(a,b,c) mrbmemset(a,b,c)
#endif

MRB_END_DECL

#endif /* MRUBY_H */

0 comments on commit bb1bfaa

Please sign in to comment.