seq-points-data.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. * \file
  3. * Copyright 2015 Xamarin Inc
  4. * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  5. */
  6. #ifndef __MONO_SEQ_POINTS_DATA_H__
  7. #define __MONO_SEQ_POINTS_DATA_H__
  8. #include <glib.h>
  9. #define MONO_SEQ_POINT_FLAG_NONEMPTY_STACK 1
  10. #define MONO_SEQ_POINT_FLAG_EXIT_IL 2
  11. #define MONO_SEQ_POINT_FLAG_NESTED_CALL 4
  12. /* IL offsets used to mark the sequence points belonging to method entry/exit events */
  13. #define METHOD_ENTRY_IL_OFFSET -1
  14. #define METHOD_EXIT_IL_OFFSET 0xffffff
  15. #define SEQ_POINT_AOT_EXT ".msym"
  16. /* Native offset used to mark seq points in dead code */
  17. #define SEQ_POINT_NATIVE_OFFSET_DEAD_CODE -1
  18. typedef struct {
  19. int il_offset, native_offset, flags;
  20. /* Offset of indexes of successor sequence points on the compressed buffer */
  21. int next_offset;
  22. /* Number of entries in next */
  23. int next_len;
  24. } SeqPoint;
  25. typedef struct MonoSeqPointInfo {
  26. int dummy [1];
  27. } MonoSeqPointInfo;
  28. typedef struct {
  29. SeqPoint seq_point;
  30. guint8* ptr;
  31. guint8* begin;
  32. guint8* end;
  33. gboolean has_debug_data;
  34. } SeqPointIterator;
  35. void
  36. mono_seq_point_info_free (gpointer info);
  37. gboolean
  38. mono_seq_point_iterator_next (SeqPointIterator* it);
  39. void
  40. mono_seq_point_iterator_init (SeqPointIterator* it, MonoSeqPointInfo* info);
  41. void
  42. mono_seq_point_init_next (MonoSeqPointInfo* info, SeqPoint sp, SeqPoint* next);
  43. int
  44. mono_seq_point_info_write (MonoSeqPointInfo* info, guint8* buffer);
  45. int
  46. mono_seq_point_info_read (MonoSeqPointInfo** info, guint8* buffer, gboolean copy);
  47. int
  48. mono_seq_point_info_get_write_size (MonoSeqPointInfo* info);
  49. gboolean
  50. mono_seq_point_info_add_seq_point (GByteArray* array, SeqPoint *sp, SeqPoint *last_seq_point, GSList *next, gboolean has_debug_data);
  51. MonoSeqPointInfo*
  52. mono_seq_point_info_new (int len, gboolean alloc_data, guint8 *data, gboolean has_debug_data, int *out_size);
  53. gboolean
  54. mono_seq_point_find_prev_by_native_offset (MonoSeqPointInfo* info, int native_offset, SeqPoint* seq_point);
  55. gboolean
  56. mono_seq_point_find_next_by_native_offset (MonoSeqPointInfo* info, int native_offset, SeqPoint* seq_point);
  57. gboolean
  58. mono_seq_point_find_by_il_offset (MonoSeqPointInfo* info, int il_offset, SeqPoint* seq_point);
  59. /*
  60. * SeqPointData struct and functions
  61. * This is used to store/load/use sequence point from a file
  62. */
  63. typedef struct {
  64. guint32 method_token;
  65. guint32 method_index;
  66. MonoSeqPointInfo* seq_points;
  67. gboolean free_seq_points;
  68. } SeqPointDataEntry;
  69. typedef struct {
  70. SeqPointDataEntry* entries;
  71. int entry_count;
  72. int entry_capacity;
  73. } SeqPointData;
  74. void
  75. mono_seq_point_data_init (SeqPointData *data, int entry_capacity);
  76. void
  77. mono_seq_point_data_free (SeqPointData *data);
  78. gboolean
  79. mono_seq_point_data_read (SeqPointData *data, char *path);
  80. gboolean
  81. mono_seq_point_data_write (SeqPointData *data, char *path);
  82. void
  83. mono_seq_point_data_add (SeqPointData *data, guint32 methodToken, guint32 methodIndex, MonoSeqPointInfo* info);
  84. gboolean
  85. mono_seq_point_data_get (SeqPointData *data, guint32 methodToken, guint32 methodIndex, MonoSeqPointInfo** info);
  86. gboolean
  87. mono_seq_point_data_get_il_offset (char *path, guint32 methodToken, guint32 methodIndex, guint32 native_offset, guint32 *il_offset);
  88. #endif /* __MONO_SEQ_POINTS_DATA_H__ */