MCPcopy Create free account
hub / github.com/anjo76/angelscript / LineCallback

Method LineCallback

sdk/add_on/debugger/debugger.cpp:166–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void CDebugger::LineCallback(asIScriptContext *ctx)
167{
168 assert( ctx );
169
170 // This should never happen, but it doesn't hurt to validate it
171 if( ctx == 0 )
172 return;
173
174 // By default we ignore callbacks when the context is not active.
175 // An application might override this to for example disconnect the
176 // debugger as the execution finished.
177 if( ctx->GetState() != asEXECUTION_ACTIVE )
178 return;
179
180 if( m_action == CONTINUE )
181 {
182 if( !CheckBreakPoint(ctx) )
183 return;
184 }
185 else if( m_action == STEP_OVER )
186 {
187 if( ctx->GetCallstackSize() > m_lastCommandAtStackLevel )
188 {
189 if( !CheckBreakPoint(ctx) )
190 return;
191 }
192 }
193 else if( m_action == STEP_OUT )
194 {
195 if( ctx->GetCallstackSize() >= m_lastCommandAtStackLevel )
196 {
197 if( !CheckBreakPoint(ctx) )
198 return;
199 }
200 }
201 else if( m_action == STEP_INTO )
202 {
203 CheckBreakPoint(ctx);
204
205 // Always break, but we call the check break point anyway
206 // to tell user when break point has been reached
207 }
208
209 stringstream s;
210 const char *file = 0;
211 int lineNbr = ctx->GetLineNumber(0, 0, &file);
212 s << (file ? file : "{unnamed}") << ":" << lineNbr << "; " << ctx->GetFunction()->GetDeclaration() << endl;
213 Output(s.str());
214
215 TakeCommands(ctx);
216}
217
218bool CDebugger::CheckBreakPoint(asIScriptContext *ctx)
219{

Callers

nothing calls this directly

Calls 6

GetStateMethod · 0.80
GetCallstackSizeMethod · 0.80
GetDeclarationMethod · 0.80
strMethod · 0.80
GetLineNumberMethod · 0.45
GetFunctionMethod · 0.45

Tested by

no test coverage detected