summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-07-15 22:04:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-07-15 22:04:38 (GMT)
commit293f9f24c6338b5d41dd8f613aefae6be9bdbfcb (patch)
tree2edadc11a52af0a37b89e057fd51bb6ecde834e7 /src/analysis
parentb8ebd9e4d8f90c8ae8860d2a09f619a14c91715e (diff)
Stored several destinations for each line when needed.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@95 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c7
-rw-r--r--src/analysis/line-int.h5
-rw-r--r--src/analysis/line.c26
-rw-r--r--src/analysis/line.h4
4 files changed, 27 insertions, 15 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index c528e96..09b7212 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -698,6 +698,9 @@ void establish_links_in_openida_binary(const openida_binary *binary)
break;
+ case ILT_JUMP_IF_FALSE:
+ break;
+
case ILT_JUMP_IF_TRUE:
target = g_rendering_line_find_by_address(binary->lines, NULL, addr);
@@ -705,11 +708,11 @@ void establish_links_in_openida_binary(const openida_binary *binary)
if (target != NULL)
{
g_rendering_line_link_with(iter, target, type);
- /*
+
target = g_rendering_line_get_next_iter(binary->lines, iter, NULL);
if (target != NULL)
g_rendering_line_link_with(iter, target, ILT_JUMP_IF_FALSE);
- */
+
}
break;
diff --git a/src/analysis/line-int.h b/src/analysis/line-int.h
index cf70695..4d181f9 100644
--- a/src/analysis/line-int.h
+++ b/src/analysis/line-int.h
@@ -54,8 +54,9 @@ struct _GRenderingLine
GRenderingLine **from; /* Origines des références */
size_t from_count; /* Nombre de ces origines */
- GRenderingLine *to; /* Eventuelle ligne visée */
- InstructionLinkType link_type; /* Type de visée */
+ GRenderingLine **to; /* Eventuelles lignes visées */
+ InstructionLinkType *links_type; /* Type des liens de dest. */
+ size_t to_count; /* Nombre de ces destinations */
PangoLayout *layout[MRD_COUNT]; /* Moteur de rendu du code/txt */
diff --git a/src/analysis/line.c b/src/analysis/line.c
index 42b034a..740673a 100644
--- a/src/analysis/line.c
+++ b/src/analysis/line.c
@@ -295,8 +295,14 @@ void g_rendering_line_link_with(GRenderingLine *line, GRenderingLine *dest, Inst
{
g_rendering_line_add_link_reference(dest, line);
- line->to = dest;
- line->link_type = type;
+ line->to_count++;
+
+ line->to = (GRenderingLine **)realloc(line->to, line->to_count * sizeof(GRenderingLine *));
+ line->links_type = (InstructionLinkType *)realloc(line->links_type, line->to_count * sizeof(InstructionLinkType));
+
+ line->to[line->to_count - 1] = dest;
+ line->links_type[line->to_count - 1] = type;
+
}
@@ -332,17 +338,18 @@ bool g_rendering_line_has_sources(const GRenderingLine *line)
* *
******************************************************************************/
-bool g_rendering_line_has_destination(const GRenderingLine *line)
+bool g_rendering_line_has_destinations(const GRenderingLine *line)
{
- return (line->to != NULL && line->link_type != ILT_CALL);
+ return (line->to_count > 1 || (line->to_count == 1 && line->links_type[0] != ILT_CALL));
}
/******************************************************************************
* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* type = type de lien présent. [OUT] *
+* Paramètres : line = ligne dont les informations sont à consulter. *
+* lines = liste des lignes de destination. [OUT] *
+* types = liste des types de liens présents. [OUT] *
* *
* Description : Fournit la ligne de code de destination du lien de la ligne. *
* *
@@ -352,11 +359,12 @@ bool g_rendering_line_has_destination(const GRenderingLine *line)
* *
******************************************************************************/
-GRenderingLine *g_rendering_line_get_destination(const GRenderingLine *line, InstructionLinkType *type)
+size_t g_rendering_line_get_destinations(const GRenderingLine *line, GRenderingLine ***lines, InstructionLinkType **types)
{
- *type = line->link_type;
+ *lines = line->to;
+ *types = line->links_type;
- return line->to;
+ return line->to_count;
}
diff --git a/src/analysis/line.h b/src/analysis/line.h
index 4a293cf..5f22db2 100644
--- a/src/analysis/line.h
+++ b/src/analysis/line.h
@@ -97,10 +97,10 @@ void g_rendering_line_link_with(GRenderingLine *, GRenderingLine *, InstructionL
bool g_rendering_line_has_sources(const GRenderingLine *);
/* Indique si la ligne a une suite autre que la ligne suivante. */
-bool g_rendering_line_has_destination(const GRenderingLine *);
+bool g_rendering_line_has_destinations(const GRenderingLine *);
/* Fournit la ligne de code de destination du lien de la ligne. */
-GRenderingLine *g_rendering_line_get_destination(const GRenderingLine *, InstructionLinkType *);
+size_t g_rendering_line_get_destinations(const GRenderingLine *, GRenderingLine ***, InstructionLinkType **);
/* Procède à l'initialisation des bases d'une représentation. */
void g_rendering_line_draw(GRenderingLine *, GdkDrawable *, GdkGC *, gint, gint, gint, gint, MainRendering);