Dwarf cfa expression evaluation - dwarf

I am using dwarfdump -fF to dump the FDE information and the output looks like this:
fde:
< 0><0x00026000:0x00026310><><fde offset 0x00000018 length: 0x00000024><eh aug data len 0x0>
0x00026000: <off cfa=16(r7) > <off r16=-8(cfa) >
0x00026006: <off cfa=24(r7) > <off r16=-8(cfa) >
0x00026010: <expr cfa=expr-block-len=11> <off r16=-8(cfa) >
I don't understand what expr cfa=expr-block-len=11 mean and how to evaluate this expression?
Thanks,

Related

(ComputerCraft) (minecraft version 1.7.10) (question) Make a language file reader

I'd like to make a language reader for my operating system, but I cant find anything that helps me.
I want to put the list into my other script.
Heres the de-de language file (location: /os/bin/):
de = {
Menu = "Menü",
Shutdown = "Ausschalten",
MenuLength = 4,
ShutdownLength = 11
}
Can anyone help me please?
The gsub() string function/method can do that with your translation table.
You only have to use your language table for that.
Example...
# /usr/bin/lua
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
> de = {
>> Menu = "Menü",
>> Shutdown = "Ausschalten",
>> MenuLength = 4,
>> ShutdownLength = 11
>> }
> language = de
> print(('Menu Shutdown'):gsub('(%g+)', language))
Menü Ausschalten 2
If you have to use Lua 5.1 then use %w...
# /bin/lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> de = {
>> Menu = "Menü",
>> Shutdown = "Ausschalten",
>> MenuLength = 4,
>> ShutdownLength = 11
>> }
> language = de
> print(('Menu Shutdown'):gsub('(%w+)', language))
Menü Ausschalten 2
The length can be measured with the len() function/method...
> print(('Shutdown'):gsub('(%w+)', language):len())
11
> print(('Menu'):gsub('(%w+)', language):len())
5
As you can see in Lua the Umlaut ü is measured different.
To include your de-de.lua i suggest dofile() that loads it with your specific path...
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> dofile('/os/bin/de-de.lua') -- But read comment about security
> print(de['Menu'])
Menü
Try to convert the special words with german Umlaut into its byte representation.
And put the bytes into your translation table...
$ lua
Lua 5.4.3 Copyright (C) 1994-2021 Lua.org, PUC-Rio
> print(('Menü'):byte(1,-1))
77 101 110 195 188
> print('\77\101\110\195\188')
Menü
> de = {Menu = '\77\101\110\195\188'}
> print(('Menu'):gsub('%g+', de))
Menü 1
...or for Lua 5.1...
$ /bin/lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print(('Menü'):byte(1, -1))
77 101 110 195 188
> print('\77\101\110\195\188')
Menü
> de = {Menu = '\77\101\110\195\188'}
> print(('Menu'):gsub('%w+', de))
Menü 1
You also can mix it.
And here are the bytes for: üäößÜÄÖ
> print(('üäößÜÄÖ'):byte(1, -1))
195 188 195 164 195 182 195 159 195 156 195 132 195 150
> de = {Menu = 'Men\195\188', Umlaute = '\195\188\195\164\195\182\195\159\195\156\195\132\195\150'}
> print(('Menu Umlaute'):gsub('%w+', de))
Menü üäößÜÄÖ 2

unmapped reads using bwa

i'm trying to use BWA MEM to align some WGS files, but i notice something strange.
When I used samtools flagstat to check these .bam files, I notice that most reads were unmapped.
76124692 + 0 in total (QC-passed reads + QC-failed reads)
308 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
708109 + 0 mapped (0.93% : N/A)
76124384 + 0 paired in sequencing
38062192 + 0 read1
38062192 + 0 read2
0 + 0 properly paired (0.00% : N/A)
12806 + 0 with itself and mate mapped
694995 + 0 singletons (0.91% : N/A)
11012 + 0 with mate mapped to a different chr
1682 + 0 with mate mapped to a different chr (mapQ>=5)
Previously, I used Samtofastq to convert my .bam file to .fastq. When I head this file, this is shown:
#SRR1513845.100000000/1
AACGAAACGAAAAGAAAAGAAAAGAAAGAAAAAGAAAGGAACAGAAAAG
+
AAA?=>'2&)&)&&))2(-'(,.%)&31%%'6/6,(1,501046124&6
#SRR1513845.100000000/2
AATTAATTAAGCCCCGAAGGAAGCGAGAAACACTG
+
AAA?B=AB#A#A=?A>AA#?.#?8<.1;><*17?<
#SRR1513845.100000001/1
TATAACCATATAACAAATCCAAGCCCAACAGAGAAGAGAAACAAAAAGA
+
>27<#>&856;.'.&9.%>%::-5194&:+'5);;%1&'/%%999%5(8
#SRR1513845.100000001/2
TCCAACTGATATCGTAATT
+
#3<#A>:8;?:383>=3:=
#SRR1513845.100000003/1
TATCGGTCTTGTTTAG
+
=1;=6?(4>4A13?0A
#SRR1513845.100000003/2
TTCAGGTGCCTCGAAGTTGGATAAGG
+
==>>9#;?3<A5>7);)<9-<25<9?
#SRR1513845.100000004/1
GTCATTTAGCCCAAGAGAATGGC
+
BB#ABA##A?</A>>25A;#4:5
#SRR1513845.100000004/2
GGAGATCGAGTCAAATTTTATGCTAGGTAT
+
%A:<#7A##=4AA?7<A5>#;3&?>>:;:>
#SRR1513845.100000012/1
GCGTCGTTATCCAAAA
+
>A:9:?88=<=0&>>9
#SRR1513845.100000012/2
TGGAAATATTTATTACCCCCCCCCCCCCCCCCCCCCCCCCC
+
A;>#A;4;=??8=:#;-4<?632;=:67;>=):9>9%88=9
#SRR1513845.100000016/1
CGTGGAATGGGGTGTGATTTAATTATCGAATGGCGTCCGATCCAGATT
These characters (<.#;:) are normal and influence in bwa's alignment?
Here is my bwa code:
bwa mem -M -t 38 -p hsa_GRCh38.fa SRR1513_fastqtosam.fq -o SRRR1513_aligned.bam
and my samtofastq code
java -Xmx8G -jar picard.jar SamToFastq \
I= SRR1513_fastqtosam.bam \
FASTQ= SRR1513_fastqtosam.fq \
CLIPPING_ATTRIBUTE=XT \
CLIPPING_ACTION=2 \
INTERLEAVE=true \
NON_PF=true TMP_DIR=./temp
I'm stuck in this from a few hours.
Thanks in advance!
UPDATE:
I just notice a flag during bwa mem alignment
[M::mem_pestat] skip orientation FF as there are not enough pairs
[M::mem_pestat] skip orientation RF as there are not enough pairs
[M::mem_pestat] skip orientation FR as there are not enough pairs
[M::mem_pestat] skip orientation RR as there are not enough pairs

ctags: To get C function end line number

is it possible via ctags to get the function end line number as well
"ctags -x --c-kinds=f filename.c"
Above command lists the function definition start line-numbers. Wanted a way to get the function end line numbers.
Other Approaches:
awk 'NR > first && /^}$/ { print NR; exit }' first=$FIRST_LINE filename.c
This needs the code to be properly formatted
Example:
filename.c
1 #include<stdio.h>
2 #include<stdlib.h>
3 int main()
4 {
5 const char *name;
6
7 int a=0
8 printf("name");
9 printf("sssss: %s",name);
10
11 return 0;
12 }
13
14 void code()
15 {
16 printf("Code \n");
17 }
18
19 int code2()
20 {
21 printf("code2 \n");
22 return 1
23 }
24
Input: filename and the function start line no.
Example:
Input: filename.c 3
Output: 12
Input : filename.c 19
Output : 23
Is there any better/simple way of doing this ?
C/C++ parser of Universal-ctags(https://ctags.io) has end: field.
jet#localhost tmp]$ cat -n foo.c
1 int
2 main( void )
3 {
4
5 }
6
7 int
8 bar (void)
9 {
10
11 }
12
13 struct x {
14 int y;
15 };
16
[jet#localhost tmp]$ ~/var/ctags/ctags --fields=+ne -o - --sort=no foo.c
main foo.c /^main( void )$/;" f line:2 typeref:typename:int end:5
bar foo.c /^bar (void)$/;" f line:8 typeref:typename:int end:11
x foo.c /^struct x {$/;" s line:13 file: end:15
y foo.c /^ int y;$/;" m line:14 struct:x typeref:typename:int file:
awk to the rescue!
doesn't handle curly braces within comments but should handle blocks within functions, please give it a try...
$ awk -v s=3 'NR>=s && /{/ {c++}
NR>=s && /}/ && c && !--c {print NR; exit}' file
finds the matching brace for the first one after the specified start line number s.

esp8266 RTOS blink example doesn't work

I have a problem with the RTOS firmware on the esp8266 (I have a esp12e), after flashing the firmware, reading from uart, it keeps stuck with those lines:
ets Jan 8 2013,rst cause:2, boot mode:(3,0)
load 0x40100000, len 31584, room 16
tail 0
chksum 0x24
load 0x3ffe8000, len 944, room 8
tail 8
chksum 0x9e
load 0x3ffe83b0, len 1080, room 0
tail 8
chksum 0x60
csum 0x60
Now I will explain my HW setup:
GPIO15 -> Gnd
EN -> Vcc
GPIO0 -> Gnd (when flashing)
GPIO0 -> Vcc (normal mode)
For the toolchain I've followed this tutorial and it works well:
http://microcontrollerkits.blogspot.it/2015/12/esp8266-eclipse-development.html
Then I started doing my RTOS blink example, I post my user_main.c code here:
#include "esp_common.h"
#include "gpio.h"
void task2(void *pvParameters)
{
printf("Hello, welcome to client!\r\n");
while(1)
{
// Delay and turn on
vTaskDelay (300/portTICK_RATE_MS);
GPIO_OUTPUT_SET (5, 1);
// Delay and LED off
vTaskDelay (300/portTICK_RATE_MS);
GPIO_OUTPUT_SET (5, 0);
}
}
/******************************************************************************
* FunctionName : user_rf_cal_sector_set
* Description : SDK just reversed 4 sectors, used for rf init data and paramters.
* We add this function to force users to set rf cal sector, since
* we don't know which sector is free in user's application.
* sector map for last several sectors : ABCCC
* A : rf cal
* B : rf init data
* C : sdk parameters
* Parameters : none
* Returns : rf cal sector
*******************************************************************************/
uint32 user_rf_cal_sector_set(void)
{
flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:
rf_cal_sec = 128 - 5;
break;
case FLASH_SIZE_8M_MAP_512_512:
rf_cal_sec = 256 - 5;
break;
case FLASH_SIZE_16M_MAP_512_512:
case FLASH_SIZE_16M_MAP_1024_1024:
rf_cal_sec = 512 - 5;
break;
case FLASH_SIZE_32M_MAP_512_512:
case FLASH_SIZE_32M_MAP_1024_1024:
rf_cal_sec = 1024 - 5;
break;
default:
rf_cal_sec = 0;
break;
}
return rf_cal_sec;
}
/******************************************************************************
* FunctionName : user_init
* Description : entry of user application, init user function here
* Parameters : none
* Returns : none
*******************************************************************************/
void user_init(void)
{
uart_init_new();
printf("SDK version:%s\n", system_get_sdk_version());
// Config pin as GPIO5
PIN_FUNC_SELECT (PERIPHS_IO_MUX_GPIO5_U, FUNC_GPIO5);
xTaskCreate(task2, "tsk2", 256, NULL, 2, NULL);
}
I also post the flash command, the first executed one time, the second every time I modify the code:
c:/Espressif/utils/ESP8266/esptool.exe -p COM3 write_flash -ff 40m -fm qio -fs 32m 0x3FC000 c:/Espressif/ESP8266_RTOS_SDK/bin/esp_init_data_default.bin 0x3FE000 c:/Espressif/ESP8266_RTOS_SDK/bin/blank.bin 0x7E000 c:/Espressif/ESP8266_RTOS_SDK/bin/blank.bin
c:/Espressif/utils/ESP8266/esptool.exe -p COM3 -b 256000 write_flash -ff 40m -fm qio -fs 32m 0x00000 firmware/eagle.flash.bin 0x40000 firmware/eagle.irom0text.bin
There is something wrong? I really don't understand why it doesn't work.
When I try the NON-OS example they works very well.
I had the same problem as you. This issue is caused by the incorrect address of the eagle.irom0text.bin .
So I changed the address of the eagle.irom0text.bin from 0x40000 (0x10000) to 0x20000 and it worked well for me.
[RTOS SDK version: 1.4.2(f57d61a)]
The correct flash codes in the common_rtos.mk (ESP-12E)
for flashinit
flashinit:
$(vecho) "Flash init data default and blank data."
$(ESPTOOL) -p $(ESPPORT) write_flash $(flashimageoptions) 0x3fc000 $(SDK_BASE)/bin/esp_init_data_default.bin
$(ESPTOOL) -p $(ESPPORT) write_flash $(flashimageoptions) 0x3fe000 $(SDK_BASE)/bin/blank.bin
for flash:
flash: all
#ifeq ($(app), 0)
$(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(flashimageoptions) 0x00000 $(FW_BASE)/eagle.flash.bin 0x20000 $(FW_BASE)/eagle.irom0text.bin
else
ifeq ($(boot), none)
$(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(flashimageoptions) 0x00000 $(FW_BASE)/eagle.flash.bin 0x20000 $(FW_BASE)/eagle.irom0text.bin
else
$(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(flashimageoptions) $(addr) $(FW_BASE)/upgrade/$(BIN_NAME).bin
endif
endif

I have inserted an image into pdf digital signature layer n2 using mupdf, but it not showed up

I am using mupdf(git clone at commit 2014/3/5 4:05) to sign a pdf.
And I've already succeeded to sign a digital signature in pdf with function 'pdf_sign_signature'.
Now I'm trying to insert an image into layer n2 of that signature when I'm signing it.
There's a function called 'pdf_set_signature_appearance' in '/source/pdf/pdf-appearance.c'.
I try to add codes below to insert the image:
image_doc = (image_document *)fz_open_document(ctx, jpgFilePathAndName);
fz_fill_image(dev, image_doc->image, page_ctm, 1.0f);
these codes are inserted between:
rect = annot->rect;
rect.x0 = (rect.x0 + rect.x1)/2.0f;
text = fit_text(ctx, &font_rec, (char *)bufstr, &rect);
fz_fill_text(dev, text, page_ctm, cs, font_rec.da_rec.col, 1.0f);
and
rect = annot->rect;
fz_transform_rect(&rect, page_ctm);
pdf_set_annot_appearance(doc, annot, &rect, dlist);
After executing, I got a pdf file like this:
%PDF-1.4
%μῦ
1 0 obj
<<
/Type /Font
/BaseFont /Helvetica
/Subtype /Type1
/Encoding /WinAnsiEncoding
>>
endobj
2 0 obj
<<
/Length 63
>>
stream
q
BT
36 806 Td
0 -18 Td
/F1 12 Tf
(Hello World!)Tj
0 0 Td
ET
Q
endstream
endobj
3 0 obj
<<
/Count 1
/Type /Pages
/ITXT (5.3.0)
/Kids [ 4 0 R ]
>>
endobj
4 0 obj
<<
/Annots 10 0 R
/Contents 2 0 R
/MediaBox [ 0 0 595 842 ]
/Parent 3 0 R
/Resources <<
/Font <<
/F1 1 0 R
>>
/ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>>
/Type /Page
>>
endobj
5 0 obj
<<
/AcroForm 8 0 R
/Metadata 9 0 R
/Pages 3 0 R
/Type /Catalog
>>
endobj
6 0 obj
<<
/CreationDate (D:20120620091727+02'00')
/ModDate (D:20120804153425+02'00')
/Producer (iText\256 5.3.0 \2512000-2012 1T3XT BVBA)
>>
endobj
7 0 obj
<<
/AP <<
/N 17 0 R
>>
/DA (/Helv 0 Tf 0 g)
/F 4
/FT /Sig
/MK <<
>>
/P 4 0 R
/Rect [ 41.3670998 713.710022 237.352997 781.257996 ]
/Subtype /Widget
/T (Signature1)
/Type /Annot
/V 15 0 R
>>
endobj
8 0 obj
<<
/DA (/Helv 0 Tf 0 g )
/DR <<
/Encoding <<
/PDFDocEncoding 14 0 R
>>
/Font <<
/Helv 12 0 R
/ZaDb 13 0 R
>>
/XObject <<
/DSz 11 0 R
>>
>>
/Fields [ 7 0 R ]
/SigFlags 1
>>
endobj
9 0 obj
<<
/Length 3304
/Subtype /XML
/Type /Metadata
>>
stream
<?xpacket begin="Ôªø" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreateDate>2012-06-20T09:17:27+02:00</xmp:CreateDate>
<xmp:ModifyDate>2012-08-04T15:34:25+02:00</xmp:ModifyDate>
<xmp:MetadataDate>2012-08-04T15:34:25+02:00</xmp:MetadataDate>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
<pdf:Producer>iText® 5.3.0 ©2000-2012 1T3XT BVBA</pdf:Producer>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>application/pdf</dc:format>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
<xmpMM:DocumentID>uuid:547fb234-f327-4f3d-8dd1-7b7ea87df336</xmpMM:DocumentID>
<xmpMM:InstanceID>uuid:72437fbf-7b45-4062-98f1-2b53d3ad86d0</xmpMM:InstanceID>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>endstream
endobj
10 0 obj
[ 7 0 R ]
endobj
11 0 obj
<<
/BBox [ 41.3670998 713.710022 237.352997 781.257996 ]
/Length 67
/Resources <<
/XObject <<
/Img0 16 0 R
>>
>>
/Subtype /Form
/Type /XObject
/Matrix [ 1 0 0 1 0 0 ]
>>
stream
1.000000 0.000000 0.000000 -1.000000 0.000000 1.000000 cm
/Img0 Do
endstream
endobj
12 0 obj
<<
/BaseFont /Helvetica
/Encoding 14 0 R
/Name /Helv
/Subtype /Type1
/Type /Font
>>
endobj
13 0 obj
<<
/BaseFont /ZapfDingbats
/Name /ZaDb
/Subtype /Type1
/Type /Font
>>
endobj
14 0 obj
<<
/Differences [ 24 /breve /caron /circumflex /dotaccent /hungarumlaut
/ogonek /ring /tilde 39 /quotesingle 96 /grave 128 /bullet
/dagger /daggerdbl /ellipsis /emdash /endash /florin /fraction
/guilsinglleft /guilsinglright /minus /perthousand /quotedblbase
/quotedblleft /quotedblright /quoteleft /quoteright /quotesinglbase
/trademark /fi /fl /Lslash /OE /Scaron /Ydieresis /Zcaron
/dotlessi /lslash /oe /scaron /zcaron 160 /Euro 164 /currency
166 /brokenbar 168 /dieresis /copyright /ordfeminine 172
/logicalnot /.notdef /registered /macron /degree /plusminus
/twosuperior /threesuperior /acute /mu 183 /periodcentered
/cedilla /onesuperior /ordmasculine 188 /onequarter /onehalf
/threequarters 192 /Agrave /Aacute /Acircumflex /Atilde /Adieresis
/Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis
/Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve
/Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash
/Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae
/ccedilla /egrave /eacute /ecircumflex /edieresis /igrave
/iacute /icircumflex /idieresis /eth /ntilde /ograve /oacute
/ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute
/ucircumflex /udieresis /yacute /thorn /ydieresis ]
/Type /Encoding
>>
endobj
15 0 obj
<<
/ByteRange[0 6712 10814 12756] /Contents
...
/Filter /Adobe.PPKLite
/SubFilter /adbe.pkcs7.detached
>>
endobj
16 0 obj
<<
/Type /XObject
/Subtype /Image
/Width 400
/Height 332
/ColorSpace /DeviceRGB
/BitsPerComponent 8
/Length 11097
>>
stream
...
endstream
endobj
17 0 obj
<<
/BBox [ 41.3670998 713.710022 237.352997 781.257996 ]
/FormType 1
/Length 7
/Matrix [ 1 0 0 1 0 0 ]
/Resources <<
/ProcSet [ /PDF /Text ]
/XObject <<
/FRM 18 0 R
>>
>>
/Subtype /Form
/Type /XObject
>>
stream
/FRM Doendstream
endobj
18 0 obj
<<
/BBox [ 41.3670998 713.710022 237.352997 781.257996 ]
/FormType 1
/Length 51
/Matrix [ 1 0 0 1 0 0 ]
/Resources <<
/ProcSet [ /PDF /Text ]
/XObject <<
/n0 19 0 R
/n2 11 0 R
>>
>>
/Subtype /Form
/Type /XObject
>>
stream
q 1 0 0 1 0 0 cm /n0 Do Q q 1 0 0 1 0 0 cm /n2 Do Qendstream
endobj
19 0 obj
<<
/BBox [ 41.3670998 713.710022 237.352997 781.257996 ]
/FormType 1
/Length 9
/Matrix [ 1 0 0 1 0 0 ]
/Resources <<
/ProcSet [ /PDF /Text ]
>>
/Subtype /Form
/Type /XObject
>>
stream
% DSBlankendstream
endobj
xref
0 20
0000000000 65536 f
0000000017 00000 n
0000000123 00000 n
0000000238 00000 n
0000000320 00000 n
0000000544 00000 n
0000000634 00000 n
0000000790 00000 n
0000001026 00000 n
0000001272 00000 n
0000004664 00000 n
0000004691 00000 n
0000004990 00000 n
0000005101 00000 n
0000005196 00000 n
0000006628 00000 n
0000010882 00000 n
0000022144 00000 n
0000022423 00000 n
0000022763 00000 n
trailer
<<
/Size 20
/Info 6 0 R
/Root 5 0 R
/ID [ <D0151A7ADF2410CF3E72A04B9CB83452> <FA2030FCC5A66742887F23E51DEC5875> ]
>>
startxref
23003
%%EOF
It seems to be correct, since there's /n2 11 0 R in 18 0 obj and /Img0 16 0 R in 11 0 obj and 16 0 obj looks like a well-formed Image XObject.
But the image doesn't show up when I using pdf reader to open this pdf.
Could someone please give me a clue about what's wrong with this pdf file, and how to insert the image correctly.
Thanks a lot.
ps.
signed_with_image_only.pdf
signed_with_text_and_image.pdf
signed_with_image_only.pdf is the pdf I've added '\n' before 'endstream'. You can see image doesn't show up in the form which is below 'Hello World!'.
signed_with_text_and_image.pdf is pretty much the same as signed_with_image_only.pdf, but I put some text in layer n2 to show you text insertion is ok. The same image is also inserted, and it also not showed up.
The transformation matrix is not right.
You can use other PDF utility, like PDFBox, to add an image into digital signature appearance, then analyze the transformation matrix on image painting, also pay attention on its BBOx.
I don't know if it's the text formatting but you have a number of streams (objects 17, 18 and 19) where the "endstream" that denotes the end of the stream data is not being written correctly. The "endstream" should be on a line of its own, and a PDF file requires whitespace between tokens and operators. Therefore, things like
/FRM Doendstream
are invalid syntax, they should be written like
/FRM Do
endstream
For images, the current transform matrix must transform from the 1 unit square that images are specified in, to the desired size in PDF units. You're using a transformation matrix of [1 0 0 -1 0 1] to position and scale the image XObject, which will not give your desired result. Typically, for an unrotated image you'll want to use something like [width 0 0 height Xpos Ypos]. Also, I always recommend enclosing image XObject invocation in a graphic state save/restore so that the CTM required can be popped off the graphic state stack.
Finally, looking at the file in Dropbox your image is damaged. It specifies a width of 400 rasters and a height of 332 rasters - in RGB format, the image should have a length of 398,400 but only has a length of 11097. This is way too short for this image data stream. It looks like this is compressed data, in DCT compressed format. For this to render properly you need to specify that it is compressed and in the format, e.g. add
/Filter /DCTDecode
to the image dictionary.

Resources