summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/gbufferline.c56
-rw-r--r--src/glibext/gbufferline.h2
2 files changed, 32 insertions, 26 deletions
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c
index f47442d..65e73d0 100644
--- a/src/glibext/gbufferline.c
+++ b/src/glibext/gbufferline.c
@@ -814,7 +814,7 @@ void g_buffer_line_fill_mrange(GBufferLine *line, MemoryDataSize psize, MemoryDa
* psize = taille souhaitée de l'impression des positions. *
* vsize = taille souhaitée de l'impression des adresses. *
* content = contenu binaire global à venir lire. *
-* full = la portion est assez courte pour être entière ? *
+* max = taille maximal de la portion binaire en octets. *
* *
* Description : Construit le tronc commun d'une ligne d'instruction. *
* *
@@ -824,9 +824,10 @@ void g_buffer_line_fill_mrange(GBufferLine *line, MemoryDataSize psize, MemoryDa
* *
******************************************************************************/
-void g_buffer_line_fill_for_instr(GBufferLine *line, MemoryDataSize psize, MemoryDataSize vsize, const GBinContent *content, bool full)
+void g_buffer_line_fill_for_instr(GBufferLine *line, MemoryDataSize psize, MemoryDataSize vsize, const GBinContent *content, phys_t max)
{
phys_t length; /* Taille de la couverture */
+ bool truncated; /* Indique si le code est coupé*/
size_t required; /* Taille de traitement requise*/
char static_buffer[64]; /* Petit tampon local rapide */
char *bin_code; /* Tampon utilisé pour le code */
@@ -846,7 +847,15 @@ void g_buffer_line_fill_for_instr(GBufferLine *line, MemoryDataSize psize, Memor
length = get_mrange_length(&line->range);
- required = length * 3 + 3;
+ truncated = (max != VMPA_NO_PHYSICAL && length > max);
+
+ if (truncated)
+ {
+ length = max;
+ required = length * 3 + 4 /* "..." */ + 1;
+ }
+ else
+ required = length * 3 + 1;
if (required <= sizeof(static_buffer))
bin_code = static_buffer;
@@ -859,40 +868,37 @@ void g_buffer_line_fill_for_instr(GBufferLine *line, MemoryDataSize psize, Memor
for (i = 0, iter = bin_code; i < length; i++, iter += ret)
{
- if (!g_binary_content_read_u8(content, &pos, &byte))
- {
- iter[0] = '?';
- iter[1] = '?';
- }
+ if (i == 0)
+ ret = 0;
else
{
- iter[0] = charset[byte >> 4];
- iter[1] = charset[byte & 0x0f];
+ iter[0] = ' ';
+ ret = 1;
}
- if ((i + 1) < length)
+ if (!g_binary_content_read_u8(content, &pos, &byte))
{
- iter[2] = ' ';
- ret = 3;
+ iter[ret + 0] = '?';
+ iter[ret + 1] = '?';
}
-
else
{
- if (full)
- {
- iter[2] = '\0';
- ret = 2;
- }
- else
- {
- strcpy(iter + 2, "...");
- ret = 5;
- }
-
+ iter[ret + 0] = charset[byte >> 4];
+ iter[ret + 1] = charset[byte & 0x0f];
}
+ ret += 2;
+
}
+ if (truncated)
+ {
+ strcpy(iter, "...");
+ iter += 3;
+ }
+ else
+ *iter = '\0';
+
/* Conclusion */
g_buffer_line_insert_text(line, BLC_BINARY, bin_code, iter - bin_code, RTT_RAW_CODE);
diff --git a/src/glibext/gbufferline.h b/src/glibext/gbufferline.h
index 89313be..e4c2da5 100644
--- a/src/glibext/gbufferline.h
+++ b/src/glibext/gbufferline.h
@@ -112,7 +112,7 @@ const mrange_t *g_buffer_line_get_range(const GBufferLine *);
void g_buffer_line_fill_mrange(GBufferLine *, MemoryDataSize, MemoryDataSize);
/* Construit le tronc commun d'une ligne d'instruction. */
-void g_buffer_line_fill_for_instr(GBufferLine *, MemoryDataSize, MemoryDataSize, const GBinContent *, bool);
+void g_buffer_line_fill_for_instr(GBufferLine *, MemoryDataSize, MemoryDataSize, const GBinContent *, phys_t);
/* Donne le segment présent à une abscisse donnée. */
GBufferSegment *g_buffer_line_get_segment_at(const GBufferLine *, const gint [BLC_COUNT], const bool *, gint *, gint *, GdkScrollDirection, bool);