📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  IDA Pro  >>  Identifying Basic-Blocks

Topic created on: April 13, 2009 06:17 CDT by tobias .

Hi,
i'm working on a IDA-Plugin, and want to extract information about the Basic Blocks, but i cant find anything about BasicBlocks in the plugin writing manual.. is there maybe something similar to the IDAPython-function "is_basic_block_end" ?
-tobias

  gera     April 13, 2009 08:35.51 CDT
Hi,

Not an answer, but to venues to find one:

. get the sourcecode for IDAPython and check how is_basic_block_end() is implemented... and then tell us :) I couldn't find it, it looks like it should be implemented and exported by processor modules. I found it in idp.hpp: http://www.google.com/codesearch/p?hl=en#7okKjql2p0g/INCLUDE/idp.hpp&q=is_basic_block_end

. The other options is to use some heuristics, what I'm currently doing in idc for a very stupid HotKey I implemented is:


static findBBEnd(ea) {
   auto bb, first;
   bb = ea;

   while (1) {
      first = Rfirst(bb);
      if (first == BADADDR) break;  /* instruction with no flow (RET) */
      if (Rnext(bb, first) != BADADDR) break; /* instruction with more than flow */
      if (GetMnem(bb) == "call") break; /* we also force stopping on indirect calls call */
      bb = Rfirst(bb);
   }

   return bb;
}


This small function will find the end of the BasicBlock, however, although it can be used as base, it considers BB ends different than what's shown in the graph. It considers a call a BB end, and it does not consider a single outgoing arrow to be a BB end.

  dimaky     April 13, 2009 15:30.31 CDT
Actually, as far as I know, there is a function is_basic_block_end in ida sdk. You can find its prototype in idp.hpp. But if you just need basic blocks information for a single routine you may consider using qflow_chart_t class which gathers all the blocks for you.

  tobias     April 16, 2009 18:29.04 CDT
hi,
thanks, that helped me a lot!

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit