00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef HTANALY_H
00022 #define HTANALY_H
00023
00024 #include "analy.h"
00025 #include "cmds.h"
00026 #include "global.h"
00027 #include "htdialog.h"
00028 #include "htformat.h"
00029 #include "httree.h"
00030 #include "out.h"
00031
00032
00033
00034
00035
00036 #define cmd_analyser_call_assembler HT_COMMAND(501)
00037 #define cmd_analyser_this_function HT_COMMAND(502)
00038 #define cmd_analyser_previous_label HT_COMMAND(503)
00039 #define cmd_analyser_continue HT_COMMAND(504)
00040 #define cmd_analyser_comments HT_COMMAND(505)
00041 #define cmd_analyser_name_addr HT_COMMAND(506)
00042 #define cmd_analyser_xrefs HT_COMMAND(507)
00043 #define cmd_analyser_follow HT_COMMAND(508)
00044 #define cmd_analyser_follow_ex HT_COMMAND(509)
00045 #define cmd_analyser_pause_resume HT_COMMAND(510)
00046 #define cmd_analyser_del_addr_bindings HT_COMMAND(511)
00047 #define cmd_analyser_call_chain HT_COMMAND(512)
00048 #define cmd_analyser_generate_output HT_COMMAND(513)
00049 #define cmd_analyser_data_string HT_COMMAND(514)
00050 #define cmd_analyser_info HT_COMMAND(515)
00051 #define cmd_analyser_symbols HT_COMMAND(516)
00052 #define cmd_analyser_export_file HT_COMMAND(517)
00053
00054
00055
00056 #define cmd_analyser_srt HT_COMMAND(550)
00057
00058 class ht_aviewer;
00059
00060
00061
00062
00063
00064 class AnalyserInformation: public ht_statictext {
00065 ht_aviewer *analy;
00066 char buf[1024];
00067 int addrs, labels;
00068 const char *aname, *atype, *adis;
00069 public:
00070 void init(bounds *b, ht_aviewer *a);
00071 virtual void done();
00072 virtual char *gettext();
00073 virtual bool idle();
00074 };
00075
00076
00077
00078
00079 class SymbolBox: public ht_listbox {
00080 public:
00081 Analyser *analy;
00082 char *str;
00083 int idle_count;
00084 int symbols;
00085
00086 void init(bounds *b, Analyser *Analy);
00087 virtual void done();
00088 virtual int calcCount();
00089 virtual int cursorAdjust();
00090 virtual int estimateEntryPos(void *entry);
00091 virtual void * getFirst();
00092 virtual void * getLast();
00093 virtual void * getNext(void *entry);
00094 virtual void * getPrev(void *entry);
00095 virtual char * getStr(int col, void *entry);
00096 virtual bool idle();
00097 virtual int numColumns();
00098 virtual void * quickfind(char *s);
00099 virtual char * quickfindCompletition(char *s);
00100 };
00101
00102 struct CallChainNode {
00103 CallChainNode *next, *prev, *child;
00104 bool examined;
00105 Address *xa;
00106 Address *fa;
00107 Location *faddr;
00108 bool expanded;
00109 };
00110
00111 class CallChain: public ht_treeview {
00112 Analyser *analy;
00113 CallChainNode *root;
00114 public:
00115 void init(bounds *b, Analyser *analy, Address *a, char *desc);
00116 virtual void done();
00117 virtual void adjust(void *node, bool expand);
00118 virtual void *get_child(void *node, int i);
00119 virtual void *get_next_node(void *node);
00120 virtual void *get_prev_node(void *node);
00121 virtual void *get_root();
00122 virtual char *get_text(void *node);
00123 virtual bool has_children(void *node);
00124 virtual bool is_expanded(void *node);
00125 virtual void select_node(void *node);
00126 private:
00127 CallChainNode *createNode(Address *a);
00128 void examineNode(CallChainNode *n);
00129 };
00130
00131
00132
00133 #define ANALY_STATUS_DEFAULT "<%s> @%O %u\n%f"
00134 #define ANALY_STATUS_ARG_SECTION 's'
00135 #define ANALY_STATUS_ARG_FILEOFFSET 'O'
00136 #define ANALY_STATUS_ARG_RAW_UNASM 'u'
00137 #define ANALY_STATUS_ARG_FUNCTION 'f'
00138 #define ANALY_STATUS_ARG_OFFSET 'o'
00139
00140 class AnalyInfoline: public ht_statictext {
00141 public:
00142 ht_aviewer *analy;
00143 char *s;
00144 FILEOFS fofs;
00145 Address *addr;
00146 char *displayformat;
00147 void init(bounds *b, ht_aviewer *A, char *Format);
00148 virtual void done();
00149 virtual char *gettext();
00150 void update(Address *cursor_addr, FILEOFS ecursor_addr);
00151 bool valid();
00152 };
00153
00154
00155
00156
00157
00158 class ht_aviewer;
00159 class ht_analy_sub: public ht_sub {
00160 public:
00161 Analyser *analy;
00162 Address *lowestaddress, *highestaddress;
00163 AnalyserOutput *output;
00164 ht_aviewer *aviewer;
00165
00166 void init(ht_streamfile *file, ht_aviewer *A, Analyser *analyser, Address *Lowestaddress, Address *Highestaddress);
00167 virtual void done();
00168 virtual bool convert_ofs_to_id(const FILEOFS offset, LINE_ID *line_id);
00169 virtual bool closest_line_id(LINE_ID *line_id);
00170 virtual void first_line_id(LINE_ID *line_id);
00171 virtual bool getline(char *line, const LINE_ID line_id);
00172 virtual void last_line_id(LINE_ID *line_id);
00173 virtual int next_line_id(LINE_ID *line_id, int n);
00174 virtual int prev_line_id(LINE_ID *line_id, int n);
00175 void setAnalyser(Analyser *Analy);
00176 virtual ht_search_result *search(ht_search_request *search, FILEOFS start, FILEOFS end);
00177 };
00178
00179
00180
00181
00182
00183 class ht_aviewer: public ht_uformat_viewer {
00184 public:
00185 int idle_count;
00186 Analyser *analy;
00187 int last_active;
00188 AnalyInfoline *infoline;
00189 ht_analy_sub *analy_sub;
00190 bool one_load_hack;
00191 bool pause;
00192 void init(bounds *b, char *desc, int caps, ht_streamfile *file, ht_format_group *format_group, Analyser *Analy);
00193 virtual void done();
00194 bool convertAddressToViewerPos(Address *a, viewer_pos *p);
00195 bool convertViewerPosToAddress(const viewer_pos &p, Address **a);
00196 void attachInfoline(AnalyInfoline *V);
00197 bool canCreateAddress(Address *addr, bool error_msg);
00198 void dataStringDialog();
00199 void exportFileDialog();
00200 virtual char *func(UINT i, bool execute);
00201 void generateOutputDialog();
00202 bool getCurrentAddress(Address **a);
00203 virtual bool get_current_offset(FILEOFS *ofs);
00204 virtual void get_pindicator_str(char *buf);
00205 virtual bool get_hscrollbar_pos(int *pstart, int *psize);
00206 bool gotoAddress(Address *a, ht_view *source_object);
00207 virtual void handlemsg(htmsg *msg);
00208 virtual bool idle();
00209 virtual bool offset_to_pos(FILEOFS ofs, viewer_pos *p);
00210 virtual bool pos_to_offset(viewer_pos p, FILEOFS *ofs);
00211 bool pos_to_string(viewer_pos p, char *result, int maxlen);
00212 virtual int ref_sel(LINE_ID *id);
00213 virtual void reloadpalette();
00214 virtual void setAnalyser(Analyser *a) = 0;
00215 void showCallChain(Address *addr);
00216 void showComments(Address *addr);
00217 void showInfo(Address *addr);
00218 void showSymbols(Address *addr);
00219 void showXRefs(Address *addr);
00220 void searchForXRefs(Address *addr);
00221 virtual bool qword_to_pos(qword q, viewer_pos *p);
00222 virtual int func_handler(eval_scalar *result, char *name, eval_scalarlist *params);
00223 virtual int symbol_handler(eval_scalar *result, char *name);
00224 };
00225
00226 #endif